diagrams-lib-1.4.5.1: Embedded domain-specific language for declarative graphics
Copyright(c) 2011-15 diagrams-lib team (see LICENSE)
LicenseBSD-style (see LICENSE)
Maintainerdiagrams-discuss@googlegroups.com
Safe HaskellSafe-Inferred
LanguageHaskell2010

Diagrams.Transform

Description

Affine transformations, parameterized by any vector space. For transformations on particular vector spaces, see e.g. Diagrams.TwoD.Transform.

Synopsis

Transformations

data Transformation (v :: Type -> Type) n Source #

General (affine) transformations, represented by an invertible linear map, its transpose, and a vector representing a translation component.

By the transpose of a linear map we mean simply the linear map corresponding to the transpose of the map's matrix representation. For example, any scale is its own transpose, since scales are represented by matrices with zeros everywhere except the diagonal. The transpose of a rotation is the same as its inverse.

The reason we need to keep track of transposes is because it turns out that when transforming a shape according to some linear map L, the shape's normal vectors transform according to L's inverse transpose. (For a more detailed explanation and proof, see https://wiki.haskell.org/Diagrams/Dev/Transformations.) This is exactly what we need when transforming bounding functions, which are defined in terms of perpendicular (i.e. normal) hyperplanes.

For more general, non-invertible transformations, see Diagrams.Deform (in diagrams-lib).

Instances

Instances details
(Additive v, Num n) => Monoid (Transformation v n) 
Instance details

Defined in Diagrams.Core.Transform

(Additive v, Num n) => Semigroup (Transformation v n)

Transformations are closed under composition; t1 <> t2 is the transformation which performs first t2, then t1.

Instance details

Defined in Diagrams.Core.Transform

(Additive v, Num n) => HasOrigin (Transformation v n) 
Instance details

Defined in Diagrams.Core.Transform

(Additive v, Num n) => Transformable (Transformation v n) 
Instance details

Defined in Diagrams.Core.Transform

(Transformable a, V a ~ v, N a ~ n) => Action (Transformation v n) a

Transformations can act on transformable things.

Instance details

Defined in Diagrams.Core.Transform

Methods

act :: Transformation v n -> a -> a Source #

type N (Transformation v n) 
Instance details

Defined in Diagrams.Core.Transform

type N (Transformation v n) = n
type V (Transformation v n) 
Instance details

Defined in Diagrams.Core.Transform

type V (Transformation v n) = v

inv :: forall (v :: Type -> Type) n. (Functor v, Num n) => Transformation v n -> Transformation v n Source #

Invert a transformation.

transl :: Transformation v n -> v n Source #

Get the translational component of a transformation.

apply :: Transformation v n -> v n -> v n Source #

Apply a transformation to a vector. Note that any translational component of the transformation will not affect the vector, since vectors are invariant under translation.

papply :: forall (v :: Type -> Type) n. (Additive v, Num n) => Transformation v n -> Point v n -> Point v n Source #

Apply a transformation to a point.

The Transformable class

class Transformable t where Source #

Type class for things t which can be transformed.

Methods

transform :: Transformation (V t) (N t) -> t -> t Source #

Apply a transformation to an object.

Instances

Instances details
Transformable a => Transformable (Active a) Source # 
Instance details

Defined in Diagrams.Animation.Active

Methods

transform :: Transformation (V (Active a)) (N (Active a)) -> Active a -> Active a Source #

(Transformable t, Ord t) => Transformable (Set t) 
Instance details

Defined in Diagrams.Core.Transform

Methods

transform :: Transformation (V (Set t)) (N (Set t)) -> Set t -> Set t Source #

(Num (N t), Additive (V t), Transformable t) => Transformable (TransInv t) 
Instance details

Defined in Diagrams.Core.Transform

(Additive (V a), Num (N a), Transformable a) => Transformable (Located a) Source #

Applying a transformation t to a Located a results in the transformation being applied to the location, and the linear portion of t being applied to the value of type a (i.e. it is not translated).

Instance details

Defined in Diagrams.Located

Methods

transform :: Transformation (V (Located a)) (N (Located a)) -> Located a -> Located a Source #

Transformable (ParallelLight n) Source # 
Instance details

Defined in Diagrams.ThreeD.Light

Fractional n => Transformable (PointLight n) Source # 
Instance details

Defined in Diagrams.ThreeD.Light

Fractional n => Transformable (Box n) Source # 
Instance details

Defined in Diagrams.ThreeD.Shapes

Methods

transform :: Transformation (V (Box n)) (N (Box n)) -> Box n -> Box n Source #

Fractional n => Transformable (CSG n) Source # 
Instance details

Defined in Diagrams.ThreeD.Shapes

Methods

transform :: Transformation (V (CSG n)) (N (CSG n)) -> CSG n -> CSG n Source #

Fractional n => Transformable (Ellipsoid n) Source # 
Instance details

Defined in Diagrams.ThreeD.Shapes

Fractional n => Transformable (Frustum n) Source # 
Instance details

Defined in Diagrams.ThreeD.Shapes

Methods

transform :: Transformation (V (Frustum n)) (N (Frustum n)) -> Frustum n -> Frustum n Source #

(V t ~ V2, N t ~ n, RealFloat n, Transformable t) => Transformable (ScaleInv t) Source # 
Instance details

Defined in Diagrams.Transform.ScaleInv

Floating n => Transformable (FillTexture n) Source # 
Instance details

Defined in Diagrams.TwoD.Attributes

Fractional n => Transformable (LGradient n) Source # 
Instance details

Defined in Diagrams.TwoD.Attributes

Floating n => Transformable (LineTexture n) Source # 
Instance details

Defined in Diagrams.TwoD.Attributes

Fractional n => Transformable (RGradient n) Source # 
Instance details

Defined in Diagrams.TwoD.Attributes

Floating n => Transformable (Texture n) Source # 
Instance details

Defined in Diagrams.TwoD.Attributes

Methods

transform :: Transformation (V (Texture n)) (N (Texture n)) -> Texture n -> Texture n Source #

OrderedField n => Transformable (Clip n) Source # 
Instance details

Defined in Diagrams.TwoD.Path

Methods

transform :: Transformation (V (Clip n)) (N (Clip n)) -> Clip n -> Clip n Source #

Floating n => Transformable (Text n) Source # 
Instance details

Defined in Diagrams.TwoD.Text

Methods

transform :: Transformation (V (Text n)) (N (Text n)) -> Text n -> Text n Source #

Transformable (V2 n) Source # 
Instance details

Defined in Diagrams.TwoD.Types

Methods

transform :: Transformation (V (V2 n)) (N (V2 n)) -> V2 n -> V2 n Source #

Transformable (V3 n) Source # 
Instance details

Defined in Diagrams.ThreeD.Types

Methods

transform :: Transformation (V (V3 n)) (N (V3 n)) -> V3 n -> V3 n Source #

Transformable m => Transformable (Deletable m) 
Instance details

Defined in Diagrams.Core.Transform

Transformable t => Transformable [t] 
Instance details

Defined in Diagrams.Core.Transform

Methods

transform :: Transformation (V [t]) (N [t]) -> [t] -> [t] Source #

Transformable t => Transformable (Map k t) 
Instance details

Defined in Diagrams.Core.Transform

Methods

transform :: Transformation (V (Map k t)) (N (Map k t)) -> Map k t -> Map k t Source #

(Metric v, Floating n) => Transformable (Envelope v n) 
Instance details

Defined in Diagrams.Core.Envelope

Methods

transform :: Transformation (V (Envelope v n)) (N (Envelope v n)) -> Envelope v n -> Envelope v n Source #

(InSpace v n t, Transformable t, HasLinearMap v, Floating n) => Transformable (Measured n t) 
Instance details

Defined in Diagrams.Core.Transform

Methods

transform :: Transformation (V (Measured n t)) (N (Measured n t)) -> Measured n t -> Measured n t Source #

(Additive v, Traversable v, Floating n) => Transformable (Attribute v n)

TAttributes are transformed directly, MAttributes have their local scale multiplied by the average scale of the transform. Plain Attributes are unaffected.

Instance details

Defined in Diagrams.Core.Style

Methods

transform :: Transformation (V (Attribute v n)) (N (Attribute v n)) -> Attribute v n -> Attribute v n Source #

(Additive v, Traversable v, Floating n) => Transformable (Style v n) 
Instance details

Defined in Diagrams.Core.Style

Methods

transform :: Transformation (V (Style v n)) (N (Style v n)) -> Style v n -> Style v n Source #

(Additive v, Num n) => Transformable (Trace v n) 
Instance details

Defined in Diagrams.Core.Trace

Methods

transform :: Transformation (V (Trace v n)) (N (Trace v n)) -> Trace v n -> Trace v n Source #

(Additive v, Num n) => Transformable (Transformation v n) 
Instance details

Defined in Diagrams.Core.Transform

(V (v n) ~ v, N (v n) ~ n, Transformable (v n)) => Transformable (Direction v n) Source # 
Instance details

Defined in Diagrams.Direction

Methods

transform :: Transformation (V (Direction v n)) (N (Direction v n)) -> Direction v n -> Direction v n Source #

(HasLinearMap v, Metric v, OrderedField n) => Transformable (Path v n) Source # 
Instance details

Defined in Diagrams.Path

Methods

transform :: Transformation (V (Path v n)) (N (Path v n)) -> Path v n -> Path v n Source #

(Additive v, Num n) => Transformable (FixedSegment v n) Source # 
Instance details

Defined in Diagrams.Segment

Num n => Transformable (Camera l n) Source # 
Instance details

Defined in Diagrams.ThreeD.Camera

Methods

transform :: Transformation (V (Camera l n)) (N (Camera l n)) -> Camera l n -> Camera l n Source #

(Floating n, Ord n, Metric v) => Transformable (SegTree v n) Source # 
Instance details

Defined in Diagrams.Trail

Methods

transform :: Transformation (V (SegTree v n)) (N (SegTree v n)) -> SegTree v n -> SegTree v n Source #

(HasLinearMap v, Metric v, OrderedField n) => Transformable (Trail v n) Source # 
Instance details

Defined in Diagrams.Trail

Methods

transform :: Transformation (V (Trail v n)) (N (Trail v n)) -> Trail v n -> Trail v n Source #

Fractional n => Transformable (DImage n a) Source # 
Instance details

Defined in Diagrams.TwoD.Image

Methods

transform :: Transformation (V (DImage n a)) (N (DImage n a)) -> DImage n a -> DImage n a Source #

(Measured m a, Transformable a) => Transformable (FingerTree m a) Source # 
Instance details

Defined in Diagrams.Trail

Methods

transform :: Transformation (V (FingerTree m a)) (N (FingerTree m a)) -> FingerTree m a -> FingerTree m a Source #

(Additive v, Num n) => Transformable (Point v n) 
Instance details

Defined in Diagrams.Core.Transform

Methods

transform :: Transformation (V (Point v n)) (N (Point v n)) -> Point v n -> Point v n Source #

(V t ~ v, N t ~ n, V t ~ V s, N t ~ N s, Functor v, Num n, Transformab