- type Points = Array Int (Float, Float)
- type TriangulationFunction = Points -> [Int] -> [(Int, Int, Int)]
- data Tree = Node Int Int [Tree]
- type F2 = (Float, Float)
- triangulate :: TriangulationFunction -> Geometry -> Geometry
- deleteHoles :: Geometry -> Geometry
- embed :: Points -> [[Int]] -> [Int] -> [Int]
- alternate :: Int -> Bool -> [Int] -> [Int]
- generateTrees :: Points -> (Points -> [Int] -> [Int] -> Bool) -> [[Int]] -> [Tree]
- treesList :: Points -> [[Int]] -> [Tree] -> [Tree]
- insertTrees :: Points -> [Int] -> [Tree] -> [Tree]
- insertTree :: Points -> [Int] -> Tree -> (Bool, Tree)
- rotatePoly :: Int -> Points -> [Int] -> (Int, Float)
- nearest :: F2 -> [F2] -> Float -> Int -> Int -> (Int, Float)
- insidePoly :: Points -> [Int] -> [Int] -> Bool
- pointInside :: F2 -> [F2] -> Bool
- polygonDirection :: [F2] -> Bool
- isLeftTurn :: F2 -> F2 -> F2 -> 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 :: Points -> [[Int]] -> [Int] -> [Int]Source
cut a polygon at a good position and insert the contained hole-polygon with opposite direction
alternate :: Int -> Bool -> [Int] -> [Int]Source
make sure that direction (clockwise or ccw) of polygons alternates depending on the nesting number c of poly
generateTrees :: Points -> (Points -> [Int] -> [Int] -> Bool) -> [[Int]] -> [Tree]Source
f should be the funtion to test contains the trees then are the hierarchy of containedness of outlines
rotatePoly :: Int -> Points -> [Int] -> (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 :: Points -> [Int] -> [Int] -> BoolSource
returns True iff the first point of the first polygon is inside the second poylgon
pointInside :: F2 -> [F2] -> BoolSource
A point is inside a polygon if it has an odd number of intersections with the boundary (Jordan Curve theorem)
polygonDirection :: [F2] -> BoolSource
the direction of a polygon can be obtained by looking at a maximal point returns True if counterclockwise False if clockwise