Copyright | (C) 1ndy |
---|---|
License | see the LICENSE file |
Maintainer | David Himmelstrup |
Safe Haskell | None |
Language | Haskell2010 |
A polygon is monotone in a certain direction if rays orthogonal to that direction intersects the polygon at most twice. See https://en.wikipedia.org/wiki/Monotone_polygon
Synopsis
- isMonotone :: (Fractional r, Ord r) => Vector 2 r -> SimplePolygon p r -> Bool
- randomMonotone :: (RandomGen g, Random r, Ord r, Num r) => Int -> Rand g (SimplePolygon () r)
- randomMonotoneDirected :: (RandomGen g, Random r, Ord r, Num r) => Int -> Vector 2 r -> Rand g (SimplePolygon () r)
- monotoneFrom :: (Ord r, Num r) => Vector 2 r -> [Point 2 r] -> SimplePolygon () r
- randomNonZeroVector :: (RandomGen g, Random r, Eq r, Num r) => Rand g (Vector 2 r)
Documentation
isMonotone :: (Fractional r, Ord r) => Vector 2 r -> SimplePolygon p r -> Bool Source #
\( O(n \log n) \) A polygon is monotone if a straight line in a given direction cannot have more than two intersections.
randomMonotone :: (RandomGen g, Random r, Ord r, Num r) => Int -> Rand g (SimplePolygon () r) Source #
\( O(n \log n) \) Generate a random N-sided polygon that is monotone in a random direction.
randomMonotoneDirected :: (RandomGen g, Random r, Ord r, Num r) => Int -> Vector 2 r -> Rand g (SimplePolygon () r) Source #
\( O(n \log n) \) Generate a random N-sided polygon that is monotone in the given direction.
monotoneFrom :: (Ord r, Num r) => Vector 2 r -> [Point 2 r] -> SimplePolygon () r Source #
\( O(n \log n) \) Assemble a given set of points in a polygon that is monotone in the given direction.