Copyright | (C) Frank Staals |
---|---|
License | see the LICENSE file |
Maintainer | Frank Staals |
Safe Haskell | None |
Language | Haskell2010 |
Data type for representing an Arrangement of lines in \(\mathbb{R}^2\).
Synopsis
- data Arrangement s l v e f r = Arrangement {
- _inputLines :: Vector (Line 2 r :+ l)
- _subdivision :: PlanarSubdivision s v e f r
- _boundedArea :: Rectangle () r
- _unboundedIntersections :: ArrangementBoundary s l r
- inputLines :: forall s l v e f r. Lens' (Arrangement s l v e f r) (Vector ((:+) (Line 2 r) l))
- subdivision :: forall s l v e f r v e f. Lens (Arrangement s l v e f r) (Arrangement s l v e f r) (PlanarSubdivision s v e f r) (PlanarSubdivision s v e f r)
- boundedArea :: forall s l v e f r. Lens' (Arrangement s l v e f r) (Rectangle () r)
- unboundedIntersections :: forall s l v e f r. Lens' (Arrangement s l v e f r) (ArrangementBoundary s l r)
- type ArrangementBoundary s e r = Vector (Point 2 r, VertexId' s, Maybe (Line 2 r :+ e))
- constructArrangement :: (Ord r, Fractional r) => proxy s -> [Line 2 r :+ l] -> Arrangement s l () (Maybe l) () r
- constructArrangementInBox :: (Ord r, Fractional r) => proxy s -> Rectangle () r -> [Line 2 r :+ l] -> Arrangement s l () (Maybe l) () r
- constructArrangementInBox' :: (Ord r, Fractional r) => proxy s -> Rectangle () r -> [Line 2 r :+ l] -> Arrangement s l () (Maybe l) () r
- traverseLine :: (Ord r, Fractional r) => Line 2 r -> Arrangement s l v (Maybe e) f r -> [Dart s]
- findStart :: (Ord r, Fractional r) => Line 2 r -> Arrangement s l v (Maybe e) f r -> Maybe (Dart s)
- findStartVertex :: (Ord r, Fractional r) => Point 2 r -> Arrangement s l v e f r -> Maybe (Point 2 r, VertexId' s, Maybe (Line 2 r :+ l))
- findStartDart :: PlanarSubdivision s v (Maybe e) f r -> VertexId' s -> Maybe (Dart s)
- follow :: (Ord r, Num r) => Arrangement s l v e f r -> Dart s -> Maybe (Dart s)
Documentation
data Arrangement s l v e f r Source #
Data type representing a two dimensional planar arrangement
Arrangement | |
|
Instances
(Fractional r, Eq r, Eq l, Eq v, Eq e, Eq f) => Eq (Arrangement s l v e f r) Source # | |
Defined in Data.Geometry.Arrangement.Internal (==) :: Arrangement s l v e f r -> Arrangement s l v e f r -> Bool # (/=) :: Arrangement s l v e f r -> Arrangement s l v e f r -> Bool # | |
(Show r, Show l, Show v, Show e, Show f) => Show (Arrangement s l v e f r) Source # | |
Defined in Data.Geometry.Arrangement.Internal showsPrec :: Int -> Arrangement s l v e f r -> ShowS # show :: Arrangement s l v e f r -> String # showList :: [Arrangement s l v e f r] -> ShowS # | |
type NumType (Arrangement s l v e f r) Source # | |
Defined in Data.Geometry.Arrangement.Internal | |
type Dimension (Arrangement s l v e f r) Source # | |
Defined in Data.Geometry.Arrangement.Internal |
inputLines :: forall s l v e f r. Lens' (Arrangement s l v e f r) (Vector ((:+) (Line 2 r) l)) Source #
subdivision :: forall s l v e f r v e f. Lens (Arrangement s l v e f r) (Arrangement s l v e f r) (PlanarSubdivision s v e f r) (PlanarSubdivision s v e f r) Source #
boundedArea :: forall s l v e f r. Lens' (Arrangement s l v e f r) (Rectangle () r) Source #
unboundedIntersections :: forall s l v e f r. Lens' (Arrangement s l v e f r) (ArrangementBoundary s l r) Source #
constructArrangement :: (Ord r, Fractional r) => proxy s -> [Line 2 r :+ l] -> Arrangement s l () (Maybe l) () r Source #
Builds an arrangement of \(n\) lines
running time: \(O(n^2\log n\)
constructArrangementInBox :: (Ord r, Fractional r) => proxy s -> Rectangle () r -> [Line 2 r :+ l] -> Arrangement s l () (Maybe l) () r Source #
Constructs the arrangemnet inside the box. note that the resulting box may be larger than the given box to make sure that all vertices of the arrangement actually fit.
running time: \(O(n^2\log n\)
constructArrangementInBox' :: (Ord r, Fractional r) => proxy s -> Rectangle () r -> [Line 2 r :+ l] -> Arrangement s l () (Maybe l) () r Source #
Constructs the arrangemnet inside the box. (for parts to be useful, it is assumed this boxfits at least the boundingbox of the intersections in the Arrangement)
traverseLine :: (Ord r, Fractional r) => Line 2 r -> Arrangement s l v (Maybe e) f r -> [Dart s] Source #
Given an Arrangement and a line in the arrangement, follow the line through he arrangement.
findStart :: (Ord r, Fractional r) => Line 2 r -> Arrangement s l v (Maybe e) f r -> Maybe (Dart s) Source #
Find the starting point of the line the arrangement
findStartVertex :: (Ord r, Fractional r) => Point 2 r -> Arrangement s l v e f r -> Maybe (Point 2 r, VertexId' s, Maybe (Line 2 r :+ l)) Source #
Given a point on the boundary of the boundedArea box; find the vertex this point corresponds to.
running time: \(O(\log n)\)
basically; maps every point to a tuple of the point and the side the point occurs on. We then binary search to find the point we are looking for.
findStartDart :: PlanarSubdivision s v (Maybe e) f r -> VertexId' s -> Maybe (Dart s) Source #
Find the starting dart of the given vertex v. Reports a dart s.t. tailOf d = v
running me: \(O(k)\) where \(k\) is the degree of the vertex
follow :: (Ord r, Num r) => Arrangement s l v e f r -> Dart s -> Maybe (Dart s) Source #
Given a dart d that incoming to v (headOf d == v), find the outgoing dart colinear with the incoming one. Again reports dart d' s.t. tailOf d' = v
running time: \(O(k)\), where k is the degree of the vertex d points to