- type TriangulationFunction = Vector V2 -> [(Int, Int, Int)]
- data Tree = Node Int Int [Tree]
- triangulate :: TriangulationFunction -> Geometry -> Geometry
- v2s :: Vector V3 -> Vector Int -> Vector V2
- gjpTri :: Vector V2 -> [(Int, Int, Int)]
- deleteHoles :: Geometry -> Geometry
- flatten :: Vector V2 -> [Tree] -> Vector (Vector Int) -> Vector (Vector Int)
- embed :: Vector V2 -> Vector (Vector Int) -> Vector Int -> Vector Int
- alternate :: Int -> Bool -> Vector Int -> Vector Int
- generateTrees :: Vector V3 -> (Vector V2 -> Vector V2 -> Bool) -> Vector (Vector Int) -> [Tree]
- treesList :: [[Int]] -> [Tree] -> [Tree]
- insertTrees :: [Int] -> [Tree] -> [Tree]
- insertTree :: [Int] -> Tree -> (Bool, Tree)
- rotatePoly :: V2 -> Vector V2 -> (Int, Float)
- nearest :: V2 -> Vector V2 -> Float -> Int -> Int -> (Int, Float)
- insidePoly :: Vector V2 -> Vector V2 -> Bool
- pointInside :: V2 -> Vector V2 -> Bool
- polygonDirection :: Vector V2 -> Bool
- maxim :: Vector V2 -> Int -> Int -> (Float, Float) -> Int
- isLeftTurn :: V2 -> V2 -> V2 -> Bool
Documentation
triangulate :: TriangulationFunction -> Geometry -> GeometrySource
since there are a lot of triangulation algorithms a triangulation function can be passed
deleteHoles :: Geometry -> GeometrySource
some triangulation algorithms on't support polygons with holes These polygons with (nested) holes have to be cut so that they consist of only one outline I.e. the chars a,b,d,e,g,o,p,q contain holes tat have to be deleted.
embed :: Vector V2 -> Vector (Vector Int) -> Vector Int -> Vector IntSource
cut a polygon at a good position and insert the contained hole-polygon with opposite direction
alternate :: Int -> Bool -> Vector Int -> Vector IntSource
make sure that direction (clockwise or ccw) of polygons alternates depending on the nesting number c of poly
generateTrees :: Vector V3 -> (Vector V2 -> Vector V2 -> Bool) -> Vector (Vector Int) -> [Tree]Source
f should be the funtion to test contains the trees then are the hierarchy of containedness of outlines
insertTrees :: [Int] -> [Tree] -> [Tree]Source
rotatePoly :: V2 -> Vector V2 -> (Int, Float)Source
how many positions to rotate a polygon until the start point is nearest to some other point call i.e. with nearest (3,4) [(0,0),(1,2), ... ] 0 0
insidePoly :: Vector V2 -> Vector V2 -> BoolSource
returns True iff the first point of the first polygon is inside the second poylgon
pointInside :: V2 -> Vector V2 -> BoolSource
A point is inside a polygon if it has an odd number of intersections with the boundary (Jordan Curve theorem)
polygonDirection :: Vector V2 -> BoolSource
the direction of a polygon can be obtained by looking at a maximal point returns True if counterclockwise False if clockwise