reanimate-1.1.4.0: Animation library based on SVGs.
CopyrightWritten by David Himmelstrup
LicenseUnlicense
Maintainerlemmih@gmail.com
Stabilityexperimental
PortabilityPOSIX
Safe HaskellNone
LanguageHaskell2010

Reanimate.PolyShape

Description

A PolyShape is a closed set of curves.

Synopsis

Documentation

newtype PolyShape Source #

Shape drawn by continuous line. May have overlap, may be convex.

Constructors

PolyShape 

Instances

Instances details
Eq PolyShape Source # 
Instance details

Defined in Reanimate.PolyShape

Show PolyShape Source # 
Instance details

Defined in Reanimate.PolyShape

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.

plLength :: PolyShape -> Double Source #

Length of polyshape circumference.

plArea :: PolyShape -> Double Source #

Area of polyshape.

plCurves :: PolyShape -> [CubicBezier Double] Source #

Destruct a polyshape into constituent curves.

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.

plPartial :: Double -> PolyShape -> PolyShape Source #

Partially draw polyshape.

plGroupTouching :: [PolyShape] -> [[([RPoint], PolyShape)]] Source #

Find intersection points.