Maintainer | diagrams-discuss@googlegroups.com |
---|

Utility functions for diagrams in two-dimensional Cartesian space.

- unitX :: R2
- unitY :: R2
- unit_X :: R2
- unit_Y :: R2
- direction :: R2 -> CircleFrac
- width :: (Boundable a, V a ~ R2) => a -> Double
- height :: (Boundable a, V a ~ R2) => a -> Double
- size2D :: (Boundable a, V a ~ R2) => a -> (Double, Double)
- extentX :: (Boundable a, V a ~ R2) => a -> (Double, Double)
- extentY :: (Boundable a, V a ~ R2) => a -> (Double, Double)
- center2D :: (Boundable a, V a ~ R2) => a -> P2
- data SizeSpec2D

# General two-dimensional utilities

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

## Computing sizes

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.

## Specifying sizes

data SizeSpec2D Source

A specification of a (requested) rectangular size.

Width Double | Specify an explicit width. The height should be determined automatically (so as to preserve aspect ratio). |

Height Double | Specify an explicit height. The width should be determined automatically (so as to preserve aspect ratio) |

Dims Double Double | An explicit specification of both dimensions. |

Absolute | Absolute size: use whatever size an object already has; do not rescale. |