Safe Haskell | None |
---|---|

Language | Haskell2010 |

Typeclasses for shapes

## Synopsis

- class SvgShape s
- toSvg :: SvgShape s => s -> Svg
- class Transformable s
- translate :: Transformable s => Point -> s -> s
- translatePoints :: Transformable s => [Point] -> s -> [s]
- rotate :: Transformable s => Point -> Float -> s -> s
- mirror :: Transformable s => Point -> Point -> s -> s
- offset :: Transformable s => Point -> Bool -> s -> s
- class Mergable s
- merge :: Mergable s => s -> s -> Float -> Maybe s
- optimize :: Mergable s => [s] -> Float -> [s]

# Documentation

Typeclass for shapes that can be converted to SVG elements

class Transformable s Source #

Typeclass for shapes that have transformation operations in cartesian space

## Instances

Transformable Line Source # | |

Transformable Rectangle Source # | |

Defined in Rectangle | |

Transformable Hexagon Source # | |

Transformable Circle Source # | |

Transformable Arc Source # | |

Transformable ShapeLike Source # | |

Defined in Layer | |

Transformable a => Transformable (Group a) Source # | Groups can be transformed in the same way single shapes can. |

translate :: Transformable s => Point -> s -> s Source #

Move a shape in space adding the given point to the X and Y axes.

translatePoints :: Transformable s => [Point] -> s -> [s] Source #

Duplicate a shape in spcae across a list of points.

rotate :: Transformable s => Point -> Float -> s -> s Source #

Rotate a shape about a line through point p by t radians

mirror :: Transformable s => Point -> Point -> s -> s Source #

Mirror a shape about a line through point p along vector v