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.
Synopsis
- 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.
Instances
MonadTrans PathWalkerT Source # | |
Defined in Graphics.Rasterific.PathWalker lift :: Monad m => m a -> PathWalkerT m a # | |
Monad m => Monad (PathWalkerT m) Source # | |
Defined in Graphics.Rasterific.PathWalker (>>=) :: PathWalkerT m a -> (a -> PathWalkerT m b) -> PathWalkerT m b # (>>) :: PathWalkerT m a -> PathWalkerT m b -> PathWalkerT m b # return :: a -> PathWalkerT m a # fail :: String -> PathWalkerT m a # | |
Functor m => Functor (PathWalkerT m) Source # | |
Defined in Graphics.Rasterific.PathWalker fmap :: (a -> b) -> PathWalkerT m a -> PathWalkerT m b # (<$) :: a -> PathWalkerT m b -> PathWalkerT m a # | |
Monad m => Applicative (PathWalkerT m) Source # | |
Defined in Graphics.Rasterific.PathWalker pure :: a -> PathWalkerT m a # (<*>) :: PathWalkerT m (a -> b) -> PathWalkerT m a -> PathWalkerT m b # liftA2 :: (a -> b -> c) -> PathWalkerT m a -> PathWalkerT m b -> PathWalkerT m c # (*>) :: PathWalkerT m a -> PathWalkerT m b -> PathWalkerT m b # (<*) :: PathWalkerT m a -> PathWalkerT m b -> PathWalkerT m a # |
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.