Matrix4x4 structure and operations. More...
#include <kanzi/core/legacy/util/math/kzc_vector3.hpp>
#include <kanzi/core/legacy/wrappers/kzs_math.hpp>
#include <kanzi/core/legacy/kzs_types.hpp>
Classes | |
struct | KzcMatrix4x4 |
Structure for 4x4 matrix. More... | |
Macros | |
#define | KZC_MATRIX4X4_INDEX_AXISX_X |
Matrix index for coordinate X of X axis. More... | |
#define | KZC_MATRIX4X4_INDEX_AXISX_Y |
Matrix index for coordinate Y of X axis. More... | |
#define | KZC_MATRIX4X4_INDEX_AXISX_Z |
Matrix index for coordinate Z of X axis. More... | |
#define | KZC_MATRIX4X4_INDEX_AXISY_X |
Matrix index for coordinate X of Y axis. More... | |
#define | KZC_MATRIX4X4_INDEX_AXISY_Y |
Matrix index for coordinate Y of Y axis. More... | |
#define | KZC_MATRIX4X4_INDEX_AXISY_Z |
Matrix index for coordinate Z of Y axis. More... | |
#define | KZC_MATRIX4X4_INDEX_AXISZ_X |
Matrix index for coordinate X of Z axis. More... | |
#define | KZC_MATRIX4X4_INDEX_AXISZ_Y |
Matrix index for coordinate Y of Z axis. More... | |
#define | KZC_MATRIX4X4_INDEX_AXISZ_Z |
Matrix index for coordinate Z of Z axis. More... | |
#define | KZC_MATRIX4X4_INDEX_TRANSLATION_X |
Matrix index for X translation. More... | |
#define | KZC_MATRIX4X4_INDEX_TRANSLATION_Y |
Matrix index for Y translation. More... | |
#define | KZC_MATRIX4X4_INDEX_TRANSLATION_Z |
Matrix index for Z translation. More... | |
Functions | |
KZ_INLINE struct KzcMatrix4x4 | kzcMatrix4x4 (kzFloat a11, kzFloat a12, kzFloat a13, kzFloat a14, kzFloat a21, kzFloat a22, kzFloat a23, kzFloat a24, kzFloat a31, kzFloat a32, kzFloat a33, kzFloat a34, kzFloat a41, kzFloat a42, kzFloat a43, kzFloat a44) |
Creates a matrix with given values. More... | |
KANZI_API void | kzcMatrix4x4Copy (const struct KzcMatrix4x4 *sourceMatrix, struct KzcMatrix4x4 *targetMatrix) |
Create a copy of matrix. More... | |
KANZI_API struct KzcMatrix4x4 | kzcMatrix4x4From3x3 (const struct KzcMatrix3x3 *matrix) |
Expands a 4x4 matrix from 3x3 matrix by omitting the Z axis. More... | |
KANZI_API void | kzcMatrix4x4SetIdentity (struct KzcMatrix4x4 *matrix) |
Sets a identity matrix. More... | |
KANZI_API void | kzcMatrix4x4SetInvalid (struct KzcMatrix4x4 *matrix) |
Sets an invalid matrix filled with NaNs. More... | |
KANZI_API void | kzcMatrix4x4SetIdentity3x3 (struct KzcMatrix4x4 *matrix) |
Sets a 4x4 matrix top left 3x3 part as identity. More... | |
KANZI_API void | kzcMatrix4x4ResetTranslation (struct KzcMatrix4x4 *matrix) |
Sets a 4x4 matrix translation columns to zero. More... | |
KANZI_API void | kzcMatrix4x4Transpose (const struct KzcMatrix4x4 *matrix, struct KzcMatrix4x4 *out_matrix) |
Applies a transpose to a matrix. More... | |
KANZI_API kzBool | kzcMatrix4x4Inverse (const struct KzcMatrix4x4 *matrix, struct KzcMatrix4x4 *out_matrix) |
Applies an inversion to an affine matrix. More... | |
KANZI_API kzBool | kzcMatrix4x4InverseOrthogonal (const struct KzcMatrix4x4 *matrix, struct KzcMatrix4x4 *out_matrix) |
Applies an inversion to an orthogonal affine matrix. More... | |
KANZI_API void | kzcMatrix4x4Translate (struct KzcMatrix4x4 *matrix, kzFloat x, kzFloat y, kzFloat z) |
Translates matrix by given vector3 in matrix's base. More... | |
KANZI_API void | kzcMatrix4x4TranslateVector3 (struct KzcMatrix4x4 *matrix, const struct KzcVector3 *translation) |
Translates matrix by given vector3 in matrix's base. More... | |
KANZI_API void | kzcMatrix4x4RotateX (struct KzcMatrix4x4 *matrix, kzFloat angleInRadians) |
Multiplies matrix from right by a rotation around X axis. More... | |
KANZI_API void | kzcMatrix4x4RotateY (struct KzcMatrix4x4 *matrix, kzFloat angleInRadians) |
Multiplies matrix from right by a rotation around Y axis. More... | |
KANZI_API void | kzcMatrix4x4RotateZ (struct KzcMatrix4x4 *matrix, kzFloat angleInRadians) |
Multiplies matrix from right by a rotation around Z axis. More... | |
KANZI_API void | kzcMatrix4x4Rotate (struct KzcMatrix4x4 *matrix, kzFloat angleInRadians, kzFloat x, kzFloat y, kzFloat z) |
Multiplies matrix from right by a rotation around arbitrary axis. More... | |
KANZI_API void | kzcMatrix4x4SetRotationX (struct KzcMatrix4x4 *matrix, kzFloat angleInRadians) |
Creates a X rotation matrix. More... | |
KANZI_API void | kzcMatrix4x4SetRotationY (struct KzcMatrix4x4 *matrix, kzFloat angleInRadians) |
Creates a Y rotation matrix. More... | |
KANZI_API void | kzcMatrix4x4SetRotationZ (struct KzcMatrix4x4 *matrix, kzFloat angleInRadians) |
Creates a Z rotation matrix. More... | |
KANZI_API void | kzcMatrix4x4SetRotation (struct KzcMatrix4x4 *matrix, kzFloat angleInRadians, kzFloat x, kzFloat y, kzFloat z) |
Creates a rotation matrix over an arbitrary axis. More... | |
KZ_INLINE void | kzcMatrix4x4RotateXInDegrees (struct KzcMatrix4x4 *matrix, kzFloat angleInDegrees) |
Multiplies matrix from right by a rotation around X axis. More... | |
KZ_INLINE void | kzcMatrix4x4RotateYInDegrees (struct KzcMatrix4x4 *matrix, kzFloat angleInDegrees) |
Multiplies matrix from right by a rotation around Y axis. More... | |
KZ_INLINE void | kzcMatrix4x4RotateZInDegrees (struct KzcMatrix4x4 *matrix, kzFloat angleInDegrees) |
Multiplies matrix from right by a rotation around Z axis. More... | |
KZ_INLINE void | kzcMatrix4x4RotateInDegrees (struct KzcMatrix4x4 *matrix, kzFloat angleInDegrees, kzFloat x, kzFloat y, kzFloat z) |
Multiplies matrix from right by a rotation around arbitrary axis. More... | |
KZ_INLINE void | kzcMatrix4x4SetRotationXInDegrees (struct KzcMatrix4x4 *matrix, kzFloat angleInDegrees) |
Creates a X rotation matrix, rotation angle in degrees. More... | |
KZ_INLINE void | kzcMatrix4x4SetRotationYInDegrees (struct KzcMatrix4x4 *matrix, kzFloat angleInDegrees) |
Creates a Y rotation matrix, rotation angle in degrees. More... | |
KZ_INLINE void | kzcMatrix4x4SetRotationZInDegrees (struct KzcMatrix4x4 *matrix, kzFloat angleInDegrees) |
Creates a Z rotation matrix, rotation angle in degrees. More... | |
KZ_INLINE void | kzcMatrix4x4SetRotationInDegrees (struct KzcMatrix4x4 *matrix, kzFloat angleInDegrees, kzFloat x, kzFloat y, kzFloat z) |
Creates a rotation matrix over an arbitrary axis. More... | |
KANZI_API void | kzcMatrix4x4ScaleUniform (struct KzcMatrix4x4 *matrix, kzFloat scale) |
Applies an uniform scaling for a matrix. More... | |
KANZI_API void | kzcMatrix4x4Scale (struct KzcMatrix4x4 *matrix, kzFloat scaleX, kzFloat scaleY, kzFloat scaleZ) |
Applies a scaling for a matrix. More... | |
KANZI_API kzFloat | kzcMatrix4x4GetScaleX (const struct KzcMatrix4x4 *matrix) |
Gets scaling factor from matrix for its X axis. More... | |
KANZI_API kzFloat | kzcMatrix4x4GetScaleY (const struct KzcMatrix4x4 *matrix) |
Gets scaling factor from matrix for its Y axis. More... | |
KANZI_API kzFloat | kzcMatrix4x4GetScaleZ (const struct KzcMatrix4x4 *matrix) |
Gets scaling factor from matrix for its Z axis. More... | |
KANZI_API void | kzcMatrix4x4ScaleX (struct KzcMatrix4x4 *matrix, kzFloat scale) |
Scales X vector of a transformation matrix. More... | |
KANZI_API void | kzcMatrix4x4ScaleY (struct KzcMatrix4x4 *matrix, kzFloat scale) |
Scales Y vector of a transformation matrix. More... | |
KANZI_API void | kzcMatrix4x4ScaleZ (struct KzcMatrix4x4 *matrix, kzFloat scale) |
Scales Z vector of a transformation matrix. More... | |
KANZI_API void | kzcMatrix4x4NormalizeBase (const struct KzcMatrix4x4 *matrix, struct KzcMatrix4x4 *out_matrix) |
Normalizes base vectors of the given matrix. More... | |
KANZI_API void | kzcMatrix4x4OrthonormalizeBase (const struct KzcMatrix4x4 *matrix, struct KzcMatrix4x4 *out_matrix) |
Orthonormalizes base vectors of the given matrix. More... | |
KANZI_API void | kzcMatrix4x4OrthogonalizeBase (const struct KzcMatrix4x4 *matrix, struct KzcMatrix4x4 *out_matrix) |
Orthogonalizes base vectors of the given matrix. More... | |
KANZI_API kzFloat | kzcMatrix4x4OrthogonalGetAngleCosine (const struct KzcMatrix4x4 *matrix1, const struct KzcMatrix4x4 *matrix2) |
Get the the cosine of the shortest angle between the 3x3 transformations in two matrices. More... | |
KANZI_API void | kzcMatrix4x4Multiply (const struct KzcMatrix4x4 *matrix1, const struct KzcMatrix4x4 *matrix2, struct KzcMatrix4x4 *out_matrix) |
Multiplies two matrices. More... | |
KANZI_API void | kzcMatrix4x4MultiplyAffine (const struct KzcMatrix4x4 *matrix1, const struct KzcMatrix4x4 *matrix2, struct KzcMatrix4x4 *out_matrix) |
Multiplies two affine matrices. More... | |
KANZI_API kzFloat | kzcMatrix4x4MultiplyAffineGetTranslationZ (const struct KzcMatrix4x4 *matrix1, const struct KzcMatrix4x4 *matrix2) |
Gets translation Z value from product 'matrix1' * 'matrix2', where both are affine transformations. More... | |
KANZI_API void | kzcMatrix4x4MultiplyVector3 (const struct KzcMatrix4x4 *matrix, const struct KzcVector3 *vector, struct KzcVector3 *out_vector) |
Multiplies matrix and vector3 defined as vec34(vector3.xyz, 1.0). More... | |
KANZI_API void | kzcMatrix4x4MultiplyVector3By3x3 (const struct KzcMatrix4x4 *matrix, const struct KzcVector3 *vector, struct KzcVector3 *out_vector) |
Multiplies matrix and vector3 by using 3x3 top left corner of matrix (orientation & scale only). More... | |
KANZI_API void | kzcMatrix4x4MultiplyVector4 (const struct KzcMatrix4x4 *matrix, const struct KzcVector4 *vector, struct KzcVector4 *out_vector) |
Multiplies matrix and vector4. More... | |
KANZI_API void | kzcMatrix4x4CreateOrthogonalProjection (struct KzcMatrix4x4 *matrix, kzFloat left, kzFloat right, kzFloat bottom, kzFloat top, kzFloat near, kzFloat far) |
Creates projection matrix for orthogonal projection. More... | |
KANZI_API void | kzcMatrix4x4Interpolate (const struct KzcMatrix4x4 *matrix1, const struct KzcMatrix4x4 *matrix2, kzFloat t, struct KzcMatrix4x4 *out_matrix) |
Interpolates 2 SRT matrices, t clamped to range [0, 1]. More... | |
KANZI_API void | kzcMatrix4x4CreateSRT (struct KzcMatrix4x4 *matrix, kzFloat scaleX, kzFloat scaleY, kzFloat scaleZ, kzFloat rotateXInRadians, kzFloat rotateYInRadians, kzFloat rotateZInRadians, kzFloat translateX, kzFloat translateY, kzFloat translateZ) |
Creates matrix from scale, rotation and translation. More... | |
KANZI_API void | kzcMatrix4x4GetSRT (const struct KzcMatrix4x4 *matrix, struct KzcVector3 *out_scale, struct KzcVector3 *out_rotateAnglesInRadians, struct KzcVector3 *out_translate) |
Gets the matrix SRT values, rotation angles in radians. More... | |
KZ_INLINE void | kzcMatrix4x4CreateSRTInDegrees (struct KzcMatrix4x4 *matrix, kzFloat scaleX, kzFloat scaleY, kzFloat scaleZ, kzFloat rotateXInDegrees, kzFloat rotateYInDegrees, kzFloat rotateZInDegrees, kzFloat translateX, kzFloat translateY, kzFloat translateZ) |
Creates matrix from scale, rotation and translation. More... | |
KZ_INLINE void | kzcMatrix4x4GetSRTInDegrees (const struct KzcMatrix4x4 *matrix, struct KzcVector3 *out_scale, struct KzcVector3 *out_rotateAnglesInDegrees, struct KzcVector3 *out_translate) |
Gets the matrix SRT values, rotation angles in degrees. More... | |
KZ_INLINE void | kzcMatrix4x4GetAxisX (const struct KzcMatrix4x4 *matrix, struct KzcVector3 *out_axis) |
Returns the X axis vector of the matrix. More... | |
KZ_INLINE void | kzcMatrix4x4GetAxisY (const struct KzcMatrix4x4 *matrix, struct KzcVector3 *out_axis) |
Returns the Y axis vector of the matrix. More... | |
KZ_INLINE void | kzcMatrix4x4GetAxisZ (const struct KzcMatrix4x4 *matrix, struct KzcVector3 *out_axis) |
Returns the Z axis vector of the matrix. More... | |
KZ_INLINE void | kzcMatrix4x4GetTranslation (const struct KzcMatrix4x4 *matrix, struct KzcVector3 *out_translation) |
Returns the translation vector of the matrix. More... | |
KZ_INLINE void | kzcMatrix4x4SetAxisXVector3 (struct KzcMatrix4x4 *matrix, const struct KzcVector3 *axis) |
Sets the X axis vector of the matrix. More... | |
KZ_INLINE void | kzcMatrix4x4SetAxisYVector3 (struct KzcMatrix4x4 *matrix, const struct KzcVector3 *axis) |
Sets the Y axis vector of the matrix. More... | |
KZ_INLINE void | kzcMatrix4x4SetAxisZVector3 (struct KzcMatrix4x4 *matrix, const struct KzcVector3 *axis) |
Sets the Z axis vector of the matrix. More... | |
KZ_INLINE void | kzcMatrix4x4SetTranslationVector3 (struct KzcMatrix4x4 *matrix, const struct KzcVector3 *translation) |
Sets the translation vector of the matrix. More... | |
KANZI_API void | kzcMatrix4x4GetEulerAngles (const struct KzcMatrix4x4 *matrix, struct KzcVector3 *out_anglesInRadians) |
Calculates Euler angles (in radians) from given matrix. More... | |
KZ_INLINE void | kzcMatrix4x4GetEulerAnglesInDegrees (const struct KzcMatrix4x4 *matrix, struct KzcVector3 *out_anglesInDegrees) |
Calculates Euler angles (in degrees) from given matrix. More... | |
KANZI_API kzFloat | kzcMatrix4x4Determinant (const struct KzcMatrix4x4 *matrix) |
Calculates the determinant of the matrix. More... | |
KANZI_API kzFloat | kzcMatrix4x4Trace (const struct KzcMatrix4x4 *matrix) |
Returns matrix's trace. More... | |
KANZI_API kzBool | kzcMatrix4x4IsRightAngleRotation (const struct KzcMatrix4x4 *matrix, kzFloat epsilon) |
Determines if a matrix has only right angle rotations. More... | |
KANZI_API kzBool | kzcMatrix4x4IsSimpleLayout (const struct KzcMatrix4x4 *matrix, kzFloat epsilon) |
Determines if a matrix is a simple layout matrix - has only scale and right-angle rotations. More... | |
KANZI_API kzBool | kzcMatrix4x4IsTranslationOnly (const struct KzcMatrix4x4 *matrix) |
Determines if a matrix is translation only. More... | |
KZ_INLINE kzBool | kzcMatrix4x4IsEqual (const struct KzcMatrix4x4 *matrixA, const struct KzcMatrix4x4 *matrixB) |
Compares 2 matrices if they are equal. More... | |
Variables | |
KANZI_API const struct KzcMatrix4x4 | KZC_MATRIX4X4_IDENTITY |
Constant for identity matrix. More... | |
KANZI_API const struct KzcMatrix4x4 | KZC_MATRIX4X4_NAN |
Constant for NaN matrix. More... | |
KANZI_API const struct KzcMatrix4x4 | KZC_MATRIX4X4_SHADOW_MAP_BIAS |
Constant for shadow map bias matrix. More... | |
Matrix4x4 structure and operations.
Copyright 2008-2017 by Rightware. All rights reserved.
#define KZC_MATRIX4X4_INDEX_AXISX_X |
Matrix index for coordinate X of X axis.
#define KZC_MATRIX4X4_INDEX_AXISX_Y |
Matrix index for coordinate Y of X axis.
#define KZC_MATRIX4X4_INDEX_AXISX_Z |
Matrix index for coordinate Z of X axis.
#define KZC_MATRIX4X4_INDEX_AXISY_X |
Matrix index for coordinate X of Y axis.
#define KZC_MATRIX4X4_INDEX_AXISY_Y |
Matrix index for coordinate Y of Y axis.
#define KZC_MATRIX4X4_INDEX_AXISY_Z |
Matrix index for coordinate Z of Y axis.
#define KZC_MATRIX4X4_INDEX_AXISZ_X |
Matrix index for coordinate X of Z axis.
#define KZC_MATRIX4X4_INDEX_AXISZ_Y |
Matrix index for coordinate Y of Z axis.
#define KZC_MATRIX4X4_INDEX_AXISZ_Z |
Matrix index for coordinate Z of Z axis.
#define KZC_MATRIX4X4_INDEX_TRANSLATION_X |
Matrix index for X translation.
#define KZC_MATRIX4X4_INDEX_TRANSLATION_Y |
Matrix index for Y translation.
#define KZC_MATRIX4X4_INDEX_TRANSLATION_Z |
Matrix index for Z translation.
KZ_INLINE struct KzcMatrix4x4 kzcMatrix4x4 | ( | kzFloat | a11, |
kzFloat | a12, | ||
kzFloat | a13, | ||
kzFloat | a14, | ||
kzFloat | a21, | ||
kzFloat | a22, | ||
kzFloat | a23, | ||
kzFloat | a24, | ||
kzFloat | a31, | ||
kzFloat | a32, | ||
kzFloat | a33, | ||
kzFloat | a34, | ||
kzFloat | a41, | ||
kzFloat | a42, | ||
kzFloat | a43, | ||
kzFloat | a44 | ||
) |
Creates a matrix with given values.
The translation components occupy the 13th, 14th, and 15th elements of the 16-element matrix, where indices are numbered from 1 to 16 as described in section 2.11.2 of the OpenGL 2.1 Specification.
KANZI_API void kzcMatrix4x4Copy | ( | const struct KzcMatrix4x4 * | sourceMatrix, |
struct KzcMatrix4x4 * | targetMatrix | ||
) |
Create a copy of matrix.
KANZI_API struct KzcMatrix4x4 kzcMatrix4x4From3x3 | ( | const struct KzcMatrix3x3 * | matrix | ) |
Expands a 4x4 matrix from 3x3 matrix by omitting the Z axis.
KANZI_API void kzcMatrix4x4SetIdentity | ( | struct KzcMatrix4x4 * | matrix | ) |
Sets a identity matrix.
KANZI_API void kzcMatrix4x4SetInvalid | ( | struct KzcMatrix4x4 * | matrix | ) |
Sets an invalid matrix filled with NaNs.
KANZI_API void kzcMatrix4x4SetIdentity3x3 | ( | struct KzcMatrix4x4 * | matrix | ) |
Sets a 4x4 matrix top left 3x3 part as identity.
KANZI_API void kzcMatrix4x4ResetTranslation | ( | struct KzcMatrix4x4 * | matrix | ) |
Sets a 4x4 matrix translation columns to zero.
KANZI_API void kzcMatrix4x4Transpose | ( | const struct KzcMatrix4x4 * | matrix, |
struct KzcMatrix4x4 * | out_matrix | ||
) |
Applies a transpose to a matrix.
out_matrix cannot be same as input matrix.
KANZI_API kzBool kzcMatrix4x4Inverse | ( | const struct KzcMatrix4x4 * | matrix, |
struct KzcMatrix4x4 * | out_matrix | ||
) |
Applies an inversion to an affine matrix.
out_matrix cannot be same as input matrix. Returns KZ_TRUE if the matrix was invertible, KZ_FALSE otherwise.
KANZI_API kzBool kzcMatrix4x4InverseOrthogonal | ( | const struct KzcMatrix4x4 * | matrix, |
struct KzcMatrix4x4 * | out_matrix | ||
) |
Applies an inversion to an orthogonal affine matrix.
out_matrix cannot be same as input matrix. Returns KZ_TRUE if the matrix was invertible, KZ_FALSE otherwise.
KANZI_API void kzcMatrix4x4Translate | ( | struct KzcMatrix4x4 * | matrix, |
kzFloat | x, | ||
kzFloat | y, | ||
kzFloat | z | ||
) |
Translates matrix by given vector3 in matrix's base.
i.e. kzcMatrix4x4Translate(matrix M, vector T) adds M * T to the translation part of the matrix.
KANZI_API void kzcMatrix4x4TranslateVector3 | ( | struct KzcMatrix4x4 * | matrix, |
const struct KzcVector3 * | translation | ||
) |
Translates matrix by given vector3 in matrix's base.
i.e. kzcMatrix4x4Translate(matrix M, vector T) adds M * T to the translation part of the matrix.
KANZI_API void kzcMatrix4x4RotateX | ( | struct KzcMatrix4x4 * | matrix, |
kzFloat | angleInRadians | ||
) |
Multiplies matrix from right by a rotation around X axis.
Angle is in radians.
KANZI_API void kzcMatrix4x4RotateY | ( | struct KzcMatrix4x4 * | matrix, |
kzFloat | angleInRadians | ||
) |
Multiplies matrix from right by a rotation around Y axis.
Angle is in radians.
KANZI_API void kzcMatrix4x4RotateZ | ( | struct KzcMatrix4x4 * | matrix, |
kzFloat | angleInRadians | ||
) |
Multiplies matrix from right by a rotation around Z axis.
Angle is in radians.
KANZI_API void kzcMatrix4x4Rotate | ( | struct KzcMatrix4x4 * | matrix, |
kzFloat | angleInRadians, | ||
kzFloat | x, | ||
kzFloat | y, | ||
kzFloat | z | ||
) |
Multiplies matrix from right by a rotation around arbitrary axis.
Angle is in radians.
Similar to glRotatef. The rotation axis needs not be normalized.
KANZI_API void kzcMatrix4x4SetRotationX | ( | struct KzcMatrix4x4 * | matrix, |
kzFloat | angleInRadians | ||
) |
Creates a X rotation matrix.
KANZI_API void kzcMatrix4x4SetRotationY | ( | struct KzcMatrix4x4 * | matrix, |
kzFloat | angleInRadians | ||
) |
Creates a Y rotation matrix.
KANZI_API void kzcMatrix4x4SetRotationZ | ( | struct KzcMatrix4x4 * | matrix, |
kzFloat | angleInRadians | ||
) |
Creates a Z rotation matrix.
KANZI_API void kzcMatrix4x4SetRotation | ( | struct KzcMatrix4x4 * | matrix, |
kzFloat | angleInRadians, | ||
kzFloat | x, | ||
kzFloat | y, | ||
kzFloat | z | ||
) |
Creates a rotation matrix over an arbitrary axis.
Similar to the matrix used by glRotatef. The rotation axis needs not be normalized.
KZ_INLINE void kzcMatrix4x4RotateXInDegrees | ( | struct KzcMatrix4x4 * | matrix, |
kzFloat | angleInDegrees | ||
) |
Multiplies matrix from right by a rotation around X axis.
Angle is in degrees.
KZ_INLINE void kzcMatrix4x4RotateYInDegrees | ( | struct KzcMatrix4x4 * | matrix, |
kzFloat | angleInDegrees | ||
) |
Multiplies matrix from right by a rotation around Y axis.
Angle is in degrees.
KZ_INLINE void kzcMatrix4x4RotateZInDegrees | ( | struct KzcMatrix4x4 * | matrix, |
kzFloat | angleInDegrees | ||
) |
Multiplies matrix from right by a rotation around Z axis.
Angle is in degrees.
KZ_INLINE void kzcMatrix4x4RotateInDegrees | ( | struct KzcMatrix4x4 * | matrix, |
kzFloat | angleInDegrees, | ||
kzFloat | x, | ||
kzFloat | y, | ||
kzFloat | z | ||
) |
Multiplies matrix from right by a rotation around arbitrary axis.
Angle is in degrees.
Similar to glRotatef. The rotation axis needs not be normalized.
KZ_INLINE void kzcMatrix4x4SetRotationXInDegrees | ( | struct KzcMatrix4x4 * | matrix, |
kzFloat | angleInDegrees | ||
) |
Creates a X rotation matrix, rotation angle in degrees.
KZ_INLINE void kzcMatrix4x4SetRotationYInDegrees | ( | struct KzcMatrix4x4 * | matrix, |
kzFloat | angleInDegrees | ||
) |
Creates a Y rotation matrix, rotation angle in degrees.
KZ_INLINE void kzcMatrix4x4SetRotationZInDegrees | ( | struct KzcMatrix4x4 * | matrix, |
kzFloat | angleInDegrees | ||
) |
Creates a Z rotation matrix, rotation angle in degrees.
KZ_INLINE void kzcMatrix4x4SetRotationInDegrees | ( | struct KzcMatrix4x4 * | matrix, |
kzFloat | angleInDegrees, | ||
kzFloat | x, | ||
kzFloat | y, | ||
kzFloat | z | ||
) |
Creates a rotation matrix over an arbitrary axis.
Similar to the matrix used by glRotatef. The rotation axis needs not be normalized, rotation angle in degrees.
KANZI_API void kzcMatrix4x4ScaleUniform | ( | struct KzcMatrix4x4 * | matrix, |
kzFloat | scale | ||
) |
Applies an uniform scaling for a matrix.
KANZI_API void kzcMatrix4x4Scale | ( | struct KzcMatrix4x4 * | matrix, |
kzFloat | scaleX, | ||
kzFloat | scaleY, | ||
kzFloat | scaleZ | ||
) |
Applies a scaling for a matrix.
KANZI_API kzFloat kzcMatrix4x4GetScaleX | ( | const struct KzcMatrix4x4 * | matrix | ) |
Gets scaling factor from matrix for its X axis.
Assumes an affine matrix.
KANZI_API kzFloat kzcMatrix4x4GetScaleY | ( | const struct KzcMatrix4x4 * | matrix | ) |
Gets scaling factor from matrix for its Y axis.
Assumes an affine matrix.
KANZI_API kzFloat kzcMatrix4x4GetScaleZ | ( | const struct KzcMatrix4x4 * | matrix | ) |
Gets scaling factor from matrix for its Z axis.
Assumes an affine matrix.
KANZI_API void kzcMatrix4x4ScaleX | ( | struct KzcMatrix4x4 * | matrix, |
kzFloat | scale | ||
) |
Scales X vector of a transformation matrix.
KANZI_API void kzcMatrix4x4ScaleY | ( | struct KzcMatrix4x4 * | matrix, |
kzFloat | scale | ||
) |
Scales Y vector of a transformation matrix.
KANZI_API void kzcMatrix4x4ScaleZ | ( | struct KzcMatrix4x4 * | matrix, |
kzFloat | scale | ||
) |
Scales Z vector of a transformation matrix.
KANZI_API void kzcMatrix4x4NormalizeBase | ( | const struct KzcMatrix4x4 * | matrix, |
struct KzcMatrix4x4 * | out_matrix | ||
) |
Normalizes base vectors of the given matrix.
The result is in out_matrix. The matrix must be an affine transformation.
KANZI_API void kzcMatrix4x4OrthonormalizeBase | ( | const struct KzcMatrix4x4 * | matrix, |
struct KzcMatrix4x4 * | out_matrix | ||
) |
Orthonormalizes base vectors of the given matrix.
The result is in out_matrix. The orthonormalization is done using the Gram-Schmidt process. Z axis is kept still, then Y is handled, then X. This function can be used to prevent value drift.
KANZI_API void kzcMatrix4x4OrthogonalizeBase | ( | const struct KzcMatrix4x4 * | matrix, |
struct KzcMatrix4x4 * | out_matrix | ||
) |
Orthogonalizes base vectors of the given matrix.
The result is in out_matrix. This function preserves lengths of the axis vectors so it won't help in preventing all potential drifting.
KANZI_API kzFloat kzcMatrix4x4OrthogonalGetAngleCosine | ( | const struct KzcMatrix4x4 * | matrix1, |
const struct KzcMatrix4x4 * | matrix2 | ||
) |
Get the the cosine of the shortest angle between the 3x3 transformations in two matrices.
KANZI_API void kzcMatrix4x4Multiply | ( | const struct KzcMatrix4x4 * | matrix1, |
const struct KzcMatrix4x4 * | matrix2, | ||
struct KzcMatrix4x4 * | out_matrix | ||
) |
Multiplies two matrices.
The result, product 'matrix1' * 'matrix2', is set to out_matrix. out_matrix cannot be any of the input matrices.
KANZI_API void kzcMatrix4x4MultiplyAffine | ( | const struct KzcMatrix4x4 * | matrix1, |
const struct KzcMatrix4x4 * | matrix2, | ||
struct KzcMatrix4x4 * | out_matrix | ||
) |
Multiplies two affine matrices.
The result, product 'matrix1' * 'matrix2', is set to out_matrix. out_matrix cannot be any of the input matrices.
KANZI_API kzFloat kzcMatrix4x4MultiplyAffineGetTranslationZ | ( | const struct KzcMatrix4x4 * | matrix1, |
const struct KzcMatrix4x4 * | matrix2 | ||
) |
Gets translation Z value from product 'matrix1' * 'matrix2', where both are affine transformations.
KANZI_API void kzcMatrix4x4MultiplyVector3 | ( | const struct KzcMatrix4x4 * | matrix, |
const struct KzcVector3 * | vector, | ||
struct KzcVector3 * | out_vector | ||
) |
Multiplies matrix and vector3 defined as vec34(vector3.xyz, 1.0).
KANZI_API void kzcMatrix4x4MultiplyVector3By3x3 | ( | const struct KzcMatrix4x4 * | matrix, |
const struct KzcVector3 * | vector, | ||
struct KzcVector3 * | out_vector | ||
) |
Multiplies matrix and vector3 by using 3x3 top left corner of matrix (orientation & scale only).
KANZI_API void kzcMatrix4x4MultiplyVector4 | ( | const struct KzcMatrix4x4 * | matrix, |
const struct KzcVector4 * | vector, | ||
struct KzcVector4 * | out_vector | ||
) |
Multiplies matrix and vector4.
out_vector cannot be same as input vector.
KANZI_API void kzcMatrix4x4CreateOrthogonalProjection | ( | struct KzcMatrix4x4 * | matrix, |
kzFloat | left, | ||
kzFloat | right, | ||
kzFloat | bottom, | ||
kzFloat | top, | ||
kzFloat | near, | ||
kzFloat | far | ||
) |
Creates projection matrix for orthogonal projection.
KANZI_API void kzcMatrix4x4Interpolate | ( | const struct KzcMatrix4x4 * | matrix1, |
const struct KzcMatrix4x4 * | matrix2, | ||
kzFloat | t, | ||
struct KzcMatrix4x4 * | out_matrix | ||
) |
Interpolates 2 SRT matrices, t clamped to range [0, 1].
KANZI_API void kzcMatrix4x4CreateSRT | ( | struct KzcMatrix4x4 * | matrix, |
kzFloat | scaleX, | ||
kzFloat | scaleY, | ||
kzFloat | scaleZ, | ||
kzFloat | rotateXInRadians, | ||
kzFloat | rotateYInRadians, | ||
kzFloat | rotateZInRadians, | ||
kzFloat | translateX, | ||
kzFloat | translateY, | ||
kzFloat | translateZ | ||
) |
Creates matrix from scale, rotation and translation.
Rotation angles in radians.
KANZI_API void kzcMatrix4x4GetSRT | ( | const struct KzcMatrix4x4 * | matrix, |
struct KzcVector3 * | out_scale, | ||
struct KzcVector3 * | out_rotateAnglesInRadians, | ||
struct KzcVector3 * | out_translate | ||
) |
Gets the matrix SRT values, rotation angles in radians.
KZ_INLINE void kzcMatrix4x4CreateSRTInDegrees | ( | struct KzcMatrix4x4 * | matrix, |
kzFloat | scaleX, | ||
kzFloat | scaleY, | ||
kzFloat | scaleZ, | ||
kzFloat | rotateXInDegrees, | ||
kzFloat | rotateYInDegrees, | ||
kzFloat | rotateZInDegrees, | ||
kzFloat | translateX, | ||
kzFloat | translateY, | ||
kzFloat | translateZ | ||
) |
Creates matrix from scale, rotation and translation.
Rotation angles in degrees.
KZ_INLINE void kzcMatrix4x4GetSRTInDegrees | ( | const struct KzcMatrix4x4 * | matrix, |
struct KzcVector3 * | out_scale, | ||
struct KzcVector3 * | out_rotateAnglesInDegrees, | ||
struct KzcVector3 * | out_translate | ||
) |
Gets the matrix SRT values, rotation angles in degrees.
KZ_INLINE void kzcMatrix4x4GetAxisX | ( | const struct KzcMatrix4x4 * | matrix, |
struct KzcVector3 * | out_axis | ||
) |
Returns the X axis vector of the matrix.
KZ_INLINE void kzcMatrix4x4GetAxisY | ( | const struct KzcMatrix4x4 * | matrix, |
struct KzcVector3 * | out_axis | ||
) |
Returns the Y axis vector of the matrix.
KZ_INLINE void kzcMatrix4x4GetAxisZ | ( | const struct KzcMatrix4x4 * | matrix, |
struct KzcVector3 * | out_axis | ||
) |
Returns the Z axis vector of the matrix.
KZ_INLINE void kzcMatrix4x4GetTranslation | ( | const struct KzcMatrix4x4 * | matrix, |
struct KzcVector3 * | out_translation | ||
) |
Returns the translation vector of the matrix.
KZ_INLINE void kzcMatrix4x4SetAxisXVector3 | ( | struct KzcMatrix4x4 * | matrix, |
const struct KzcVector3 * | axis | ||
) |
Sets the X axis vector of the matrix.
KZ_INLINE void kzcMatrix4x4SetAxisYVector3 | ( | struct KzcMatrix4x4 * | matrix, |
const struct KzcVector3 * | axis | ||
) |
Sets the Y axis vector of the matrix.
KZ_INLINE void kzcMatrix4x4SetAxisZVector3 | ( | struct KzcMatrix4x4 * | matrix, |
const struct KzcVector3 * | axis | ||
) |
Sets the Z axis vector of the matrix.
KZ_INLINE void kzcMatrix4x4SetTranslationVector3 | ( | struct KzcMatrix4x4 * | matrix, |
const struct KzcVector3 * | translation | ||
) |
Sets the translation vector of the matrix.
KANZI_API void kzcMatrix4x4GetEulerAngles | ( | const struct KzcMatrix4x4 * | matrix, |
struct KzcVector3 * | out_anglesInRadians | ||
) |
Calculates Euler angles (in radians) from given matrix.
KZ_INLINE void kzcMatrix4x4GetEulerAnglesInDegrees | ( | const struct KzcMatrix4x4 * | matrix, |
struct KzcVector3 * | out_anglesInDegrees | ||
) |
Calculates Euler angles (in degrees) from given matrix.
KANZI_API kzFloat kzcMatrix4x4Determinant | ( | const struct KzcMatrix4x4 * | matrix | ) |
Calculates the determinant of the matrix.
KANZI_API kzFloat kzcMatrix4x4Trace | ( | const struct KzcMatrix4x4 * | matrix | ) |
Returns matrix's trace.
KANZI_API kzBool kzcMatrix4x4IsRightAngleRotation | ( | const struct KzcMatrix4x4 * | matrix, |
kzFloat | epsilon | ||
) |
Determines if a matrix has only right angle rotations.
KANZI_API kzBool kzcMatrix4x4IsSimpleLayout | ( | const struct KzcMatrix4x4 * | matrix, |
kzFloat | epsilon | ||
) |
Determines if a matrix is a simple layout matrix - has only scale and right-angle rotations.
KANZI_API kzBool kzcMatrix4x4IsTranslationOnly | ( | const struct KzcMatrix4x4 * | matrix | ) |
Determines if a matrix is translation only.
KZ_INLINE kzBool kzcMatrix4x4IsEqual | ( | const struct KzcMatrix4x4 * | matrixA, |
const struct KzcMatrix4x4 * | matrixB | ||
) |
Compares 2 matrices if they are equal.
KANZI_API const struct KzcMatrix4x4 KZC_MATRIX4X4_IDENTITY |
Constant for identity matrix.
KANZI_API const struct KzcMatrix4x4 KZC_MATRIX4X4_NAN |
Constant for NaN matrix.
KANZI_API const struct KzcMatrix4x4 KZC_MATRIX4X4_SHADOW_MAP_BIAS |
Constant for shadow map bias matrix.