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

Copyright(c) 2014-2015 diagrams team (see LICENSE)
LicenseBSD-style (see LICENSE)
Maintainerdiagrams-discuss@googlegroups.com
Safe HaskellNone
LanguageHaskell2010

Diagrams.LinearMap

Contents

Description

Linear maps. Unlike Transformations these are not restricted to the same space. In practice these are used for projections in Diagrams.ThreeD.Projection. Unless you want to work with projections you're probably better off using Transform.

Currently only path-like things can be projected. In the future we hope to support projecting diagrams.

Synopsis

Linear maps

newtype LinearMap v u n Source #

Type for holding linear maps. Note that these are not affine transforms so attemping apply a translation with LinearMap will likely produce incorrect results.

Constructors

LinearMap 

Fields

class LinearMappable a b where Source #

Class of things that have vectors that can be mapped over.

Minimal complete definition

vmap

Methods

vmap :: (Vn a -> Vn b) -> a -> b Source #

Apply a linear map to an object. If the map is not linear, behaviour will likely be wrong.

Instances

(LinearMappable a b, (~) * r (Located b)) => LinearMappable (Located a) r Source # 

Methods

vmap :: (Vn (Located a) -> Vn r) -> Located a -> r Source #

(~) * r (FixedSegment u m) => LinearMappable (FixedSegment v n) r Source # 

Methods

vmap :: (Vn (FixedSegment v n) -> Vn r) -> FixedSegment v n -> r Source #

(Metric v, Metric u, OrderedField n, OrderedField m, (~) * r (Trail u m)) => LinearMappable (Trail v n) r Source # 

Methods

vmap :: (Vn (Trail v n) -> Vn r) -> Trail v n -> r Source #

(Metric v, Metric u, OrderedField n, OrderedField m, (~) * r (SegTree u m)) => LinearMappable (SegTree v n) r Source # 

Methods

vmap :: (Vn (SegTree v n) -> Vn r) -> SegTree v n -> r Source #

(Metric v, Metric u, OrderedField n, OrderedField m, (~) * r (Path u m)) => LinearMappable (Path v n) r Source # 

Methods

vmap :: (Vn (Path v n) -> Vn r) -> Path v n -> r Source #

LinearMappable (Point v n) (Point u m) Source # 

Methods

vmap :: (Vn (Point v n) -> Vn (Point u m)) -> Point v n -> Point u m Source #

(~) * r (Segment c u m) => LinearMappable (Segment c v n) r Source # 

Methods

vmap :: (Vn (Segment c v n) -> Vn r) -> Segment c v n -> r Source #

(~) * r (Offset c u m) => LinearMappable (Offset c v n) r Source # 

Methods

vmap :: (Vn (Offset c v n) -> Vn r) -> Offset c v n -> r Source #

(Metric v, Metric u, OrderedField n, OrderedField m, (~) * r (Trail' l u m)) => LinearMappable (Trail' l v n) r Source # 

Methods

vmap :: (Vn (Trail' l v n) -> Vn r) -> Trail' l v n -> r Source #

Applying linear maps

linmap :: (InSpace v n a, LinearMappable a b, N b ~ n) => LinearMap v (V b) n -> a -> b Source #

Apply a linear map.

Affine maps

data AffineMap v u n Source #

Affine linear maps. Unlike Transformation these do not have to be invertible so we can map between spaces.

Constructors

AffineMap (LinearMap v u n) (u n) 

class (LinearMappable a b, N a ~ N b) => AffineMappable a b where Source #

Methods

amap :: (Additive (V a), Foldable (V a), Additive (V b), Num (N b)) => AffineMap (V a) (V b) (N b) -> a -> b Source #

Affine map over an object. Has a default implimentation of only applying the linear map

Instances

(LinearMappable a b, (~) * (N a) (N b), (~) * r (Located b)) => AffineMappable (Located a) r Source # 

Methods

amap :: AffineMap (V (Located a)) (V r) (N r) -> Located a -> r Source #

(Additive v, Num n, (~) * r (Point u n)) => AffineMappable (Point v n) r Source # 

Methods

amap :: AffineMap (V (Point v n)) (V r) (N r) -> Point v n -> r Source #

(~) * r (FixedSegment u n) => AffineMappable (FixedSegment v n) r Source # 

Methods

amap :: AffineMap (V (FixedSegment v n)) (V r) (N r) -> FixedSegment v n -> r Source #

(Metric v, Metric u, OrderedField n, (~) * r (Trail u n)) => AffineMappable (Trail v n) r Source # 

Methods

amap :: AffineMap (V (Trail v n)) (V r) (N r) -> Trail v n -> r Source #

(Metric v, Metric u, OrderedField n, (~) * r (SegTree u n)) => AffineMappable (SegTree v n) r Source # 

Methods

amap :: AffineMap (V (SegTree v n)) (V r) (N r) -> SegTree v n -> r Source #

(Metric v, Metric u, OrderedField n, (~) * r (Path u n)) => AffineMappable (Path v n) r Source # 

Methods

amap :: AffineMap (V (Path v n)) (V r) (N r) -> Path v n -> r Source #

(~) * r (Segment c u n) => AffineMappable (Segment c v n) r Source # 

Methods

amap :: AffineMap (V (Segment c v n)) (V r) (N r) -> Segment c v n -> r Source #

(~) * r (Offset c u n) => AffineMappable (Offset c v n) r Source # 

Methods

amap :: AffineMap (V (Offset c v n)) (V r) (N r) -> Offset c v n -> r Source #

(Metric v, Metric u, OrderedField n, (~) * r (Trail' l u n)) => AffineMappable (Trail' l v n) r Source # 

Methods

amap :: AffineMap (V (Trail' l v n)) (V r) (N r) -> Trail' l v n -> r Source #

Constructing affine maps

mkAffineMap :: (v n -> u n) -> u n -> AffineMap v u n Source #

Make an affine map from a linear function and a translation.