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

Diagrams.ThreeD.Types

Description

Basic types for three-dimensional Euclidean space.

Synopsis

# 3D Euclidean space

r3 :: (n, n, n) -> V3 n Source #

Construct a 3D vector from a triple of components.

unr3 :: V3 n -> (n, n, n) Source #

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

mkR3 :: n -> n -> n -> V3 n Source #

Curried version of r3.

p3 :: (n, n, n) -> P3 n Source #

Construct a 3D point from a triple of coordinates.

unp3 :: P3 n -> (n, n, n) Source #

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

mkP3 :: n -> n -> n -> P3 n Source #

Curried version of r3.

r3Iso :: Iso' (V3 n) (n, n, n) Source #

p3Iso :: Iso' (P3 n) (n, n, n) Source #

project :: (Metric v, Fractional a) => v a -> v a -> v a #

project u v computes the projection of v onto u.

data V3 a :: * -> * #

A 3-dimensional vector

Constructors

 V3 !a !a !a

Instances

type P3 = Point V3 Source #

class R1 (t :: * -> *) where #

A space that has at least 1 basis vector _x.

Minimal complete definition

_x

Methods

_x :: Functor f => (a -> f a) -> t a -> f (t a) #

>>> V1 2 ^._x
2

>>> V1 2 & _x .~ 3
V1 3


Instances

 Methods_x :: Functor f => (a -> f a) -> Identity a -> f (Identity a) # Methods_x :: Functor f => (a -> f a) -> V4 a -> f (V4 a) # Methods_x :: Functor f => (a -> f a) -> V3 a -> f (V3 a) # Methods_x :: Functor f => (a -> f a) -> V2 a -> f (V2 a) # Methods_x :: Functor f => (a -> f a) -> V1 a -> f (V1 a) # R1 f => R1 (Point f) Methods_x :: Functor f => (a -> f a) -> Point f a -> f (Point f a) #

class R1 t => R2 (t :: * -> *) where #

A space that distinguishes 2 orthogonal basis vectors _x and _y, but may have more.

Minimal complete definition

_xy

Methods

_y :: Functor f => (a -> f a) -> t a -> f (t a) #

>>> V2 1 2 ^._y
2

>>> V2 1 2 & _y .~ 3
V2 1 3


_xy :: Functor f => (V2 a -> f (V2 a)) -> t a -> f (t a) #

Instances

 Methods_y :: Functor f => (a -> f a) -> V4 a -> f (V4 a) #_xy :: Functor f => (V2 a -> f (V2 a)) -> V4 a -> f (V4 a) # Methods_y :: Functor f => (a -> f a) -> V3 a -> f (V3 a) #_xy :: Functor f => (V2 a -> f (V2 a)) -> V3 a -> f (V3 a) # Methods_y :: Functor f => (a -> f a) -> V2 a -> f (V2 a) #_xy :: Functor f => (V2 a -> f (V2 a)) -> V2 a -> f (V2 a) # R2 f => R2 (Point f) Methods_y :: Functor f => (a -> f a) -> Point f a -> f (Point f a) #_xy :: Functor f => (V2 a -> f (V2 a)) -> Point f a -> f (Point f a) #

class R2 t => R3 (t :: * -> *) where #

A space that distinguishes 3 orthogonal basis vectors: _x, _y, and _z. (It may have more)

Minimal complete definition

Methods

_z :: Functor f => (a -> f a) -> t a -> f (t a) #

>>> V3 1 2 3 ^. _z
3


_xyz :: Functor f => (V3 a -> f (V3 a)) -> t a -> f (t a) #

Instances

 Methods_z :: Functor f => (a -> f a) -> V4 a -> f (V4 a) #_xyz :: Functor f => (V3 a -> f (V3 a)) -> V4 a -> f (V4 a) # Methods_z :: Functor f => (a -> f a) -> V3 a -> f (V3 a) #_xyz :: Functor f => (V3 a -> f (V3 a)) -> V3 a -> f (V3 a) # R3 f => R3 (Point f) Methods_z :: Functor f => (a -> f a) -> Point f a -> f (Point f a) #_xyz :: Functor f => (V3 a -> f (V3 a)) -> Point f a -> f (Point f a) #

# Orphan instances

 Source # Methods_phi :: RealFloat n => Lens' (V3 n) (Angle n) Source # Source # Methods_theta :: RealFloat n => Lens' (V3 n) (Angle n) Source # Source # Methods_r :: RealFloat n => Lens' (V3 n) n Source # Source # Methodstransform :: Transformation (V (V3 n)) (N (V3 n)) -> V3 n -> V3 n #