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

Diagrams.TwoD.Arc

Description

Two-dimensional arcs, approximated by cubic bezier curves.

Synopsis

# Documentation

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

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 -> p Source

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 @@ turn) (1/4 @@ turn) | r <- [0.5,-1,1.5] ]

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

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 -> p Source

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 @@ turn)
, wedge 1 (7/30 @@ turn) (11/30 @@ turn)
, wedge 1 (1/8 @@ turn) (7/8 @@ turn)
]
# fc blue

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

`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] ]
```annularWedgeEx = hcat' (with & sep .~ 0.50)