Skip to content

Commit

Permalink
make it compile
Browse files Browse the repository at this point in the history
  • Loading branch information
noinia committed Dec 22, 2024
1 parent 7b16cec commit b3ad2c0
Showing 1 changed file with 1 addition and 20 deletions.
21 changes: 1 addition & 20 deletions hgeometry/src/HGeometry/PlaneGraph/Type.hs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ import qualified Hiraffe.PlanarGraph.Dart as Dart

-- | An Embedded, *connected*, planar graph
newtype PlaneGraph s v e f = PlaneGraph (PlanarGraph Primal s v e f)
deriving stock (Show,Eq,Generic)
-- deriving stock (Show,Eq,Generic)
-- deriving newtype (ToYAML,FromYAML)

type instance NumType (PlaneGraph s v e f) = NumType v
Expand Down Expand Up @@ -127,25 +127,6 @@ instance BidirGraph_ (PlaneGraph s v e f) where
twinOf d = to $ const (PG.twin d)
getPositiveDart (PlaneGraph g) e = getPositiveDart g e


-- | Computes the cyclic order of adjacencies around each vertex.
--
-- \(O(n \log n)\)
toEmbedding :: ( Foldable1 g, Functor g, Foldable h, Functor h
, vi ~ VertexIx (PlaneGraph s v e f)
, v ~ Vertex (PlaneGraph s v e f)
, e ~ Edge (PlaneGraph s v e f)
, GraphFromAdjListExtraConstraints (PlaneGraph s v e f) h
, Point_ v 2 r, Ord r, Num r
) => g (vi, v, h (vi, e)) -> g (vi, v, Vector.NonEmptyVector (vi, e))
toEmbedding vs = fmap sortAround' vs
where
vertexLocs = foldMap (\(vi,v,_) -> Map.singleton vi v) vs
sortAround' (vi,v,adjs) = (vi,v, Vector.unsafeFromVector $ sortBy (ccwCmpAround' v) adjs)
ccwCmpAround' v (ui,_) (wi,_) = ccwCmpAround v (vertexLocs Map.! ui) (vertexLocs Map.! wi)



instance ( Point_ v 2 (NumType v)
, Ord (NumType v), Num (NumType v)
) => Graph_ (PlaneGraph s v e f) where
Expand Down

0 comments on commit b3ad2c0

Please sign in to comment.