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

Diagrams.TwoD.Types

Description

Basic types for two-dimensional Euclidean space.

Synopsis

# 2D Euclidean space

data V2 a :: * -> * #

A 2-dimensional vector

>>> pure 1 :: V2 Int
V2 1 1

>>> V2 1 2 + V2 3 4
V2 4 6

>>> V2 1 2 * V2 3 4
V2 3 8

>>> sum (V2 1 2)
3


Constructors

 V2 ~a ~a

Instances

class R1 t where #

A space that has at least 1 basis vector _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.

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) #

type P2 = Point V2 #

r2 :: (n, n) -> V2 n #

Construct a 2D vector from a pair of components. See also &.

unr2 :: V2 n -> (n, n) #

Convert a 2D vector back into a pair of components. See also coords.

mkR2 :: n -> n -> V2 n #

Curried form of r2.

r2Iso :: Iso' (V2 n) (n, n) #

p2 :: (n, n) -> P2 n #

Construct a 2D point from a pair of coordinates. See also ^&.

mkP2 :: n -> n -> P2 n #

Curried form of p2.

unp2 :: P2 n -> (n, n) #

Convert a 2D point back into a pair of coordinates. See also coords.

p2Iso :: Iso' (Point V2 n) (n, n) #

r2PolarIso :: RealFloat n => Iso' (V2 n) (n, Angle n) #

class HasR t where #

A space which has magnitude _r that can be calculated numerically.

Methods

_r :: RealFloat n => Lens' (t n) n #

Instances

 # Methods_r :: RealFloat n => Lens' (V2 n) n # HasR v => HasR (Point v) # Methods_r :: RealFloat n => Lens' (Point v n) n #

# Orphan instances

 # Methods_theta :: RealFloat n => Lens' (V2 n) (Angle n) # # Methodstransform :: Transformation (V (V2 n)) (N (V2 n)) -> V2 n -> V2 n #