Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Module for geometrical shapes.
Synopsis
- regularPolygon :: Int -> Float -> (Float, Float) -> Svg
- starPolygonFirstSpecies :: Int -> Float -> (Float, Float) -> Svg
- starOutline :: Int -> Float -> Float -> (Float, Float) -> Svg
- starFat :: Int -> Float -> (Float, Float) -> Svg
- starRegular :: Int -> Float -> (Float, Float) -> Svg
- asterisk :: Int -> Float -> (Float, Float) -> Svg
- asteriskStar :: Int -> Float -> (Float, Float) -> Svg
Documentation
:: Int | number of vertices |
-> Float | circumradius |
-> (Float, Float) | coordinates of the central point |
-> Svg | resulting svg path |
regularPolygon
builds a regular polygon.
You can customize fill and stroke using the usual blaze-svg functions. For example:
regularPolygon 5 100 (200,300) ! A.fill "pink" ! A.stroke "#0000FF" ! A.strokeWidth "10"
will return a path element corresponding to a regular pentagon of radius 100 centered at point (200,300) filled in pink, green stroke and stroke width 10.
starPolygonFirstSpecies Source #
:: Int | number of vertices |
-> Float | circumradius |
-> (Float, Float) | coordinates of the central point |
-> Svg | resulting svg path |
starPolygonFirstSpecies
builds a first species regular star polygon.
First species means that one vertice is skipped when joining vertices. The number of vertices must be strictly greater than 4. Can be customized with the usual blaze-svg functions.
Returns a path
:: Int | number of vertices |
-> Float | circumradius |
-> Float | inner radius (circumradius of the inner polygon) |
-> (Float, Float) | coordinates of the central point |
-> Svg | resulting path |
starOutline
builds a first species irregular star polygon.
The difference with the previous function is the stroke: the previous function's stroke runs inside the figure (so it would draw a pentagram), while this function's stroke runs outside the shape (so it would draw a star). There is no visual difference if you only fill the paths (with no stroke).
Returns a path
starFat :: Int -> Float -> (Float, Float) -> Svg Source #
starFat
builds a first species irregular star polygon.
Works as starOutline
but you don't need to specify
the inner radius, it is already coded so that you get a
"fat" star.
starRegular :: Int -> Float -> (Float, Float) -> Svg Source #
starRegular
builds a first species regular star polygon.
Works as starOutline
but you don't need to specify
the inner radius, and you will get a regular star.
:: Int | half the number of vertices |
-> Float | circumradius |
-> (Float, Float) | coordinates of the central point |
-> Svg | resulting svg path |
asterisk
builds a regular asterisk.
Once again, it's a regular polygon but the stroke only joins opposite vertices. To ensure that an asterisk is built, the Int parameter gets multiplied by 2.
:: Int | half the number of vertices |
-> Float | circumradius |
-> (Float, Float) | coordinates of the central point |
-> Svg | resulting svg path |
asteriskStar
builds a regular asterisk star.
It's a regular star but the stroke only joins opposite vertices. To ensure that an asterisk is built, the Int parameter gets multiplied by 2.