dlib.math.transformation

Matrix-based geometric transformations

Members

Aliases

rotation2
alias rotation2 = rotationMatrix2D
Undocumented in source.
scale2
alias scale2 = scaleMatrix2D
Undocumented in source.
translation2
alias translation2 = translationMatrix2D
Undocumented in source.

Functions

affineTransform2D
Vector!(T, 2) affineTransform2D(Vector!(T, 2) v, Matrix!(T, 3) m)

Affine transformations in 2D space

axisReflectionMatrix
Matrix!(T, 4) axisReflectionMatrix(Vector!(T, 3) n)

Setup the matrix to perform a reflection about an arbitrary plane through the origin. The unit vector n is perpendicular to the plane.

directionToMatrix
Matrix!(T, 4) directionToMatrix(Vector!(T, 3) zdir)

Setup an orientation matrix using forward direction vector

forward
Vector!(T, 3) forward(Matrix!(T, 4) m)

Forward vector of the matrix

fromEuler
Matrix!(T, 4) fromEuler(Vector!(T, 3) v)

Setup a rotation matrix, given Euler angles in radians

frustumMatrix
Matrix!(T, 4) frustumMatrix(T l, T r, T b, T t, T n, T f)

Setup a frustum matrix given the left, right, bottom, top, near, and far values for the frustum boundaries.

lookAtMatrix
Matrix!(T, 4) lookAtMatrix(Vector!(T, 3) eye, Vector!(T, 3) center, Vector!(T, 3) up)

Setup the matrix to perform a "Look At" transformation like a first person camera

orthoMatrix
Matrix!(T, 4) orthoMatrix(T l, T r, T b, T t, T n, T f)

Setup an orthographic Matrix4x4 given the left, right, bottom, top, near, and far values for the frustum boundaries.

orthoNormalMatrix
Matrix!(T, 4) orthoNormalMatrix(Vector!(T, 3) xdir, Vector!(T, 3) ydir, Vector!(T, 3) zdir)

Setup an orientation matrix using 3 basis normalized vectors

perspectiveMatrix
Matrix!(T, 4) perspectiveMatrix(T fovY, T aspect, T n, T f)

Setup a perspective matrix given the field-of-view in the Y direction in degrees, the aspect ratio of Y/X, and near and far plane distances

projectionMatrix
Matrix!(T, 4) projectionMatrix(Vector!(T, 3) n)

Setup the matrix to perform a projection onto a plane passing through the origin. The plane is perpendicular to the unit vector n.

reflectionMatrix
Matrix!(T, 4) reflectionMatrix(Axis reflectionAxis, T k)

Setup the matrix to perform a reflection about a plane parallel to a cardinal plane.

right
Vector!(T, 3) right(Matrix!(T, 4) m)

Right vector of the matrix

rotationBetweenVectors
Matrix!(T, 4) rotationBetweenVectors(Vector!(T, 3) source, Vector!(T, 3) target)

Setup an orientation matrix that performs rotation between two vectors

rotationMatrix
Matrix!(T, 4) rotationMatrix(uint rotaxis, T theta)

Create a matrix to perform a rotation about a world axis (theta in radians)

rotationMatrix2D
Matrix!(T, 3) rotationMatrix2D(T theta)

Rotation in 2D space

scaleAlongAxisMatrix
Matrix!(T, 4) scaleAlongAxisMatrix(Vector!(T, 3) scaleAxis, T k)

Setup the matrix to perform scale along an arbitrary axis

scaleMatrix
Matrix!(T, 4) scaleMatrix(Vector!(T, 3) v)

Create a matrix to perform scale on each axis

scaleMatrix2D
Matrix!(T, 3) scaleMatrix2D(Vector!(T, 2) s)

Scale in 2D space

scaling
Vector!(T, 3) scaling(Matrix!(T, 4) m)

Scaling vector of the matrix

shadowMatrix
Matrix!(T, 4) shadowMatrix(Vector!(T, 4) groundplane, Vector!(T, 4) lightpos)

Setup a matrix that flattens geometry into a plane, as if it were casting a shadow from a light

shearMatrix
Matrix!(T, 4) shearMatrix(uint shearAxis, T s, T t)

Setup the matrix to perform a shear

toEuler
Vector!(T, 3) toEuler(Matrix!(T, 4) m)

Setup the Euler angles in radians, given a rotation matrix

translation
Vector!(T, 3) translation(Matrix!(T, 4) m)

Translation vector of the matrix

translationMatrix
Matrix!(T, 4) translationMatrix(Vector!(T, 3) v)

Create a translation matrix given a translation vector

translationMatrix2D
Matrix!(T, 3) translationMatrix2D(Vector!(T, 2) t)

Translation in 2D space

up
Vector!(T, 3) up(Matrix!(T, 4) m)

Up vector of the matrix

Meta

Authors

Timur Gafarov