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

Copyright(c) 2011 diagrams-lib team (see LICENSE)
LicenseBSD-style (see LICENSE)
Maintainerdiagrams-discuss@googlegroups.com
Safe HaskellNone
LanguageHaskell2010

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

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

Like arc but clockwise.

arcT :: Angle -> Angle -> Trail R2 Source

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 :: Angle -> [Segment Closed R2] Source

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)
  , 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 -> 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] ]
  # centerXY # pad 1.1

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

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