Copyright | Written by David Himmelstrup |
---|---|
License | Unlicense |
Maintainer | lemmih@gmail.com |
Stability | experimental |
Portability | POSIX |
Safe Haskell | None |
Language | Haskell2010 |
A PolyShape is a closed set of curves.
Synopsis
- newtype PolyShape = PolyShape {}
- data PolyShapeWithHoles
- svgToPolyShapes :: Tree -> [PolyShape]
- svgToPolygons :: Double -> SVG -> [Polygon]
- renderPolyShape :: PolyShape -> Tree
- renderPolyShapes :: [PolyShape] -> Tree
- renderPolyShapePoints :: PolyShape -> Tree
- plPathCommands :: PolyShape -> [PathCommand]
- plLineCommands :: PolyShape -> [LineCommand]
- plLength :: PolyShape -> Double
- plArea :: PolyShape -> Double
- plCurves :: PolyShape -> [CubicBezier Double]
- isInsideOf :: PolyShape -> PolyShape -> Bool
- plFromPolygon :: [RPoint] -> PolyShape
- plToPolygon :: Double -> PolyShape -> Polygon
- plDecompose :: [PolyShape] -> [[RPoint]]
- unionPolyShapes :: [PolyShape] -> [PolyShape]
- unionPolyShapes' :: Double -> [PolyShape] -> [PolyShape]
- plDecompose' :: Double -> [PolyShape] -> [[RPoint]]
- decomposePolygon :: [RPoint] -> [[RPoint]]
- plGroupShapes :: [PolyShape] -> [PolyShapeWithHoles]
- mergePolyShapeHoles :: PolyShapeWithHoles -> PolyShape
- plPartial :: Double -> PolyShape -> PolyShape
- plGroupTouching :: [PolyShape] -> [[([RPoint], PolyShape)]]
Documentation
Shape drawn by continuous line. May have overlap, may be convex.
data PolyShapeWithHoles Source #
Polyshape with smaller, fully-enclosed holes.
svgToPolyShapes :: Tree -> [PolyShape] Source #
Extract all shapes from SVG nodes. Drawing attributes such as stroke and fill color are discarded.
svgToPolygons :: Double -> SVG -> [Polygon] Source #
Extract all polygons from SVG nodes. Curves are approximated to within the given tolerance.
renderPolyShape :: PolyShape -> Tree Source #
Render a polyshape as a single SVG path.
renderPolyShapes :: [PolyShape] -> Tree Source #
Render a set of polyshapes as a single SVG path.
renderPolyShapePoints :: PolyShape -> Tree Source #
Render control-points of a polyshape as circles.
plPathCommands :: PolyShape -> [PathCommand] Source #
Convert a polyshape to a list of SVG path commands.
plLineCommands :: PolyShape -> [LineCommand] Source #
Convert a polyshape to a list of line commands.
isInsideOf :: PolyShape -> PolyShape -> Bool Source #
True iff lhs is inside of rhs. lhs and rhs may not overlap. Implementation: Trace a vertical line through the origin of A and check of this line intersects and odd number of times on both sides of A.
plFromPolygon :: [RPoint] -> PolyShape Source #
Construct a polyshape from the vertices in a polygon.
plToPolygon :: Double -> PolyShape -> Polygon Source #
Approximate a polyshape as a polygon within the given tolerance.
plDecompose :: [PolyShape] -> [[RPoint]] Source #
Deconstruct a polyshape into non-intersecting, convex polygons.
unionPolyShapes :: [PolyShape] -> [PolyShape] Source #
Merge overlapping shapes.
unionPolyShapes' :: Double -> [PolyShape] -> [PolyShape] Source #
Merge overlapping shapes to within given tolerance.
plDecompose' :: Double -> [PolyShape] -> [[RPoint]] Source #
Deconstruct a polyshape into non-intersecting, convex polygons.
decomposePolygon :: [RPoint] -> [[RPoint]] Source #
Split polygon into smaller, convex polygons.
plGroupShapes :: [PolyShape] -> [PolyShapeWithHoles] Source #
Find holes and group them with their parent.
mergePolyShapeHoles :: PolyShapeWithHoles -> PolyShape Source #
Cut out holes.