diagrams-lib-1.1.0.3: Embedded domain-specific language for declarative graphics

Maintainer diagrams-discuss@googlegroups.com None

Diagrams.TwoD.Arc

Description

Two-dimensional arcs, approximated by cubic bezier curves.

Synopsis

# Documentation

arc :: (TrailLike t, V t ~ R2) => Angle -> Angle -> tSource

Given a start angle `s` and an end angle `e`, `arc s e` is the path of a radius one arc counterclockwise between the two angles. The origin of the arc is its center.

arc' :: (TrailLike p, V p ~ R2) => Double -> Angle -> Angle -> pSource

Given a radus `r`, a start angle `s` and an end angle `e`, `arc' r s e` is the path of a radius `(abs r)` arc between the two angles. If a negative radius is given, the arc will be clockwise, otherwise it will be counterclockwise. The origin of the arc is its center. ``` arc'Ex = mconcat [ arc' r 0 (1/4 \@\@ turn) | r <- [0.5,-1,1.5] ]
# centerXY # pad 1.1
```

arcCW :: (TrailLike t, V t ~ R2) => Angle -> Angle -> tSource

Like `arc` but clockwise.

Given a start angle `s` and an end angle `e`, `arcT s e` is the `Trail` of a radius one arc counterclockwise between the two angles.

`bezierFromSweep s` constructs a series of `Cubic` segments that start in the positive y direction and sweep counter clockwise through the angle `s`. If `s` is negative, it will start in the negative y direction and sweep clockwise. When `s` is less than 0.0001 the empty list results. If the sweep is greater than tau radians then it is truncated to one full revolution.

wedge :: (TrailLike p, V p ~ R2) => Double -> Angle -> Angle -> pSource

Create a circular wedge of the given radius, beginning at the first angle and extending counterclockwise to the second. ``` wedgeEx = hcat' (with & sep .~ 0.5)
[ wedge 1 (0 \@\@ turn) (1/4)
, wedge 1 (7/30 \@\@ turn) (11/30)
, wedge 1 (1/8 \@\@ turn) (7/8)
]
# fc blue
# centerXY # pad 1.1
```

arcBetween :: (TrailLike t, V t ~ R2) => P2 -> P2 -> Double -> tSource

`arcBetween p q height` creates an arc beginning at `p` and ending at `q`, with its midpoint at a distance of `abs height` away from the straight line from `p` to `q`. A positive value of `height` results in an arc to the left of the line from `p` to `q`; a negative value yields one to the right. ``` arcBetweenEx = mconcat
[ arcBetween origin (p2 (2,1)) ht | ht <- [-0.2, -0.1 .. 0.2] ]
# centerXY # pad 1.1
```

annularWedge :: (TrailLike p, V p ~ R2) => Double -> Double -> Angle -> Angle -> pSource

Create an annular wedge of the given radii, beginning at the first angle and extending counterclockwise to the second. The radius of the outer circle is given first. ``` annularWedgeEx = hcat' (with & sep .~ 0.50)
[ annularWedge 1 0.5 (0 \@\@ turn) (1/4)
, annularWedge 1 0.3 (7/30 \@\@ turn) (11/30)
, annularWedge 1 0.7 (1/8 \@\@ turn) (7/8)
]
# fc blue
# centerXY # pad 1.1
```