Safe Haskell | None |
---|---|
Language | Haskell2010 |
This module help the walking of path of any shape, being able to return the current position and the actual orientation.
- data PathWalkerT m a
- type PathWalker a = PathWalkerT Identity a
- type PathDrawer m px = Transformation -> PlaneBound -> DrawOrder px -> m ()
- runPathWalking :: Monad m => Path -> PathWalkerT m a -> m a
- advanceBy :: Monad m => Float -> PathWalkerT m ()
- currentPosition :: Monad m => PathWalkerT m (Maybe Point)
- currentTangeant :: Monad m => PathWalkerT m (Maybe Vector)
- drawOrdersOnPath :: Monad m => PathDrawer m px -> Float -> Float -> Path -> [DrawOrder px] -> m ()
Documentation
data PathWalkerT m a Source
The walking transformer monad.
MonadTrans PathWalkerT | |
Monad m => Monad (PathWalkerT m) | |
Functor m => Functor (PathWalkerT m) | |
(Monad m, Functor m) => Applicative (PathWalkerT m) |
type PathWalker a = PathWalkerT Identity a Source
Simpler alias if monad transformers are not needed.
type PathDrawer m px = Transformation -> PlaneBound -> DrawOrder px -> m () Source
Callback function in charge to transform the DrawOrder given the transformation to place it on the path.
runPathWalking :: Monad m => Path -> PathWalkerT m a -> m a Source
Create a path walker from a given path
advanceBy :: Monad m => Float -> PathWalkerT m () Source
Advance by the given amount of pixels on the path.
currentPosition :: Monad m => PathWalkerT m (Maybe Point) Source
Obtain the current position if we are still on the path, if not, return Nothing.
currentTangeant :: Monad m => PathWalkerT m (Maybe Vector) Source
Obtain the current tangeant of the path if we're still on it. Return Nothing otherwise.
:: Monad m | |
=> PathDrawer m px | Function handling the placement of the order. |
-> Float | Starting offset |
-> Float | Baseline vertical position in the orders. |
-> Path | Path on which to place the orders. |
-> [DrawOrder px] | Orders to place on a path. |
-> m () |
This function is the workhorse of the placement, it will walk the path and calculate the appropriate transformation for every order.