Module dlib.math.transformation

Matrix-based geometric transformations

Functions

NameDescription
affineTransform2D(v, m) Affine transformations in 2D space
axisReflectionMatrix(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(zdir) Setup an orientation matrix using forward direction vector
forward(m) Forward vector of the matrix
fromEuler(v) Setup a rotation matrix, given Euler angles in radians
frustumMatrix(l, r, b, t, n, f) Setup a frustum matrix given the left, right, bottom, top, near, and far values for the frustum boundaries.
homothetyMatrix(point, scale) Create a matrix to perform uniform scale with respect to a point
homothetyMatrix2D(point, scale) Homothety (scale with respect to a point) in 2D space
lookAtMatrix(eye, center, up) Setup the matrix to perform a "Look At" transformation like a first person camera
orthoMatrix(l, r, b, t, n, f) Setup an orthographic Matrix4x4 given the left, right, bottom, top, near, and far values for the frustum boundaries.
orthoNormalMatrix(xdir, ydir, zdir) Setup an orientation matrix using 3 basis normalized vectors
perspectiveMatrix(fovY, aspect, n, 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(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(reflectionAxis, k) Setup the matrix to perform a reflection about a plane parallel to a cardinal plane.
right(m) Right vector of the matrix
rotationBetweenVectors(source, target) Setup an orientation matrix that performs rotation between two vectors
rotationMatrix(rotaxis, theta) Create a matrix to perform a rotation about a world axis (theta in radians)
rotationMatrix2D(theta) Rotation in 2D space
scaleAlongAxisMatrix(scaleAxis, k) Setup the matrix to perform scale along an arbitrary axis
scaleMatrix(v) Create a matrix to perform scale on each axis
scaleMatrix2D(s) Scale in 2D space
scaling(m) Scaling vector of the matrix
shadowMatrix(groundplane, lightpos) Setup a matrix that flattens geometry into a plane, as if it were casting a shadow from a light
shearMatrix(shearAxis, s, t) Setup the matrix to perform a shear
toEuler(m) Setup the Euler angles in radians, given a rotation matrix
translation(m) Translation vector of the matrix
translationMatrix(v) Create a translation matrix given a translation vector
translationMatrix2D(t) Translation in 2D space
up(m) Up vector of the matrix