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

Maintainerdiagrams-discuss@googlegroups.com

Diagrams.TwoD.Ellipse

Contents

Description

Two-dimensional ellipses (and, as a special case, circles).

Synopsis

Ellipse and circle diagrams

unitCircle :: (Backend b R2, Renderable Ellipse b) => Diagram b R2Source

A circle of radius 1, with center at the origin.

circle :: (Backend b R2, Renderable Ellipse b) => Double -> Diagram b R2Source

A circle of the given radius, centered at the origin.

ellipse :: (Backend b R2, Renderable Ellipse b) => Double -> Diagram b R2Source

ellipse e constructs an ellipse with eccentricity e by scaling the unit circle in the X direction. The eccentricity must be within the interval [0,1).

ellipseXY :: (Backend b R2, Renderable Ellipse b) => Double -> Double -> Diagram b R2Source

ellipseXY x y creates an axis-aligned ellipse, centered at the origin, with radius x along the x-axis and radius y along the y-axis.

Mathematical ellipses

Representation

data Ellipse Source

An ellipse is represented by an affine transformation acting on the unit circle.

Constructors

Ellipse T2 

Extracting attributes

ellipseCenter :: Ellipse -> P2Source

Compute the center of an ellipse.

ellipseAngle :: Ellipse -> RadSource

Compute the angle to the major axis of an ellipse, measured counterclockwise from the positive x axis in radians. The result will be in the range [0, tau/2).

ellipseAxes :: Ellipse -> (R2, R2)Source

Compute the vectors (va, vb) from the center of the ellipse to the edge of the ellipse along the major and minor axes. These vectors can lie in any quadrant, depending on how the ellipse has been transformed.

ellipseScale :: Ellipse -> (Double, Double)Source

Compute the scaling factors of an ellipse, i.e. (a,b) where a and b are half the lengths of the major and minor axes respectively.

ellipseCoeffs :: Ellipse -> (Double, Double, Double, Double, Double, Double)Source

Compute the coefficients of the quadratic form

A x^2 + B x y + C y^2 + D x + E y + F = 0

for an ellipse. Returns A through F (in that order) as a tuple.