Safe Haskell | Safe-Infered |
---|

Affine Transformations of Arbitrary Geometric Objects

- class AffineTransformable a where
- scale' :: AffineTransformable a => RSdouble -> a -> a
- inverseTransform :: AffineTransformable a => Matrix -> a -> a
- withTransformation :: AffineTransformable a => Matrix -> (a -> a) -> a -> a
- transformAbout :: AffineTransformable a => Point3D -> (a -> a) -> a -> a
- translateToFrom :: AffineTransformable a => Point3D -> Point3D -> a -> a
- rotateToFrom :: AffineTransformable a => Vector3D -> Vector3D -> a -> a
- scaleAlong :: AffineTransformable a => Vector3D -> RSdouble -> a -> a

# Documentation

class AffineTransformable a whereSource

`AffineTransformable`

objects are subject to affine transformations using matrix multiplication.

transform :: Matrix -> a -> aSource

Apply an affine transformation, defined by a 4x4 matrix. (This is the only required method.)

scale :: Vector3D -> a -> aSource

Scale an entity along the `x`

`y`

and `z`

axes. For example, `scale (Vector3D 2 3 4)`

will make an object twice as wide, three times as tall,
and four times as deep. It may be helpful to think of the vector as a control point on the vertex of a unit cube.

translate :: Vector3D -> a -> aSource

Translate an entity along the specified vector.

rotate :: Vector3D -> Angle -> a -> aSource

Rotate an entity about the origin, using the specified vector as the axis of rotation.
See also `transformAbout`

to rotate around an arbitrary point.

rotateX :: Angle -> a -> aSource

Specific rotation around the x-axis.

rotateY :: Angle -> a -> aSource

Specific rotation around the y-axis.

rotateZ :: Angle -> a -> aSource

Specific rotation around the z-axis.

scale' :: AffineTransformable a => RSdouble -> a -> aSource

Specific scale preserving proportions.

inverseTransform :: AffineTransformable a => Matrix -> a -> aSource

Apply the inverse of an affine transformation, defined by a 4x4 matrix.

withTransformation :: AffineTransformable a => Matrix -> (a -> a) -> a -> aSource

Apply a function under an affine transformation. `withTransformation m id`

is an identity if `m`

is invertable.

transformAbout :: AffineTransformable a => Point3D -> (a -> a) -> a -> aSource

Apply a function treating a particular point as the origin. For example, combining `transformAbout`

with `rotate`

performs a rotation about an arbitrary point rather than the origin.

translateToFrom :: AffineTransformable a => Point3D -> Point3D -> a -> aSource

Specific translation along the vector between two points. This ordinary use is to set the second point as the center of a model (typically origin_point_3d) and the first point as the desired position of the model.

rotateToFrom :: AffineTransformable a => Vector3D -> Vector3D -> a -> aSource

Specific rotation along the shortest path that brings the second vector in line with the first.

scaleAlong :: AffineTransformable a => Vector3D -> RSdouble -> a -> aSource

Specific scale along an arbitary axis.