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

Maintainerdiagrams-discuss@googlegroups.com
Safe HaskellNone

Diagrams.ThreeD.Transform

Description

Transformations specific to three dimensions, with a few generic transformations (uniform scaling, translation) also re-exported for convenience.

Synopsis

Documentation

aboutZ :: Angle a => a -> T3Source

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 :: Rad), and aboutZ (90 :: Deg) all represent the same transformation, namely, a counterclockwise rotation by a right angle. For more general rotations, see 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.

aboutX :: Angle a => a -> T3Source

Like aboutZ, but rotates about the X axis, bringing positive y-values towards the positive z-axis.

aboutY :: Angle a => a -> T3Source

Like aboutZ, but rotates about the Y axis, bringing postive x-values towards the negative z-axis.

rotationAboutSource

Arguments

:: (Angle a, Direction d) 
=> P3

origin of rotation

-> d

direction of rotation axis

-> a

angle of rotation

-> T3 

rotationAbout p d a is a rotation about a line parallel to d passing through p.

pointAt :: Direction d => d -> d -> d -> T3Source

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 initial 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 ± /4 turn.

pointAt' :: R3 -> R3 -> R3 -> T3Source

pointAt' has the same behavior as pointAt, but takes vectors instead of directions.

scalingX :: Double -> T3Source

Construct a transformation which scales by the given factor in the x direction.

scaleX :: (Transformable t, V t ~ R3) => Double -> t -> tSource

Scale a diagram by the given factor in the x (horizontal) direction. To scale uniformly, use scale.

scalingY :: Double -> T3Source

Construct a transformation which scales by the given factor in the y direction.

scaleY :: (Transformable t, V t ~ R3) => Double -> t -> tSource

Scale a diagram by the given factor in the y (vertical) direction. To scale uniformly, use scale.

scalingZ :: Double -> T3Source

Construct a transformation which scales by the given factor in the z direction.

scaleZ :: (Transformable t, V t ~ R3) => Double -> t -> tSource

Scale a diagram by the given factor in the z direction. To scale uniformly, use scale.

onBasis :: T3 -> ((R3, R3, R3), R3)Source

Get the matrix equivalent of an affine transform, as a triple of columns paired with the translation vector. This is mostly useful for implementing backends.