diff --git a/hgeometry/hgeometry.cabal b/hgeometry/hgeometry.cabal index 909845238..f7084aced 100644 --- a/hgeometry/hgeometry.cabal +++ b/hgeometry/hgeometry.cabal @@ -447,7 +447,7 @@ library HGeometry.Polygon.Convex.MinkowskiSum HGeometry.Polygon.Triangulation.Types - -- HGeometry.PlaneGraph.Type + HGeometry.PlaneGraph.Type HGeometry.PlaneGraph.Connected.Type HGeometry.LineSegment.Intersection.Types diff --git a/hgeometry/src/HGeometry/PlaneGraph/Type.hs b/hgeometry/src/HGeometry/PlaneGraph/Type.hs index ed828abd2..3e5a6f855 100644 --- a/hgeometry/src/HGeometry/PlaneGraph/Type.hs +++ b/hgeometry/src/HGeometry/PlaneGraph/Type.hs @@ -13,11 +13,11 @@ -------------------------------------------------------------------------------- module HGeometry.PlaneGraph.Type ( PlaneGraph(..) - , fromAdjacencyRep - , fromConnectedSegments + -- , fromAdjacencyRep + -- , fromConnectedSegments -- , VertexData(VertexData), location - , E(..) + -- , E(..) ) where import Control.Lens hiding (holes, holesOf, (.=)) @@ -160,6 +160,7 @@ instance ( Point_ v 2 (NumType v) fromAdjacencyLists = fromEmbedding . toEmbedding -} +{- instance ( Point_ v 2 (NumType v) , Ord (NumType v), Num (NumType v) @@ -265,3 +266,5 @@ instance (Ord r, Num r) => Eq (E r) where a == b = a `compare` b == EQ instance (Ord r, Num r) => Ord (E r) where (E v) `compare` (E u) = ccwCmpAroundWith (Vector2 0 1) (origin :: Point 2 r) (Point v) (Point u) + +-} diff --git a/hgeometry/test/Polygon/SeqSpec.hs b/hgeometry/test/Polygon/SeqSpec.hs index b9490a9e5..b4bfd5b43 100644 --- a/hgeometry/test/Polygon/SeqSpec.hs +++ b/hgeometry/test/Polygon/SeqSpec.hs @@ -7,6 +7,7 @@ import Data.Maybe import qualified Data.Sequence as Seq import qualified Data.Vector.NonEmpty as NV import HGeometry.Cyclic +import HGeometry.Number.Real.Rational import HGeometry.Point import HGeometry.Polygon import HGeometry.Polygon.Instances () @@ -101,3 +102,9 @@ spec = describe "Polygon with Seq1 spec" $ do prop "cw traversals consistent" $ \(pg :: SimplePolygon (Point 2 Rational)) (i :: Int) -> itoListOf (cwOuterBoundaryFrom i) pg === itoListOf (cwOuterBoundaryFrom i) (toSeqPoly pg) + + it "gets rid of duplicate points at the beginning and end" $ + let myPoly :: SimplePolygon (Point 2 (RealNumber 5)) + myPoly = fromJust . fromPoints $ + read @[Point 2 (RealNumber 5)] "[Point2 0 0,Point2 26 37.1,Point2 7.1 45.2,Point2 (-6.6) 39,Point2 (-1.9) 15.1,Point2 (-1.4) 12.7,Point2 0 0]" + in myPoly^..vertices `shouldBe` [Point2 26 37.1,Point2 7.1 45.2,Point2 (-6.6) 39,Point2 (-1.9) 15.1,Point2 (-1.4) 12.7,Point2 0 0] diff --git a/hgeometry/test/Polygon/Triangulation/MakeMonotoneSpec.hs b/hgeometry/test/Polygon/Triangulation/MakeMonotoneSpec.hs index a022c5685..b11a3a683 100644 --- a/hgeometry/test/Polygon/Triangulation/MakeMonotoneSpec.hs +++ b/hgeometry/test/Polygon/Triangulation/MakeMonotoneSpec.hs @@ -4,8 +4,8 @@ import Control.Lens import Data.Maybe (fromJust) import qualified Data.Set as Set import HGeometry.Ext -import HGeometry.Point import HGeometry.LineSegment +import HGeometry.Point import HGeometry.Polygon.Class import HGeometry.Polygon.Simple import HGeometry.Polygon.Triangulation.MakeMonotone diff --git a/todo.org b/todo.org index 4c3a8b3d7..45cd1ccc9 100644 --- a/todo.org +++ b/todo.org @@ -129,7 +129,7 @@ cabal run hgeometry-examples:hgeometry-triangulateworld -- -i -o 130.82s user -** TODO verify fromPoints +** DONE verify fromPoints i.e. add a test that makes sure that the cyclic zero's are correct, i.e. that