diff --git a/hgeometry-ipe/src/Ipe/Attributes.hs b/hgeometry-ipe/src/Ipe/Attributes.hs index 1e3f2fe37..a7a775011 100644 --- a/hgeometry-ipe/src/Ipe/Attributes.hs +++ b/hgeometry-ipe/src/Ipe/Attributes.hs @@ -151,7 +151,6 @@ instance Semigroup (Attr f l) where instance Monoid (Attr f l) where mempty = NoAttr - mappend = (<>) -------------------------------------------------------------------------------- -- * Attributes @@ -175,10 +174,9 @@ instance ( ReifyConstraint Eq (Attr f) ats, RecordToList ats instance RecApplicative ats => Monoid (Attributes f ats) where mempty = Attrs $ rpure mempty - a `mappend` b = a <> b instance Semigroup (Attributes f ats) where - (Attrs as) <> (Attrs bs) = Attrs $ zipRecsWith mappend as bs + (Attrs as) <> (Attrs bs) = Attrs $ zipRecsWith (<>) as bs -- | Traverse implementation for Attrs traverseAttrs :: Applicative h diff --git a/hgeometry/src/Algorithms/Geometry/DelaunayTriangulation/Types.hs b/hgeometry/src/Algorithms/Geometry/DelaunayTriangulation/Types.hs index 3fb3a7c98..4840aa5be 100644 --- a/hgeometry/src/Algorithms/Geometry/DelaunayTriangulation/Types.hs +++ b/hgeometry/src/Algorithms/Geometry/DelaunayTriangulation/Types.hs @@ -27,16 +27,16 @@ module Algorithms.Geometry.DelaunayTriangulation.Types import Control.Lens import qualified Data.CircularList as C import Data.Ext -import Geometry.Point -import Geometry.Properties -import Geometry.PlanarSubdivision import qualified Data.IntMap.Strict as IM import qualified Data.Map as M +import Geometry.PlanarSubdivision +import Geometry.Point +import Geometry.Properties -- import qualified Data.Map.Strict as SM -import qualified Data.PlaneGraph as PG +import qualified Data.PlaneGraph as PG import qualified Data.PlanarGraph as PPG import qualified Data.Vector as V - +import Data.PlaneGraph.Core (PlaneGraph(..)) -------------------------------------------------------------------------------- @@ -124,7 +124,7 @@ toPlanarSubdivision = fromPlaneGraph . toPlaneGraph -- -- running time: \(O(n)\). toPlaneGraph :: forall s p r. Triangulation p r -> PG.PlaneGraph s p () () r -toPlaneGraph tr = PG.PlaneGraph $ g&PPG.vertexData .~ vtxData +toPlaneGraph tr = PlaneGraph $ g&PPG.vertexData .~ vtxData where g = PPG.fromAdjacencyLists . V.toList . V.imap f $ tr^.neighbours f i adj = (VertexId i, C.leftElements $ VertexId <$> adj) -- report in CCW order diff --git a/hgeometry/src/Data/PlaneGraph.hs b/hgeometry/src/Data/PlaneGraph.hs index d1c820198..952f89e1f 100644 --- a/hgeometry/src/Data/PlaneGraph.hs +++ b/hgeometry/src/Data/PlaneGraph.hs @@ -13,7 +13,7 @@ -------------------------------------------------------------------------------- module Data.PlaneGraph( -- $setup -- * The PlaneGraph data type - PlaneGraph(PlaneGraph), graph + PlaneGraph, graph , PlanarGraph , VertexData(VertexData), vData, location, vtxDataToExt diff --git a/hgeometry/src/Geometry/Arrangement.hs b/hgeometry/src/Geometry/Arrangement.hs index cf54adce9..88e5c3f6d 100644 --- a/hgeometry/src/Geometry/Arrangement.hs +++ b/hgeometry/src/Geometry/Arrangement.hs @@ -8,18 +8,19 @@ -- Data type for representing an Arrangement of lines in \(\mathbb{R}^2\). -- -------------------------------------------------------------------------------- -module Geometry.Arrangement( Arrangement(..) - , inputLines, subdivision, boundedArea, unboundedIntersections - , ArrangementBoundary +module Geometry.Arrangement + ( Arrangement + , inputLines, subdivision, boundedArea, unboundedIntersections + , ArrangementBoundary - , constructArrangement - , constructArrangementInBox - , constructArrangementInBox' + , constructArrangement + , constructArrangementInBox + , constructArrangementInBox' - , traverseLine - , findStart, findStartVertex, findStartDart - , follow - ) where + , traverseLine + , findStart, findStartVertex, findStartDart + , follow + ) where import Geometry.Arrangement.Internal diff --git a/hgeometry/src/Geometry/PlanarSubdivision.hs b/hgeometry/src/Geometry/PlanarSubdivision.hs index 1a4e19a9e..013821589 100644 --- a/hgeometry/src/Geometry/PlanarSubdivision.hs +++ b/hgeometry/src/Geometry/PlanarSubdivision.hs @@ -10,9 +10,83 @@ -- -------------------------------------------------------------------------------- module Geometry.PlanarSubdivision - ( module Geometry.PlanarSubdivision.Basic + ( -- $setup + PlanarSubdivision + + , Component, ComponentId + + -- * Constructing Planar Subdivisions + , fromSimplePolygon + , fromConnectedSegments + , fromPlaneGraph, fromPlaneGraph' , fromPolygons, fromPolygons' , fromPolygon + + -- * Quering the Planar Subdivision + , numComponents, numVertices + , numEdges, numFaces, numDarts + , dual + + , components, component + , vertices', vertices + , edges', edges + , faces', internalFaces', faces, internalFaces + , darts' + + -- * Incidences and Adjacencies + , headOf, tailOf, twin, endPoints + + , incidentEdges, incomingEdges, outgoingEdges + , nextIncidentEdge, prevIncidentEdge + , nextIncidentEdgeFrom, prevIncidentEdgeFrom + , neighboursOf + + , leftFace, rightFace + , outerBoundaryDarts, boundaryVertices, holesOf + , outerFaceId + , boundary' + + , Incident (incidences) + , common, commonVertices, commonDarts, commonFaces + + -- * Data + , locationOf + , HasDataOf(..) + + , endPointsOf, endPointData + + , faceDataOf + + , traverseVertices, traverseDarts, traverseFaces + , mapVertices, mapDarts, mapFaces + + -- * Obtaining a Geometric Representation + , edgeSegment, edgeSegments + , faceBoundary + , internalFacePolygon, internalFacePolygons + , outerFacePolygon, outerFacePolygon' + , facePolygons + + -- * IO + + -- * ReExports + , VertexId', FaceId' + , VertexId(..), FaceId(..), Dart, World(..) + , VertexData(VertexData), PG.vData, PG.location + , PlanarGraph + , PlaneGraph + + -- * Helper; dealing with the Raw types + , PolygonFaceData(..) + , FaceData(FaceData), holes, fData + , Wrap + , rawVertexData, rawDartData, rawFaceData + , vertexData, dartData, faceData + , dataVal + , dartMapping, Raw(..) + , asLocalD, asLocalV, asLocalF + + ) where -- import Algorithms.Geometry.PolygonTriangulation.Triangulate @@ -22,9 +96,9 @@ import qualified Data.Vector as V import qualified Data.List.NonEmpty as NonEmpty import Geometry.PlanarSubdivision.Basic import Geometry.PlanarSubdivision.Merge -import Geometry.PlanarSubdivision.TreeRep +import Geometry.PlanarSubdivision.TreeRep() import Geometry.Polygon - +import qualified Data.PlaneGraph as PG -- import Geometry.Point -- import qualified Data.List.NonEmpty as NonEmpty