cnc-pattern-lib-0.1.0.0: Haskell library for creating SVG patterns for CNC routers

Safe HaskellNone
LanguageHaskell2010

Shape

Description

Typeclasses for shapes

Synopsis

Documentation

class SvgShape s Source #

Typeclass for shapes that can be converted to SVG elements

Minimal complete definition

toSvg

Instances
SvgShape Line Source # 
Instance details

Defined in Line

Methods

toSvg :: Line -> Svg Source #

SvgShape Rectangle Source # 
Instance details

Defined in Rectangle

Methods

toSvg :: Rectangle -> Svg Source #

SvgShape Hexagon Source # 
Instance details

Defined in Hexagon

Methods

toSvg :: Hexagon -> Svg Source #

SvgShape Circle Source # 
Instance details

Defined in Circle

Methods

toSvg :: Circle -> Svg Source #

SvgShape Arc Source # 
Instance details

Defined in Arc

Methods

toSvg :: Arc -> Svg Source #

SvgShape Layer Source # 
Instance details

Defined in Layer

Methods

toSvg :: Layer -> Svg Source #

SvgShape ShapeLike Source # 
Instance details

Defined in Layer

Methods

toSvg :: ShapeLike -> Svg Source #

SvgShape Scene Source # 
Instance details

Defined in Scene

Methods

toSvg :: Scene -> Svg Source #

SvgShape [ShapeLike] Source # 
Instance details

Defined in Layer

Methods

toSvg :: [ShapeLike] -> Svg Source #

toSvg :: SvgShape s => s -> Svg Source #

Convert a shape to a blaze-svg element.

class Transformable s Source #

Typeclass for shapes that have transformation operations in cartesian space

Minimal complete definition

translate, rotate, mirror, offset

Instances
Transformable Line Source # 
Instance details

Defined in Line

Transformable Rectangle Source # 
Instance details

Defined in Rectangle

Transformable Hexagon Source # 
Instance details

Defined in Hexagon

Transformable Circle Source # 
Instance details

Defined in Circle

Transformable Arc Source # 
Instance details

Defined in Arc

Transformable ShapeLike Source # 
Instance details

Defined in Layer

Transformable a => Transformable (Group a) Source #

Groups can be transformed in the same way single shapes can.

Instance details

Defined in Group

Methods

translate :: Point -> Group a -> Group a Source #

translatePoints :: [Point] -> Group a -> [Group a] Source #

rotate :: Point -> Float -> Group a -> Group a Source #

mirror :: Point -> Point -> Group a -> Group a Source #

offset :: Point -> Bool -> Group a -> Group a Source #

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

offset :: Transformable s => Point -> Bool -> s -> s Source #

class Mergable s Source #

Minimal complete definition

merge

Instances
Mergable Line Source # 
Instance details

Defined in Line

Methods

merge :: Line -> Line -> Float -> Maybe Line Source #

optimize :: [Line] -> Float -> [Line] Source #

Mergable Rectangle Source # 
Instance details

Defined in Rectangle

Mergable Hexagon Source # 
Instance details

Defined in Hexagon

Mergable Circle Source # 
Instance details

Defined in Circle

Mergable Arc Source # 
Instance details

Defined in Arc

Methods

merge :: Arc -> Arc -> Float -> Maybe Arc Source #

optimize :: [Arc] -> Float -> [Arc] Source #

merge :: Mergable s => s -> s -> Float -> Maybe s Source #

If two shapes can be merged into one, returen the merged shape Makes the most sense for lines and arcs.

optimize :: Mergable s => [s] -> Float -> [s] Source #

Merge all shapes in a given list that can be merged