| Copyright | (c) 2013 diagrams-lib team (see LICENSE) |
|---|---|
| License | BSD-style (see LICENSE) |
| Maintainer | diagrams-discuss@googlegroups.com |
| Safe Haskell | None |
| Language | Haskell2010 |
Diagrams.ThreeD.Transform
Description
Transformations specific to three dimensions, with a few generic transformations (uniform scaling, translation) also re-exported for convenience.
- type T3 = Transformation V3
- aboutX :: Floating n => Angle n -> Transformation V3 n
- aboutY :: Floating n => Angle n -> Transformation V3 n
- aboutZ :: Floating n => Angle n -> Transformation V3 n
- rotationAbout :: Floating n => Point V3 n -> Direction V3 n -> Angle n -> Transformation V3 n
- rotateAbout :: (InSpace V3 n t, Floating n, Transformable t) => Point V3 n -> Direction V3 n -> Angle n -> t -> t
- pointAt :: Floating n => Direction V3 n -> Direction V3 n -> Direction V3 n -> Transformation V3 n
- pointAt' :: Floating n => V3 n -> V3 n -> V3 n -> Transformation V3 n
- scalingX :: (Additive v, R1 v, Fractional n) => n -> Transformation v n
- scalingY :: (Additive v, R2 v, Fractional n) => n -> Transformation v n
- scalingZ :: (Additive v, R3 v, Fractional n) => n -> Transformation v n
- scaleX :: (InSpace v n t, R2 v, Fractional n, Transformable t) => n -> t -> t
- scaleY :: (InSpace v n t, R2 v, Fractional n, Transformable t) => n -> t -> t
- scaleZ :: (InSpace v n t, R3 v, Fractional n, Transformable t) => n -> t -> t
- scaling :: (Additive v, Fractional n) => n -> Transformation v n
- scale :: (InSpace v n a, Eq n, Fractional n, Transformable a) => n -> a -> a
- translationX :: (Additive v, R1 v, Num n) => n -> Transformation v n
- translateX :: (InSpace v n t, R1 v, Transformable t) => n -> t -> t
- translationY :: (Additive v, R2 v, Num n) => n -> Transformation v n
- translateY :: (InSpace v n t, R2 v, Transformable t) => n -> t -> t
- translationZ :: (Additive v, R3 v, Num n) => n -> Transformation v n
- translateZ :: (InSpace v n t, R3 v, Transformable t) => n -> t -> t
- translation :: v n -> Transformation v n
- translate :: (Num (N t), Transformable t) => Vn t -> t -> t
- reflectionX :: (Additive v, R1 v, Num n) => Transformation v n
- reflectX :: (InSpace v n t, R1 v, Transformable t) => t -> t
- reflectionY :: (Additive v, R2 v, Num n) => Transformation v n
- reflectY :: (InSpace v n t, R2 v, Transformable t) => t -> t
- reflectionZ :: (Additive v, R3 v, Num n) => Transformation v n
- reflectZ :: (InSpace v n t, R3 v, Transformable t) => t -> t
- reflectionAcross :: (Metric v, Fractional n) => Point v n -> v n -> Transformation v n
- reflectAcross :: (InSpace v n t, Metric v, Fractional n, Transformable t) => Point v n -> v n -> t -> t
Documentation
type T3 = Transformation V3 Source
Rotation
aboutX :: Floating n => Angle n -> Transformation V3 n Source
Like aboutZ, but rotates about the X axis, bringing positive y-values
towards the positive z-axis.
aboutY :: Floating n => Angle n -> Transformation V3 n Source
Like aboutZ, but rotates about the Y axis, bringing postive
x-values towards the negative z-axis.
aboutZ :: Floating n => Angle n -> Transformation V3 n Source
Create a transformation which rotates by the given angle about a line parallel the Z axis passing through the local origin. A positive angle brings positive x-values towards the positive-y axis.
The angle can be expressed using any type which is an
instance of Angle. For example, aboutZ (1/4 @@
, turn)aboutZ (tau/4 @@ , and rad)aboutZ (90 @@
all represent the same transformation, namely, a
counterclockwise rotation by a right angle. For more general rotations,
see deg)rotationAbout.
Note that writing aboutZ (1/4), with no type annotation, will
yield an error since GHC cannot figure out which sort of angle
you want to use.
Arguments
| :: Floating n | |
| => Point V3 n | origin of rotation |
| -> Direction V3 n | direction of rotation axis |
| -> Angle n | angle of rotation |
| -> Transformation V3 n |
rotationAbout p d a is a rotation about a line parallel to d
passing through p.
Arguments
| :: (InSpace V3 n t, Floating n, Transformable t) | |
| => Point V3 n | origin of rotation |
| -> Direction V3 n | direction of rotation axis |
| -> Angle n | angle of rotation |
| -> t | |
| -> t |
rotationAbout p d a is a rotation about a line parallel to d
passing through p.
pointAt :: Floating n => Direction V3 n -> Direction V3 n -> Direction V3 n -> Transformation V3 n Source
pointAt about initial final produces a rotation which brings
the direction initial to point in the direction final by first
panning around about, then tilting about the axis perpendicular
to about and final. In particular, if this can be accomplished
without tilting, it will be, otherwise if only tilting is
necessary, no panning will occur. The tilt will always be between
± 1/4 turn.
pointAt' :: Floating n => V3 n -> V3 n -> V3 n -> Transformation V3 n Source
pointAt' has the same behavior as pointAt, but takes vectors
instead of directions.
Scaling
scalingX :: (Additive v, R1 v, Fractional n) => n -> Transformation v n Source
Construct a transformation which scales by the given factor in the x (horizontal) direction.
scalingY :: (Additive v, R2 v, Fractional n) => n -> Transformation v n Source
Construct a transformation which scales by the given factor in the y (vertical) direction.
scalingZ :: (Additive v, R3 v, Fractional n) => n -> Transformation v n Source
Construct a transformation which scales by the given factor in the z direction.
scaleX :: (InSpace v n t, R2 v, Fractional n, Transformable t) => n -> t -> t Source
Scale a diagram by the given factor in the x (horizontal)
direction. To scale uniformly, use scale.
scaleY :: (InSpace v n t, R2 v, Fractional n, Transformable t) => n -> t -> t Source
Scale a diagram by the given factor in the y (vertical)
direction. To scale uniformly, use scale.
scaleZ :: (InSpace v n t, R3 v, Fractional n, Transformable t) => n -> t -> t Source
Scale a diagram by the given factor in the z direction. To scale
uniformly, use scale.
scaling :: (Additive v, Fractional n) => n -> Transformation v n
Create a uniform scaling transformation.
scale :: (InSpace v n a, Eq n, Fractional n, Transformable a) => n -> a -> a
Scale uniformly in every dimension by the given scalar.
Translation
translationX :: (Additive v, R1 v, Num n) => n -> Transformation v n Source
Construct a transformation which translates by the given distance in the x (horizontal) direction.
translateX :: (InSpace v n t, R1 v, Transformable t) => n -> t -> t Source
Translate a diagram by the given distance in the x (horizontal) direction.
translationY :: (Additive v, R2 v, Num n) => n -> Transformation v n Source
Construct a transformation which translates by the given distance in the y (vertical) direction.
translateY :: (InSpace v n t, R2 v, Transformable t) => n -> t -> t Source
Translate a diagram by the given distance in the y (vertical) direction.
translationZ :: (Additive v, R3 v, Num n) => n -> Transformation v n Source
Construct a transformation which translates by the given distance in the z direction.
translateZ :: (InSpace v n t, R3 v, Transformable t) => n -> t -> t Source
Translate a diagram by the given distance in the y direction.
translation :: v n -> Transformation v n
Create a translation.
translate :: (Num (N t), Transformable t) => Vn t -> t -> t
Translate by a vector.
Reflection
reflectionX :: (Additive v, R1 v, Num n) => Transformation v n Source
Construct a transformation which flips a diagram from left to right, i.e. sends the point (x,y) to (-x,y).
reflectX :: (InSpace v n t, R1 v, Transformable t) => t -> t Source
Flip a diagram from left to right, i.e. send the point (x,y) to (-x,y).
reflectionY :: (Additive v, R2 v, Num n) => Transformation v n Source
Construct a transformation which flips a diagram from top to bottom, i.e. sends the point (x,y) to (x,-y).
reflectY :: (InSpace v n t, R2 v, Transformable t) => t -> t Source
Flip a diagram from top to bottom, i.e. send the point (x,y) to (x,-y).
reflectionZ :: (Additive v, R3 v, Num n) => Transformation v n Source
Construct a transformation which flips a diagram across z=0, i.e. sends the point (x,y,z) to (x,y,-z).
reflectZ :: (InSpace v n t, R3 v, Transformable t) => t -> t Source
Flip a diagram across z=0, i.e. send the point (x,y,z) to (x,y,-z).
reflectionAcross :: (Metric v, Fractional n) => Point v n -> v n -> Transformation v n Source
reflectionAcross p v is a reflection across the plane through
the point p and normal to vector v. This also works as a 2D
transform where v is the normal to the line passing through point
p.
reflectAcross :: (InSpace v n t, Metric v, Fractional n, Transformable t) => Point v n -> v n -> t -> t Source
reflectAcross p v reflects a diagram across the plane though
the point p and the vector v. This also works as a 2D transform
where v is the normal to the line passing through point p.