diagrams-lib-1.2.0.8: 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.

Constructors

 R3 !Double !Double !Double

Instances

 Eq R3 Ord R3 Read R3 Show R3 Transformable R3 HasCross3 R3 HasBasis R3 VectorSpace R3 InnerSpace R3 AdditiveGroup R3 HasR P3 HasR R3 HasZ P3 HasZ R3 HasY P3 HasY R3 HasX P3 HasX R3 Coordinates R3 HasTheta P3 HasTheta R3 HasPhi P3 HasPhi R3 Cylindrical P3 Cylindrical R3 Spherical P3 Spherical R3 type V R3 = R3 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.

# Directions in 3D

data Direction Source

A `Direction` represents directions in R3. The constructor is not exported; `Direction`s can be used with `fromDirection` and the lenses provided by its instances.

Instances

 HasTheta Direction HasPhi Direction

`direction v` is the direction in which `v` points. Returns an unspecified value when given the zero vector as input.

`fromDirection d` is the unit vector in the direction `d`.

compute the positive angle between the two directions in their common plane

# other coördinate systems

class Spherical t where Source

Types which can be expressed in spherical 3D coordinates, as a triple (r,θ,φ), where θ is rotation about the Z axis, and φ is the angle from the Z axis.

Methods

Instances

 Spherical P3 Spherical R3

class Cylindrical t where Source

Types which can be expressed in cylindrical 3D coordinates.

Methods

Instances

 Cylindrical P3 Cylindrical R3

class HasPhi t where Source

The class of types with at least two angle coordinates, the second called _phi.

Minimal complete definition

Nothing

Methods

Instances

 HasPhi Direction HasPhi P3 HasPhi R3