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

Diagrams.ThreeD.Types

Description

Basic types for three-dimensional Euclidean space.

Synopsis

# 3D Euclidean space

data R3 Source

The three-dimensional Euclidean vector space R^3.

Instances

 Eq R3 Ord R3 Read R3 Show R3 Transformable R3 Wrapped R3 Lens wrapped isomorphisms for R3. HasCross3 R3 HasBasis R3 VectorSpace R3 InnerSpace R3 AdditiveGroup R3 HasZ P3 HasZ R3 HasY P3 HasY R3 HasX P3 HasX R3 Coordinates R3 Rewrapped R3 R3 type V R3 = R3 type Unwrapped R3 = (Double, Double, Double) type Basis R3 = Either () (Either () ()) type Scalar R3 = Double type FinalCoord R3 = Double type PrevDim R3 = R2 type Decomposition R3 = (:&) ((:&) Double Double) Double

r3 :: (Double, Double, Double) -> R3 Source

Construct a 3D vector from a triple of components.

unr3 :: R3 -> (Double, Double, Double) Source

Convert a 3D vector back into a triple of components.

mkR3 :: Double -> Double -> Double -> R3 Source

Curried version of `r3`.

type P3 = Point R3 Source

Points in R^3.

p3 :: (Double, Double, Double) -> P3 Source

Construct a 3D point from a triple of coordinates.

unp3 :: P3 -> (Double, Double, Double) Source

Convert a 3D point back into a triple of coordinates.

mkP3 :: Double -> Double -> Double -> P3 Source

Curried version of `r3`.

Transformations in R^3.

# Two-dimensional angles

These are defined in Diagrams.TwoD.Types but reëxported here for convenience.

data Angle Source

Angles can be expressed in a variety of units. Internally, they are represented in radians.

Instances

 Enum Angle Eq Angle Ord Angle Read Angle Show Angle VectorSpace Angle AdditiveGroup Angle type Scalar Angle = Double

The radian measure of an `Angle` `a` can be accessed as ```a ^. rad```. A new `Angle` can be defined in radians as `pi @@ rad`.

The measure of an `Angle` `a` in full circles can be accessed as `a ^. turn`. A new `Angle` of one-half circle can be defined in as `1/2 @@ turn`.

The degree measure of an `Angle` `a` can be accessed as ```a ^. deg```. A new `Angle` can be defined in degrees as ```180 @@ deg```.

(@@) :: b -> Iso' a b -> a infixl 5 Source

`30 @@ deg` is an `Angle` of the given measure and units.

More generally, `@@` reverses the `Iso'` on its right, and applies the `Iso'` to the value on the left. `Angle`s are the motivating example where this order improves readability.

An angle representing one full turn.

Calculate ratio between two angles.

# Directions in 3D

class Direction d where Source

Direction is a type class representing directions in R3. The interface is based on that of the Angle class in 2D.

Methods

toSpherical :: d -> Spherical Source

Convert to spherical coördinates

Convert from spherical coördinates

Instances

 Direction Spherical

data Spherical Source

A direction expressed as a pair of spherical coordinates. `Spherical 0 0` is the direction of `unitX`. The first coordinate represents rotation about the Z axis, the second rotation towards the Z axis.

Constructors

 Spherical Angle Angle

Instances

 Eq Spherical Read Spherical Show Spherical Direction Spherical

The identity function with a restricted type, for conveniently restricting unwanted polymorphism. For example, ```fromDirection . asSpherical . camForward``` gives a unit vector pointing in the direction of the camera view. Without `asSpherical`, the intermediate type would be ambiguous.