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

Maintainerdiagrams-discuss@googlegroups.com

Diagrams.TwoD.Util

Contents

Description

Utility functions for diagrams in two-dimensional Cartesian space.

Synopsis

General two-dimensional utilities

unitX :: R2Source

The unit vector in the positive X direction.

unitY :: R2Source

The unit vector in the positive Y direction.

unit_X :: R2Source

The unit vector in the negative X direction.

unit_Y :: R2Source

The unit vector in the negative Y direction.

direction :: R2 -> CircleFracSource

Compute the direction of a vector, measured counterclockwise from the positive x-axis as a fraction of a full turn. The zero vector is arbitrarily assigned the direction 0.

Size and extent of diagrams in R2

width :: (Boundable a, V a ~ R2) => a -> DoubleSource

Compute the width of a diagram.

height :: (Boundable a, V a ~ R2) => a -> DoubleSource

Compute the height of a diagram.

size2D :: (Boundable a, V a ~ R2) => a -> (Double, Double)Source

Compute the width and height of a diagram.

extentX :: (Boundable a, V a ~ R2) => a -> (Double, Double)Source

Compute the absolute x-coordinate range of a diagram in R2, in the form (lo,hi).

extentY :: (Boundable a, V a ~ R2) => a -> (Double, Double)Source

Compute the absolute y-coordinate range of a diagram in R2, in the form (lo,hi).

center2D :: (Boundable a, V a ~ R2) => a -> P2Source

Compute the point at the center (in the x- and y-directions) of a diagram.