Copyright | (C) Frank Staals |
---|---|
License | see the LICENSE file |
Maintainer | Frank Staals |
Safe Haskell | None |
Language | Haskell2010 |
Synopsis
- type VertexId' (s :: k) = VertexId s 'Primal
- type FaceId' (s :: k) = FaceId s 'Primal
- data VertexData r v = VertexData !(Point 2 r) !v
- vData :: forall r v v. Lens (VertexData r v) (VertexData r v) v v
- location :: forall r v r. Lens (VertexData r v) (VertexData r v) (Point 2 r) (Point 2 r)
- data FaceData h f = FaceData (Seq h) !f
- holes :: forall h f h. Lens (FaceData h f) (FaceData h f) (Seq h) (Seq h)
- fData :: forall h f f. Lens (FaceData h f) (FaceData h f) f f
- data PlanarSubdivision s v e f r = PlanarSubdivision (Vector (Component s r)) (Vector (Raw s (VertexId' (Wrap s)) v)) (Vector (Raw s (Dart (Wrap s)) e)) (Vector (RawFace s f))
- type family Wrap (s :: k) :: k where ...
- type Component s r = PlaneGraph (Wrap s) (VertexId' s) (Dart s) (FaceId' s) r
- data ComponentId s
- data PolygonFaceData
- data PlanarGraph (s :: k) (w :: World) v e f
- data PlaneGraph s v e f r
- fromSimplePolygon :: (Ord r, Fractional r) => proxy s -> SimplePolygon p r -> f -> f -> PlanarSubdivision s p () f r
- fromConnectedSegments :: (Foldable f, Ord r, Fractional r) => proxy s -> f (LineSegment 2 p r :+ e) -> PlanarSubdivision s (NonEmpty p) e () r
- fromPlaneGraph :: forall s v e f r. (Ord r, Fractional r) => PlaneGraph s v e f r -> PlanarSubdivision s v e f r
- fromPlaneGraph' :: forall s v e f r. PlaneGraph s v e f r -> Dart s -> PlanarSubdivision s v e f r
- numComponents :: PlanarSubdivision s v e f r -> Int
- numVertices :: PlanarSubdivision s v e f r -> Int
- numEdges :: PlanarSubdivision s v e f r -> Int
- numFaces :: PlanarSubdivision s v e f r -> Int
- numDarts :: PlanarSubdivision s v e f r -> Int
- dual :: forall k (s :: k) (w :: World) v e f. Getter (PlanarGraph s w v e f) (PlanarGraph s (DualOf w) f e v)
- components :: forall k (s :: k) v e f r r. Lens (PlanarSubdivision (s :: k) v e f r) (PlanarSubdivision (s :: k) v e f r) (Vector (Component s r)) (Vector (Component s r))
- component :: ComponentId s -> Lens' (PlanarSubdivision s v e f r) (Component s r)
- vertices' :: PlanarSubdivision s v e f r -> Vector (VertexId' s)
- vertices :: PlanarSubdivision s v e f r -> Vector (VertexId' s, VertexData r v)
- edges' :: PlanarSubdivision s v e f r -> Vector (Dart s)
- edges :: PlanarSubdivision s v e f r -> Vector (Dart s, e)
- faces' :: PlanarSubdivision s v e f r -> Vector (FaceId' s)
- internalFaces' :: PlanarSubdivision s v e f r -> Vector (FaceId' s)
- faces :: PlanarSubdivision s v e f r -> Vector (FaceId' s, FaceData (Dart s) f)
- internalFaces :: PlanarSubdivision s v e f r -> Vector (FaceId' s, FaceData (Dart s) f)
- darts' :: PlanarSubdivision s v e f r -> Vector (Dart s)
- traverseVertices :: Applicative g => (VertexId' s -> v -> g v') -> PlanarSubdivision s v e f r -> g (PlanarSubdivision s v' e f r)
- traverseDarts :: Applicative g => (Dart s -> e -> g e') -> PlanarSubdivision s v e f r -> g (PlanarSubdivision s v e' f r)
- traverseFaces :: Applicative g => (FaceId' s -> f -> g f') -> PlanarSubdivision s v e f r -> g (PlanarSubdivision s v e f' r)
- mapVertices :: (VertexId' s -> t -> v') -> PlanarSubdivision s t e f r -> PlanarSubdivision s v' e f r
- mapDarts :: (Dart s -> t -> e') -> PlanarSubdivision s v t f r -> PlanarSubdivision s v e' f r
- mapFaces :: (FaceId' s -> t -> f') -> PlanarSubdivision s v e t r -> PlanarSubdivision s v e f' r
- headOf :: Dart s -> PlanarSubdivision s v e f r -> VertexId' s
- tailOf :: Dart s -> PlanarSubdivision s v e f r -> VertexId' s
- twin :: forall k (s :: k). Dart s -> Dart s
- endPoints :: Dart s -> PlanarSubdivision s v e f r -> (VertexId' s, VertexId' s)
- incidentEdges :: VertexId' s -> PlanarSubdivision s v e f r -> Vector (Dart s)
- incomingEdges :: VertexId' s -> PlanarSubdivision s v e f r -> Vector (Dart s)
- outgoingEdges :: VertexId' s -> PlanarSubdivision s v e f r -> Vector (Dart s)
- nextIncidentEdge :: Dart s -> PlanarSubdivision s v e f r -> Dart s
- prevIncidentEdge :: Dart s -> PlanarSubdivision s v e f r -> Dart s
- nextIncidentEdgeFrom :: Dart s -> PlanarSubdivision s v e f r -> Dart s
- prevIncidentEdgeFrom :: Dart s -> PlanarSubdivision s v e f r -> Dart s
- neighboursOf :: VertexId' s -> PlanarSubdivision s v e f r -> Vector (VertexId' s)
- leftFace :: Dart s -> PlanarSubdivision s v e f r -> FaceId' s
- rightFace :: Dart s -> PlanarSubdivision s v e f r -> FaceId' s
- outerBoundaryDarts :: FaceId' s -> PlanarSubdivision s v e f r -> Vector (Dart s)
- boundaryVertices :: FaceId' s -> PlanarSubdivision s v e f r -> Vector (VertexId' s)
- holesOf :: FaceId' s -> PlanarSubdivision s v e f r -> Seq (Dart s)
- outerFaceId :: PlanarSubdivision s v e f r -> FaceId' s
- boundary' :: Dart s -> PlanarSubdivision s v e f r -> Vector (Dart s)
- locationOf :: VertexId' s -> Lens' (PlanarSubdivision s v e f r) (Point 2 r)
- class HasDataOf g i where
- endPointsOf :: Dart s -> Getter (PlanarSubdivision s v e f r) (VertexData r v, VertexData r v)
- endPointData :: Dart s -> PlanarSubdivision s v e f r -> (VertexData r v, VertexData r v)
- faceDataOf :: FaceId' s -> Lens' (PlanarSubdivision s v e f r) (FaceData (Dart s) f)
- edgeSegment :: Dart s -> PlanarSubdivision s v e f r -> LineSegment 2 v r :+ e
- edgeSegments :: PlanarSubdivision s v e f r -> Vector (Dart s, LineSegment 2 v r :+ e)
- faceBoundary :: FaceId' s -> PlanarSubdivision s v e f r -> SimplePolygon v r :+ f
- internalFacePolygon :: FaceId' s -> PlanarSubdivision s v e f r -> SomePolygon v r :+ f
- internalFacePolygons :: PlanarSubdivision s v e f r -> Vector (FaceId' s, SomePolygon v r :+ f)
- outerFacePolygon :: (Num r, Ord r) => PlanarSubdivision s v e f r -> MultiPolygon (Maybe v) r :+ f
- outerFacePolygon' :: SimplePolygon v' r -> PlanarSubdivision s v e f r -> MultiPolygon (Either v' v) r :+ f
- facePolygons :: (Num r, Ord r) => PlanarSubdivision s v e f r -> Vector (FaceId' s, SomePolygon (Maybe v) r :+ f)
- newtype VertexId (s :: k) (w :: World) = VertexId {
- _unVertexId :: Int
- newtype FaceId (s :: k) (w :: World) = FaceId {}
- data Dart (s :: k)
- data World
- rawVertexData :: forall k (s :: k) v e f r v. Lens (PlanarSubdivision (s :: k) v e f r) (PlanarSubdivision (s :: k) v e f r) (Vector (Raw s (VertexId' (Wrap s)) v)) (Vector (Raw s (VertexId' (Wrap s)) v))
- rawDartData :: forall k (s :: k) v e f r e. Lens (PlanarSubdivision (s :: k) v e f r) (PlanarSubdivision (s :: k) v e f r) (Vector (Raw s (Dart (Wrap s)) e)) (Vector (Raw s (Dart (Wrap s)) e))
- rawFaceData :: forall k (s :: k) v e f r f. Lens (PlanarSubdivision (s :: k) v e f r) (PlanarSubdivision (s :: k) v e f r) (Vector (RawFace s f)) (Vector (RawFace s f))
- vertexData :: Lens (PlanarSubdivision s v e f r) (PlanarSubdivision s v' e f r) (Vector v) (Vector v')
- dartData :: Lens (PlanarSubdivision s v e f r) (PlanarSubdivision s v e' f r) (Vector (Dart s, e)) (Vector (Dart s, e'))
- faceData :: Lens (PlanarSubdivision s v e f r) (PlanarSubdivision s v e f' r) (Vector f) (Vector f')
- dataVal :: Lens (Raw s ia a) (Raw s ia b) a b
- dartMapping :: PlanarSubdivision s v e f r -> Vector (Dart (Wrap s), Dart s)
- data Raw s ia a = Raw {
- _compId :: !(ComponentId s)
- _idxVal :: !ia
- _dataVal :: !a
- asLocalD :: Dart s -> PlanarSubdivision s v e f r -> (ComponentId s, Dart (Wrap s), Component s r)
- asLocalV :: VertexId' s -> PlanarSubdivision s v e f r -> (ComponentId s, VertexId' (Wrap s), Component s r)
- asLocalF :: FaceId' s -> PlanarSubdivision s v e f r -> NonEmpty (ComponentId s, FaceId' (Wrap s), Component s r)
- class Incident s a b where
- incidences :: PlanarSubdivision s v e f r -> a -> [b]
- common :: (Incident s a c, Incident s b c, Ord c) => PlanarSubdivision s v e f r -> a -> b -> [c]
- commonVertices :: (Incident s a (VertexId' s), Incident s b (VertexId' s)) => PlanarSubdivision s v e f r -> a -> b -> [VertexId' s]
- commonDarts :: (Incident s a (Dart s), Incident s b (Dart s)) => PlanarSubdivision s v e f r -> a -> b -> [Dart s]
- commonFaces :: (Incident s a (FaceId' s), Incident s b (FaceId' s)) => PlanarSubdivision s v e f r -> a -> b -> [FaceId' s]
Documentation
data VertexData r v Source #
Note that the functor instance is in v
VertexData !(Point 2 r) !v |
Instances
vData :: forall r v v. Lens (VertexData r v) (VertexData r v) v v Source #
location :: forall r v r. Lens (VertexData r v) (VertexData r v) (Point 2 r) (Point 2 r) Source #
The Face data consists of the data itself and a list of holes
Instances
data PlanarSubdivision s v e f r Source #
A planarsubdivision is essentially a bunch of plane-graphs; one for every connected component. These graphs store the global ID's (darts, vertexId's, faceId's) in their data values. This essentially gives us a mapping between the two.
note that a face may actually occur in multiple graphs, hence when we store
the edges to the the holes, we store the global edgeId's rather than the
local
edgeId (dart)'s.
invariant: the outerface has faceId 0
PlanarSubdivision (Vector (Component s r)) (Vector (Raw s (VertexId' (Wrap s)) v)) (Vector (Raw s (Dart (Wrap s)) e)) (Vector (RawFace s f)) |
Instances
type Component s r = PlaneGraph (Wrap s) (VertexId' s) (Dart s) (FaceId' s) r Source #
A connected component.
For every face f, and every hole in this face, the facedata points to a dart d on the hole s.t. this dart has the face f on its left. i.e. leftFace d = f
data ComponentId s Source #
ComponentId type
Instances
data PolygonFaceData Source #
Data type that expresses whether or not we are inside or outside the polygon.
Instances
Eq PolygonFaceData Source # | |
Defined in Data.Geometry.PlanarSubdivision.Basic (==) :: PolygonFaceData -> PolygonFaceData -> Bool # (/=) :: PolygonFaceData -> PolygonFaceData -> Bool # | |
Read PolygonFaceData Source # | |
Defined in Data.Geometry.PlanarSubdivision.Basic | |
Show PolygonFaceData Source # | |
Defined in Data.Geometry.PlanarSubdivision.Basic showsPrec :: Int -> PolygonFaceData -> ShowS # show :: PolygonFaceData -> String # showList :: [PolygonFaceData] -> ShowS # |
data PlanarGraph (s :: k) (w :: World) v e f #
A *connected* Planar graph with bidirected edges. I.e. the edges (darts) are directed, however, for every directed edge, the edge in the oposite direction is also in the graph.
The types v, e, and f are the are the types of the data associated with the vertices, edges, and faces, respectively.
The orbits in the embedding are assumed to be in counterclockwise order. Therefore, every dart directly bounds the face to its right.
Instances
data PlaneGraph s v e f r Source #
Embedded, *connected*, planar graph
Instances
:: (Ord r, Fractional r) | |
=> proxy s | |
-> SimplePolygon p r | |
-> f | data inside |
-> f | data outside the polygon |
-> PlanarSubdivision s p () f r |
Construct a plane graph from a simple polygon. It is assumed that the polygon is given in counterclockwise order.
the interior of the polygon will have faceId 0
pre: the input polygon is given in counterclockwise order running time: \(O(n)\).
fromConnectedSegments :: (Foldable f, Ord r, Fractional r) => proxy s -> f (LineSegment 2 p r :+ e) -> PlanarSubdivision s (NonEmpty p) e () r Source #
Constructs a connected planar subdivision.
pre: the segments form a single connected component running time: \(O(n\log n)\)
fromPlaneGraph :: forall s v e f r. (Ord r, Fractional r) => PlaneGraph s v e f r -> PlanarSubdivision s v e f r Source #
Constructs a planarsubdivision from a PlaneGraph
runningTime: \(O(n)\)
fromPlaneGraph' :: forall s v e f r. PlaneGraph s v e f r -> Dart s -> PlanarSubdivision s v e f r Source #
Given a (connected) PlaneGraph and a dart that has the outerface on its left | Constructs a planarsubdivision
runningTime: \(O(n)\)
numComponents :: PlanarSubdivision s v e f r -> Int Source #
Get the number of vertices
>>>
numVertices myGraph
1
numVertices :: PlanarSubdivision s v e f r -> Int Source #
Get the number of vertices
>>>
numVertices myGraph
4
numEdges :: PlanarSubdivision s v e f r -> Int Source #
Get the number of Edges
>>>
numEdges myGraph
6
numFaces :: PlanarSubdivision s v e f r -> Int Source #
\( O(1) \). Get the number of faces
>>>
numFaces myGraph
4
numDarts :: PlanarSubdivision s v e f r -> Int Source #
Get the number of Darts
>>>
numDarts myGraph
12
dual :: forall k (s :: k) (w :: World) v e f. Getter (PlanarGraph s w v e f) (PlanarGraph s (DualOf w) f e v) #
Get the dual graph of this graph.
components :: forall k (s :: k) v e f r r. Lens (PlanarSubdivision (s :: k) v e f r) (PlanarSubdivision (s :: k) v e f r) (Vector (Component s r)) (Vector (Component s r)) Source #
component :: ComponentId s -> Lens' (PlanarSubdivision s v e f r) (Component s r) Source #
Lens to access a particular component of the planar subdivision.
vertices' :: PlanarSubdivision s v e f r -> Vector (VertexId' s) Source #
Enumerate all vertices
>>>
vertices' myGraph
[VertexId 0,VertexId 1,VertexId 2,VertexId 3]
vertices :: PlanarSubdivision s v e f r -> Vector (VertexId' s, VertexData r v) Source #
Enumerate all vertices, together with their vertex data
edges' :: PlanarSubdivision s v e f r -> Vector (Dart s) Source #
Enumerate all edges. We report only the Positive darts
edges :: PlanarSubdivision s v e f r -> Vector (Dart s, e) Source #
Enumerate all edges with their edge data. We report only the Positive darts.
>>>
mapM_ print $ edges myGraph
(Dart (Arc 2) +1,"c+") (Dart (Arc 1) +1,"b+") (Dart (Arc 0) +1,"a+") (Dart (Arc 5) +1,"g+") (Dart (Arc 4) +1,"e+") (Dart (Arc 3) +1,"d+")
faces' :: PlanarSubdivision s v e f r -> Vector (FaceId' s) Source #
\( O(n) \). Vector of all primal faces.
internalFaces' :: PlanarSubdivision s v e f r -> Vector (FaceId' s) Source #
\( O(n) \). Vector of all primal faces.
faces :: PlanarSubdivision s v e f r -> Vector (FaceId' s, FaceData (Dart s) f) Source #
\( O(n) \). Vector of all primal faces with associated data.
internalFaces :: PlanarSubdivision s v e f r -> Vector (FaceId' s, FaceData (Dart s) f) Source #
Enumerates all faces with their face data exlcluding the outer face
traverseVertices :: Applicative g => (VertexId' s -> v -> g v') -> PlanarSubdivision s v e f r -> g (PlanarSubdivision s v' e f r) Source #
Traverse the vertices of the planar subdivision
traverseDarts :: Applicative g => (Dart s -> e -> g e') -> PlanarSubdivision s v e f r -> g (PlanarSubdivision s v e' f r) Source #
Traverse the darts of the Planar subdivision
traverseFaces :: Applicative g => (FaceId' s -> f -> g f') -> PlanarSubdivision s v e f r -> g (PlanarSubdivision s v e f' r) Source #
Traverse the faces of the planar subdivision.
mapVertices :: (VertexId' s -> t -> v') -> PlanarSubdivision s t e f r -> PlanarSubdivision s v' e f r Source #
Map with index over all vertices
mapDarts :: (Dart s -> t -> e') -> PlanarSubdivision s v t f r -> PlanarSubdivision s v e' f r Source #
Map with index over all darts
mapFaces :: (FaceId' s -> t -> f') -> PlanarSubdivision s v e t r -> PlanarSubdivision s v e f' r Source #
Map with index over all faces
headOf :: Dart s -> PlanarSubdivision s v e f r -> VertexId' s Source #
The vertex this dart is heading in to
running time: \(O(1)\)
tailOf :: Dart s -> PlanarSubdivision s v e f r -> VertexId' s Source #
The tail of a dart, i.e. the vertex this dart is leaving from
running time: \(O(1)\)
twin :: forall k (s :: k). Dart s -> Dart s #
Get the twin of this dart (edge)
>>>
twin (dart 0 "+1")
Dart (Arc 0) -1>>>
twin (dart 0 "-1")
Dart (Arc 0) +1
endPoints :: Dart s -> PlanarSubdivision s v e f r -> (VertexId' s, VertexId' s) Source #
endPoints d g = (tailOf d g, headOf d g)
running time: \(O(1)\)
incidentEdges :: VertexId' s -> PlanarSubdivision s v e f r -> Vector (Dart s) Source #
All edges incident to vertex v, in counterclockwise order around v.
running time: \(O(k)\), where \(k\) is the number of edges reported.
incomingEdges :: VertexId' s -> PlanarSubdivision s v e f r -> Vector (Dart s) Source #
All edges incident to vertex v in incoming direction (i.e. pointing into v) in counterclockwise order around v.
running time: \(O(k)\), where (k) is the total number of incident edges of v
outgoingEdges :: VertexId' s -> PlanarSubdivision s v e f r -> Vector (Dart s) Source #
All edges incident to vertex v in outgoing direction (i.e. pointing away from v) in counterclockwise order around v.
running time: \(O(k)\), where (k) is the total number of incident edges of v
nextIncidentEdge :: Dart s -> PlanarSubdivision s v e f r -> Dart s Source #
Given a dart d that points into some vertex v, report the next dart in the cyclic (counterclockwise) order around v.
running time: \(O(1)\)
prevIncidentEdge :: Dart s -> PlanarSubdivision s v e f r -> Dart s Source #
Given a dart d that points into some vertex v, report the previous dart in the cyclic (counterclockwise) order around v.
running time: \(O(1)\)
>>>
prevIncidentEdge (dart 1 "+1") smallG
Dart (Arc 3) +1
nextIncidentEdgeFrom :: Dart s -> PlanarSubdivision s v e f r -> Dart s Source #
Given a dart d that points away from some vertex v, report the next dart in the cyclic (counterclockwise) order around v.
running time: \(O(1)\)
prevIncidentEdgeFrom :: Dart s -> PlanarSubdivision s v e f r -> Dart s Source #
Given a dart d that points into away from vertex v, report the previous dart in the cyclic (counterclockwise) order around v.
running time: \(O(1)\)
neighboursOf :: VertexId' s -> PlanarSubdivision s v e f r -> Vector (VertexId' s) Source #
Gets the neighbours of a particular vertex, in counterclockwise order around the vertex.
running time: \(O(k)\), where \(k\) is the output size
leftFace :: Dart s -> PlanarSubdivision s v e f r -> FaceId' s Source #
The face to the left of the dart
running time: \(O(1)\).
rightFace :: Dart s -> PlanarSubdivision s v e f r -> FaceId' s Source #
The face to the right of the dart
running time: \(O(1)\).
outerBoundaryDarts :: FaceId' s -> PlanarSubdivision s v e f r -> Vector (Dart s) Source #
The darts on the outer boundary of this face. The darts are reported in order along the face. This means that for internal faces the darts are reported in *clockwise* order along the boundary, whereas for the outer face the darts are reported in counter clockwise order.
running time: \(O(k)\), where \(k\) is the output size.
boundaryVertices :: FaceId' s -> PlanarSubdivision s v e f r -> Vector (VertexId' s) Source #
The vertices of the outer boundary of the face, for internal faces in clockwise order, for the outer face in counter clockwise order.
running time: \(O(k)\), where \(k\) is the output size.
holesOf :: FaceId' s -> PlanarSubdivision s v e f r -> Seq (Dart s) Source #
Lists the holes in this face, given as a list of darts to arbitrary darts on those faces. The returned darts are on the outside of the hole, i.e. they are incident to the given input face:
all (\d -> leftFace d ps == fi) $ holesOf fi ps
running time: \(O(k)\), where \(k\) is the number of darts returned.
outerFaceId :: PlanarSubdivision s v e f r -> FaceId' s Source #
gets the id of the outer face
running time: \(O(1)\)
boundary' :: Dart s -> PlanarSubdivision s v e f r -> Vector (Dart s) Source #
Given a dart d, generates the darts on (the current component of) the boundary of the the face that is to the right of the given dart. The darts are reported in order along the face. This means that for
- (the outer boundary of an) internal faces the darts are reported in *clockwise* order along the boundary,
- the "inner" boundary of a face, i.e. the boundary of ahole, the darts are reported in *counter clockwise* order.
Note that this latter case means that in the darts of a a component of the outer face are reported in counter clockwise order.
\(O(k)\), where \(k\) is the number of darts reported
locationOf :: VertexId' s -> Lens' (PlanarSubdivision s v e f r) (Point 2 r) Source #
Get the location of a vertex in the planar subdivision.
Note that the setting part of this lens may be very expensive! Moreover, use with care (as this may destroy planarity etc.)
General interface to accessing vertex data, dart data, and face data.
dataOf :: i -> Lens' g (DataOf g i) #
get the data associated with the value i.
running time: \(O(1)\) to read the data, \(O(n)\) to write it.
Instances
endPointsOf :: Dart s -> Getter (PlanarSubdivision s v e f r) (VertexData r v, VertexData r v) Source #
Getter for the data at the endpoints of a dart
running time: \(O(1)\)
endPointData :: Dart s -> PlanarSubdivision s v e f r -> (VertexData r v, VertexData r v) Source #
data corresponding to the endpoints of the dart
running time: \(O(1)\)
faceDataOf :: FaceId' s -> Lens' (PlanarSubdivision s v e f r) (FaceData (Dart s) f) Source #
Lens to get the face data of a particular face. Note that the setting part of this lens may be very expensive! (O(n))
edgeSegment :: Dart s -> PlanarSubdivision s v e f r -> LineSegment 2 v r :+ e Source #
Given a dart and the subdivision constructs the line segment representing it. The segment \(\overline{uv})\) is has \(u\) as its tail and \(v\) as its head.
\(O(1)\)
edgeSegments :: PlanarSubdivision s v e f r -> Vector (Dart s, LineSegment 2 v r :+ e) Source #
Reports all edges as line segments
faceBoundary :: FaceId' s -> PlanarSubdivision s v e f r -> SimplePolygon v r :+ f Source #
The outerboundary of the face as a simple polygon. For internal faces the polygon that is reported has its vertices stored in CCW order (as expected).
pre: FaceId refers to an internal face.
\(O(k)\), where \(k\) is the complexity of the outer boundary of the face
internalFacePolygon :: FaceId' s -> PlanarSubdivision s v e f r -> SomePolygon v r :+ f Source #
Constructs the boundary of the given face.
\(O(k)\), where \(k\) is the complexity of the face
internalFacePolygons :: PlanarSubdivision s v e f r -> Vector (FaceId' s, SomePolygon v r :+ f) Source #
Procuces a polygon for each *internal* face of the planar subdivision.
outerFacePolygon :: (Num r, Ord r) => PlanarSubdivision s v e f r -> MultiPolygon (Maybe v) r :+ f Source #
Returns a sufficiently large, rectangular, polygon that contains the entire planar subdivision. Each component corresponds to a hole in this polygon.
outerFacePolygon' :: SimplePolygon v' r -> PlanarSubdivision s v e f r -> MultiPolygon (Either v' v) r :+ f Source #
Given a sufficiently large outer boundary, draw the outerface as a polygon with a hole.
facePolygons :: (Num r, Ord r) => PlanarSubdivision s v e f r -> Vector (FaceId' s, SomePolygon (Maybe v) r :+ f) Source #
Procuces a polygon for each face of the planar subdivision.
newtype VertexId (s :: k) (w :: World) #
A vertex in a planar graph. A vertex is tied to a particular planar graph by the phantom type s, and to a particular world w.
Instances
newtype FaceId (s :: k) (w :: World) #
The type to represent FaceId's
Instances
A dart represents a bi-directed edge. I.e. a dart has a direction, however the dart of the oposite direction is always present in the planar graph as well.
Instances
The world in which the graph lives
rawVertexData :: forall k (s :: k) v e f r v. Lens (PlanarSubdivision (s :: k) v e f r) (PlanarSubdivision (s :: k) v e f r) (Vector (Raw s (VertexId' (Wrap s)) v)) (Vector (Raw s (VertexId' (Wrap s)) v)) Source #
rawDartData :: forall k (s :: k) v e f r e. Lens (PlanarSubdivision (s :: k) v e f r) (PlanarSubdivision (s :: k) v e f r) (Vector (Raw s (Dart (Wrap s)) e)) (Vector (Raw s (Dart (Wrap s)) e)) Source #
rawFaceData :: forall k (s :: k) v e f r f. Lens (PlanarSubdivision (s :: k) v e f r) (PlanarSubdivision (s :: k) v e f r) (Vector (RawFace s f)) (Vector (RawFace s f)) Source #
vertexData :: Lens (PlanarSubdivision s v e f r) (PlanarSubdivision s v' e f r) (Vector v) (Vector v') Source #
Lens to the facedata of the vertexdata themselves. The indices correspond to the vertexId's
dartData :: Lens (PlanarSubdivision s v e f r) (PlanarSubdivision s v e' f r) (Vector (Dart s, e)) (Vector (Dart s, e')) Source #
lens to access the Dart Data
faceData :: Lens (PlanarSubdivision s v e f r) (PlanarSubdivision s v e f' r) (Vector f) (Vector f') Source #
Lens to the facedata of the faces themselves. The indices correspond to the faceIds
dartMapping :: PlanarSubdivision s v e f r -> Vector (Dart (Wrap s), Dart s) Source #
Mapping between the internal and extenral darts
Helper type for the data that we store in a planar subdivision
Raw | |
|
Instances
FunctorWithIndex i (Raw ci i) Source # | |
Defined in Data.Geometry.PlanarSubdivision.Raw | |
FoldableWithIndex i (Raw ci i) Source # | |
Defined in Data.Geometry.PlanarSubdivision.Raw | |
TraversableWithIndex i (Raw ci i) Source # | |
Defined in Data.Geometry.PlanarSubdivision.Raw itraverse :: Applicative f => (i -> a -> f b) -> Raw ci i a -> f (Raw ci i b) # | |
Functor (Raw s ia) Source # | |
Foldable (Raw s ia) Source # | |
Defined in Data.Geometry.PlanarSubdivision.Raw fold :: Monoid m => Raw s ia m -> m # foldMap :: Monoid m => (a -> m) -> Raw s ia a -> m # foldMap' :: Monoid m => (a -> m) -> Raw s ia a -> m # foldr :: (a -> b -> b) -> b -> Raw s ia a -> b # foldr' :: (a -> b -> b) -> b -> Raw s ia a -> b # foldl :: (b -> a -> b) -> b -> Raw s ia a -> b # foldl' :: (b -> a -> b) -> b -> Raw s ia a -> b # foldr1 :: (a -> a -> a) -> Raw s ia a -> a # foldl1 :: (a -> a -> a) -> Raw s ia a -> a # elem :: Eq a => a -> Raw s ia a -> Bool # maximum :: Ord a => Raw s ia a -> a # minimum :: Ord a => Raw s ia a -> a # | |
Traversable (Raw s ia) Source # | |
Defined in Data.Geometry.PlanarSubdivision.Raw | |
(Eq ia, Eq a) => Eq (Raw s ia a) Source # | |
(Show ia, Show a) => Show (Raw s ia a) Source # | |
Generic (Raw s ia a) Source # | |
(ToJSON ia, ToJSON a) => ToJSON (Raw s ia a) Source # | |
Defined in Data.Geometry.PlanarSubdivision.Raw | |
(FromJSON ia, FromJSON a) => FromJSON (Raw s ia a) Source # | |
type Rep (Raw s ia a) Source # | |
Defined in Data.Geometry.PlanarSubdivision.Raw type Rep (Raw s ia a) = D1 ('MetaData "Raw" "Data.Geometry.PlanarSubdivision.Raw" "hgeometry-0.13-8qLvB9JVk1yDS01KUXpxiU" 'False) (C1 ('MetaCons "Raw" 'PrefixI 'True) (S1 ('MetaSel ('Just "_compId") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (ComponentId s)) :*: (S1 ('MetaSel ('Just "_idxVal") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 ia) :*: S1 ('MetaSel ('Just "_dataVal") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 a)))) |
asLocalD :: Dart s -> PlanarSubdivision s v e f r -> (ComponentId s, Dart (Wrap s), Component s r) Source #
asLocalV :: VertexId' s -> PlanarSubdivision s v e f r -> (ComponentId s, VertexId' (Wrap s), Component s r) Source #
asLocalF :: FaceId' s -> PlanarSubdivision s v e f r -> NonEmpty (ComponentId s, FaceId' (Wrap s), Component s r) Source #
Get the local face and component from a given face.
class Incident s a b where Source #
A class for describing which features (vertex, edge, face) of a planar subdivision can be incident to each other.
incidences :: PlanarSubdivision s v e f r -> a -> [b] Source #
Instances
common :: (Incident s a c, Incident s b c, Ord c) => PlanarSubdivision s v e f r -> a -> b -> [c] Source #
Given two features (vertex, edge, or face) of a subdivision, report all features of a given type that are incident to both.
commonVertices :: (Incident s a (VertexId' s), Incident s b (VertexId' s)) => PlanarSubdivision s v e f r -> a -> b -> [VertexId' s] Source #
Given two features (edge or face) of a subdivision, report all vertices that are incident to both.
commonDarts :: (Incident s a (Dart s), Incident s b (Dart s)) => PlanarSubdivision s v e f r -> a -> b -> [Dart s] Source #
Given two features (vertex or face) of a subdivision, report all edges that are incident to both. Returns both darts of each qualifying edge.
commonFaces :: (Incident s a (FaceId' s), Incident s b (FaceId' s)) => PlanarSubdivision s v e f r -> a -> b -> [FaceId' s] Source #
Given two features (vertex or edge) of a subdivision, report all faces that are incident to both.