diff --git a/Algorithms/RangeSearch/Core.hs b/Algorithms/RangeSearch/QuadTree.hs similarity index 96% rename from Algorithms/RangeSearch/Core.hs rename to Algorithms/RangeSearch/QuadTree.hs index 98287a6..393ee4c 100644 --- a/Algorithms/RangeSearch/Core.hs +++ b/Algorithms/RangeSearch/QuadTree.hs @@ -1,4 +1,4 @@ -module Algorithms.RangeSearch.Core +module Algorithms.RangeSearch.QuadTree (quadTree, quadTreeSquares, qtFoldl, @@ -107,7 +107,7 @@ quadTreeSquares sq (TNode nw ne sw se) = quadTreeSquares (swSq sq) sw ++ quadTreeSquares (seSq sq) se --- |Get the current square of the zipper, relative to the to the given top +-- |Get the current square of the zipper, relative to the given top -- square. getSquareByZipper :: Square -> Zipper a -> Square getSquareByZipper sq z = go sq (reverse . snd $ z) @@ -197,6 +197,9 @@ findNeighbor ot zr = case ot of checkParent _ = Nothing +lookupByNeighbors :: [Orient] -> Zipper a -> Maybe (Zipper a) +lookupByNeighbors = flip (foldlM (flip findNeighbor)) + testArr :: [PT] testArr = [p2 (200.0, 450.0), diff --git a/CG2.cabal b/CG2.cabal index e3f97ba..55e2069 100644 --- a/CG2.cabal +++ b/CG2.cabal @@ -54,7 +54,7 @@ executable Gtk main-is: GtkMain.hs -- Modules included in this executable, other than Main. - other-modules: MyPrelude GUI.Gtk Graphics.Diagram.Gtk Graphics.Diagram.Types Graphics.Diagram.Plotter Parser.PathParser Parser.Meshparser Parser.Core System.FileSystem.FileExt Algebra.Vector Algorithms.ConvexHull.GrahamScan QueueEx Algorithms.PolygonIntersection.Core Algorithms.RangeSearch.Core + other-modules: MyPrelude GUI.Gtk Graphics.Diagram.Gtk Graphics.Diagram.Types Graphics.Diagram.Plotter Parser.PathParser Parser.Meshparser Parser.Core System.FileSystem.FileExt Algebra.Vector Algorithms.ConvexHull.GrahamScan QueueEx Algorithms.PolygonIntersection.Core Algorithms.RangeSearch.QuadTree -- LANGUAGE extensions used by modules in this package. -- other-extensions: diff --git a/Graphics/Diagram/Plotter.hs b/Graphics/Diagram/Plotter.hs index 7e49683..e1d40d1 100644 --- a/Graphics/Diagram/Plotter.hs +++ b/Graphics/Diagram/Plotter.hs @@ -4,7 +4,7 @@ module Graphics.Diagram.Plotter where import Algebra.VectorTypes import Algorithms.ConvexHull.GrahamScan -import Algorithms.RangeSearch.Core +import Algorithms.RangeSearch.QuadTree import Algorithms.PolygonIntersection.Core import Data.Maybe import Data.Monoid diff --git a/Parser/PathParser.hs b/Parser/PathParser.hs index 9986c98..a9b81d6 100644 --- a/Parser/PathParser.hs +++ b/Parser/PathParser.hs @@ -4,7 +4,7 @@ module Parser.PathParser where import Control.Applicative import Parser.Core -import Algorithms.RangeSearch.Core (Quad(NW, NE, SW, SE), Orient(North, South, West, East)) +import Algorithms.RangeSearch.QuadTree (Quad(NW, NE, SW, SE), Orient(North, South, West, East)) -- |Parse a string such as "ne, n, sw, e" into