diagrams-lib-1.4.2.3: 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 :: Type -> Type) where #

A space that has at least 1 basis vector _x.

Methods

_x :: Lens' (t a) a #

>>> V1 2 ^._x
2

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

Instances
 Instance detailsDefined in Linear.V1 Methods_x :: Lens' (Identity a) a # Instance detailsDefined in Linear.V4 Methods_x :: Lens' (V4 a) a # Instance detailsDefined in Linear.V3 Methods_x :: Lens' (V3 a) a # Instance detailsDefined in Linear.V2 Methods_x :: Lens' (V2 a) a # Instance detailsDefined in Linear.V1 Methods_x :: Lens' (V1 a) a # R1 f => R1 (Point f) Instance detailsDefined in Linear.Affine Methods_x :: Lens' (Point f a) a #

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

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

Minimal complete definition

_xy

Methods

_y :: Lens' (t a) a #

>>> V2 1 2 ^._y
2

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


_xy :: Lens' (t a) (V2 a) #

Instances
 Instance detailsDefined in Linear.V4 Methods_y :: Lens' (V4 a) a #_xy :: Lens' (V4 a) (V2 a) # Instance detailsDefined in Linear.V3 Methods_y :: Lens' (V3 a) a #_xy :: Lens' (V3 a) (V2 a) # Instance detailsDefined in Linear.V2 Methods_y :: Lens' (V2 a) a #_xy :: Lens' (V2 a) (V2 a) # R2 f => R2 (Point f) Instance detailsDefined in Linear.Affine Methods_y :: Lens' (Point f a) a #_xy :: Lens' (Point f a) (V2 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
 # Instance detailsDefined in Diagrams.ThreeD.Types Methods_r :: RealFloat n => Lens' (V3 n) n # # Instance detailsDefined in Diagrams.TwoD.Types Methods_r :: RealFloat n => Lens' (V2 n) n # HasR v => HasR (Point v) # Instance detailsDefined in Diagrams.TwoD.Types Methods_r :: RealFloat n => Lens' (Point v n) n #

# Orphan instances

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