diff --git a/hgeometry/data/test-with-ipe/PlaneGraph/myPlaneGraph.yaml b/hgeometry/data/test-with-ipe/PlaneGraph/myPlaneGraph.yaml new file mode 100644 index 000000000..a42c11927 --- /dev/null +++ b/hgeometry/data/test-with-ipe/PlaneGraph/myPlaneGraph.yaml @@ -0,0 +1,75 @@ +adjacencies: +- - 0 + - - 1 + - 5 + - 9 + - 2 +- - 1 + - - 0 + - 5 + - 12 +- - 2 + - - 3 + - 0 +- - 3 + - - 4 + - 2 +- - 4 + - - 3 + - 13 +- - 5 + - - 1 + - 0 + - 6 + - 8 +- - 6 + - - 5 + - 9 +- - 7 + - - 8 + - 11 +- - 8 + - - 5 + - 7 + - 12 +- - 9 + - - 6 + - 0 + - 10 +- - 10 + - - 9 + - 11 +- - 11 + - - 10 + - 7 +- - 12 + - - 8 + - 14 + - 1 + - 13 +- - 13 + - - 4 + - 14 + - 12 +- - 14 + - - 13 + - 12 +faces: +- core: 0 + extra: "Outer" +- core: 1 + extra: A +- core: 2 + extra: B +- core: 3 + extra: C +- core: 4 + extra: D +- core: 5 + extra: E +- core: 6 + extra: F +darts: + +vertices: +- core: diff --git a/hgeometry/src/HGeometry/PlaneGraph/Class.hs b/hgeometry/src/HGeometry/PlaneGraph/Class.hs index 29bd3f9e9..02ac8edba 100644 --- a/hgeometry/src/HGeometry/PlaneGraph/Class.hs +++ b/hgeometry/src/HGeometry/PlaneGraph/Class.hs @@ -77,7 +77,7 @@ class ( PlanarGraph_ planeGraph -- | gets the id of the outer face -- outerFaceId :: planeGraph -> FaceIx planeGraph - outerFaceId ps = leftFace (outerFaceDart ps) ps + outerFaceId ps = ps^.leftFaceOf (outerFaceDart ps).asIndex -- | gets a dart incident to the outer face (in particular, that has the -- outerface on its left) diff --git a/hgeometry/src/HGeometry/PlaneGraph/Type.hs b/hgeometry/src/HGeometry/PlaneGraph/Type.hs index 15a5ed9ba..52d8942e7 100644 --- a/hgeometry/src/HGeometry/PlaneGraph/Type.hs +++ b/hgeometry/src/HGeometry/PlaneGraph/Type.hs @@ -87,9 +87,9 @@ instance HasFaces (PlaneGraph s v e f) (PlaneGraph s v e f') where faces = _PlanarGraph.faces ---------------------------------------- -instance DirGraph_ (PlaneGraph s v e f) where - type DirGraphFromAdjListExtraConstraints (PlaneGraph s v e f) h = (f ~ (), Foldable1 h) - dirGraphFromAdjacencyLists = PlaneGraph . dirGraphFromAdjacencyLists +instance DiGraph_ (PlaneGraph s v e f) where + type DiGraphFromAdjListExtraConstraints (PlaneGraph s v e f) h = (f ~ (), Foldable1 h) + diGraphFromAdjacencyLists = PlaneGraph . diGraphFromAdjacencyLists endPoints (PlaneGraph g) = endPoints g twinDartOf d = twinOf d . to Just outgoingDartsOf v = _PlanarGraph.outgoingDartsOf v @@ -109,17 +109,16 @@ instance Graph_ (PlaneGraph s v e f) where instance PlanarGraph_ (PlaneGraph s v e f) where type DualGraphOf (PlaneGraph s v e f) = PlanarGraph s Dual f e v - dualGraph = dualGraph . coerce @_ @(PlanarGraph s Primal v e f) - leftFace d = leftFace d . coerce @_ @(PlanarGraph s Primal v e f) - rightFace d = rightFace d . coerce @_ @(PlanarGraph s Primal v e f) + leftFaceOf d = _PlanarGraph.leftFaceOf d + rightFaceOf d = _PlanarGraph.rightFaceOf d - nextEdge d = nextEdge d . coerce @_ @(PlanarGraph s Primal v e f) - prevEdge d = prevEdge d . coerce @_ @(PlanarGraph s Primal v e f) + nextDartOf d = _PlanarGraph.nextDartOf d + prevDartOf d = _PlanarGraph.prevDartOf d - boundaryDart f = boundaryDart f . coerce @_ @(PlanarGraph s Primal v e f) - boundary f = boundary f . coerce @_ @(PlanarGraph s Primal v e f) + boundaryDartOf f = _PlanarGraph.boundaryDartOf f + boundaryDarts f = boundaryDarts f . coerce @_ @(PlanarGraph s Primal v e f) instance ( Point_ v 2 (NumType v)