Portability | GHC |
---|---|
Stability | highly unstable |
Maintainer | Stephen Tetley <stephen.tetley@gmail.com> |
Path algorithms for elementary shapes - rectangle, diamond, polygon.
- data PathAlg u
- runPathAlgPoint :: Num u => Point2 u -> PathAlg u -> [Point2 u]
- runPathAlgVec :: PathAlg u -> (Maybe (Vec2 u), [Vec2 u])
- drawVertexPathAlg :: InterpretUnit u => DrawStyle -> PathAlg u -> LocGraphic u
- pathStartIsStart :: [Vec2 u] -> PathAlg u
- pathStartIsLocus :: [Vec2 u] -> PathAlg u
- pathIterateLocus :: Num u => [Vec2 u] -> PathAlg u
- rectanglePathAlg :: Fractional u => u -> u -> PathAlg u
- blRectanglePathAlg :: Num u => u -> u -> PathAlg u
- diamondPathAlg :: Num u => u -> u -> PathAlg u
- isoscelesTriPathAlg :: Floating u => u -> u -> PathAlg u
- polygonPathAlg :: Floating u => Int -> u -> PathAlg u
- arcPathAlg :: Floating u => u -> Radian -> Radian -> PathAlg u
- circlePathAlg :: (Fractional u, Floating u) => u -> PathAlg u
- parallelogramPathAlg :: Floating u => u -> u -> Radian -> PathAlg u
- isoscelesTrapeziumPathAlg :: Floating u => u -> u -> u -> PathAlg u
Documentation
A vector chain building a path.
The vectors are relative to the predecessor, so the
rendering of a PathAlg
iterates the start point.
A polygon PathAlg should have steps for all sides of the polygon with the end point generated by the last vector coinciding with thet start point.
drawVertexPathAlg :: InterpretUnit u => DrawStyle -> PathAlg u -> LocGraphic uSource
pathStartIsStart :: [Vec2 u] -> PathAlg uSource
Create a PathAlg from the vertex list.
When the PathAlg is run the supplied point will be the start of the path.
pathStartIsLocus :: [Vec2 u] -> PathAlg uSource
Create a PathAlg from the vector list - the first vector displaces the start point the subsequent vectors displace the current tip. Figuratively, this is rather like Logo turtle drawing.
When the PathAlg is run, the supplied point is the locus of the path and it does not form part of the path proper.
This constructor is typically used to make shape paths where the supplied point is the center and the generated path is the border.
pathIterateLocus :: Num u => [Vec2 u] -> PathAlg uSource
Note this creates a path where the first vector represents a
moveto
, then the subsequence vectors represent linetos
.
Create a PathAlg from the vector list - each vector in the input list iterates to the start point rather then the cumulative tip.
When the PathAlg is run, the supplied point is the locus of the path and it does not form part of the path proper.
Like pathStartIsLocus
, this constructor is typically used to
make shape paths. Some shapes are easier to express as
iterated displacements of the center rather than
turtle drawing.
rectanglePathAlg :: Fractional u => u -> u -> PathAlg uSource
Implicit start point is center, the genearated moves are counter-clockwise so the move-list is
[ moveto_bl, moveto_br, moveto_tr, moveto_tl ]
blRectanglePathAlg :: Num u => u -> u -> PathAlg uSource
Implicit start point is bottom-left, subsequent moves are counter-clockwise so the move-list is:
[ moveto_br, moveto_tr, moveto_tl, moveto_bl ]
diamondPathAlg :: Num u => u -> u -> PathAlg uSource
diamondPathAlg
: half_width * half_height -> PathAlg
isoscelesTriPathAlg :: Floating u => u -> u -> PathAlg uSource
isoscelesTriPathAlg
: base_width * height -> PathAlg
Start point is centtroid not incenter.
polygonPathAlg :: Floating u => Int -> u -> PathAlg uSource
polygonPathAlg
: num_points * radius -> PathAlg
arcPathAlg :: Floating u => u -> Radian -> Radian -> PathAlg uSource
arcPathAlg
: radius * angle1 * angle2 -> PathAlg
circlePathAlg :: (Fractional u, Floating u) => u -> PathAlg uSource
parallelogramPathAlg :: Floating u => u -> u -> Radian -> PathAlg uSource
width * height * bottom_left_angle
isoscelesTrapeziumPathAlg :: Floating u => u -> u -> u -> PathAlg uSource
base_width * top_width * height