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

Safe HaskellNone
LanguageHaskell2010

Group

Description

A module for creating collections of homogenous shape types, optimizing shapes (combining paths when possible or removing duplicates), applying transformations to all of them, and rendering them as SVG elements.

Synopsis

Documentation

newtype Group shape Source #

A type reprresenting a named group of some type of shape.

Constructors

Group [shape] 
Instances
Functor Group Source #

A group can be mapped over just like any other container.

Instance details

Defined in Group

Methods

fmap :: (a -> b) -> Group a -> Group b #

(<$) :: a -> Group b -> Group a #

Applicative Group Source # 
Instance details

Defined in Group

Methods

pure :: a -> Group a #

(<*>) :: Group (a -> b) -> Group a -> Group b #

liftA2 :: (a -> b -> c) -> Group a -> Group b -> Group c #

(*>) :: Group a -> Group b -> Group b #

(<*) :: Group a -> Group b -> Group a #

Show a => Show (Group a) Source # 
Instance details

Defined in Group

Methods

showsPrec :: Int -> Group a -> ShowS #

show :: Group a -> String #

showList :: [Group a] -> ShowS #

(Show a, SvgShape a, Transformable a, Mergable a) => Semigroup (Group a) Source #

Groups can be combined.

Instance details

Defined in Group

Methods

(<>) :: Group a -> Group a -> Group a #

sconcat :: NonEmpty (Group a) -> Group a #

stimes :: Integral b => b -> Group a -> Group a #

(Show a, SvgShape a, Transformable a, Mergable a) => Monoid (Group a) Source #

There exists an identity element for any group.

Instance details

Defined in Group

Methods

mempty :: Group a #

mappend :: Group a -> Group a -> Group a #

mconcat :: [Group a] -> Group a #

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 #

toLayer :: (Show a, SvgShape a, Transformable a) => String -> Group a -> Layer Source #

Convert a group to a layer.

toList :: (Show a, SvgShape a, Transformable a) => Group a -> [a] Source #

Convert a group to a list of shapes.

size :: Group a -> Int Source #

Number of shapes in the group.

translateOverPoints :: Transformable s => [Point] -> s -> Group s Source #

Clone a shape over a series of points, returning a group of the translated objects.

translateGroupOverPoints :: (Show a, SvgShape a, Transformable a, Mergable a) => [Point] -> Group a -> Group a Source #

Clone a shape over a series of points, returning a group of the translated objects.

deduplicate :: (Ord t, ApproxEq t) => Group t -> Group t Source #

Remove any duplicate shapes from this group

transformAndAppend :: (Show a, SvgShape a, Transformable a, Mergable a) => (a -> a) -> Group a -> Group a Source #

optimizeGroup :: Mergable a => Group a -> Float -> Group a Source #

Produce a new group where all shapes that can be merged have been, plus all shapes that couldn't be.

optimizeGroupAndLog :: Mergable a => Group a -> Float -> IO (Group a) Source #

Produce a new group where all shapes that can be merged have been, plus all shapes that couldn't be, logging the result at the end.

toSvgN :: SvgShape s => Group s -> Svg Source #

Wrap a group of shapes into an SVG g element, including a comment with the name of the group.

toSvgWithStyle :: SvgShape s => Group s -> StyleAttrs -> Svg Source #

Wrap a group of shapes into an SVG g element, including a comment with the name of the group. Apply the given styles to the group.