nlib
nn::nlib::simd::Matrix Class Reference

The class with the collection of functions that handle 4x4 matrices. More...

#include "nn/nlib/simd/SimdMatrix.h"

Static Public Member Functions

static SimdVector Determinant (SimdMatrixArg m) noexcept
 Calculates the determinant. More...
 
static SimdMatrix Identity () noexcept
 Returns an identity matrix.
 
static SimdMatrix Inverse (SimdVector *det, SimdMatrixArg m) noexcept
 Calculates the inverse matrix. More...
 
static bool IsIdentity (SimdMatrixArg m) noexcept
 Determines whether a matrix is an identity matrix. More...
 
static bool IsInfinite (SimdMatrixArg m) noexcept
 Determines whether matrix m has any infinite elements. More...
 
static bool IsNaN (SimdMatrixArg m) noexcept
 Determines whether matrix m has any non-numeric elements. More...
 
static SimdMatrix Mult (SimdMatrixArg a, SimdMatrixArg b) noexcept
 Multiplies matrices. More...
 
static SimdMatrix Transpose (SimdMatrixArg m) noexcept
 Transposes a matrix. More...
 
static SimdMatrix MultTranspose (SimdMatrixArg a, SimdMatrixArg b) noexcept
 Calculates the transpose of the product of two matrices. More...
 
static SimdMatrix FromScaling (float scale_x, float scale_y, float scale_z) noexcept
 Creates a scaling matrix. More...
 
static SimdMatrix FromScaling (SimdVectorArg scale) noexcept
 Creates a scaling matrix. More...
 
static SimdMatrix FromTranslation (float ofs_x, float ofs_y, float ofs_z) noexcept
 Creates a translation matrix. More...
 
static SimdMatrix FromTranslation (SimdVectorArg ofs) noexcept
 Creates a translation matrix. More...
 
static SimdMatrix FromRotationX (float sin_value, float cos_value) noexcept
 Creates a matrix rotated around the x-axis. More...
 
static SimdMatrix FromRotationY (float sin_value, float cos_value) noexcept
 Creates a matrix rotated around the y-axis. More...
 
static SimdMatrix FromRotationZ (float sin_value, float cos_value) noexcept
 Creates a matrix rotated around the z-axis. More...
 
static SimdMatrix FromRotationAxisAndSinCos (SimdVectorArg axis_normalized, float sin_value, float cos_value) noexcept
 Calculates a rotation matrix from the axis and the sin/cos of the angle of rotation. More...
 
static SimdMatrix FromRotationQuaternion (SimdQuaternionArg quat) noexcept
 Calculates a rotation matrix from a quaternion. More...
 
static SimdMatrix FromRotationZXY (SimdVectorArg sin_xyz, SimdVectorArg cos_xyz) noexcept
 Calculates a rotation matrix from the sin/cos of the angle of rotation around each of the ZXY axes. More...
 
static SimdMatrix LookToLh (SimdVectorArg eye_pos, SimdVectorArg eye_dir_normalized, SimdVectorArg up_dir_normalized) noexcept
 Creates a camera matrix in a left-handed coordinate system from the camera position, the camera direction, and the up direction. More...
 
static SimdMatrix LookAtLh (SimdVectorArg eye_pos, SimdVectorArg at_pos, SimdVectorArg up_dir_normalized) noexcept
 Creates a camera matrix in a left-handed coordinate system from the camera position, the focal point, and the up direction. More...
 
static SimdMatrix LookToRh (SimdVectorArg eye_pos, SimdVectorArg eye_dir_normalized, SimdVectorArg up_dir_normalized) noexcept
 Creates a camera matrix in a right-handed coordinate system from the camera position, the camera direction, and the up direction. More...
 
static SimdMatrix LookAtRh (SimdVectorArg eye_pos, SimdVectorArg at_pos, SimdVectorArg up_dir_normalized) noexcept
 Creates a camera matrix in a right-handed coordinate system from the camera position, the focal point, and the up direction. More...
 
static SimdMatrix PerspectiveLh (float width, float height, float near_z, float far_z) noexcept
 Creates a perspective projection matrix in a left-handed coordinate system. More...
 
static SimdMatrix PerspectiveRh (float width, float height, float near_z, float far_z) noexcept
 Creates a perspective projection matrix in a right-handed coordinate system. More...
 
static SimdMatrix PerspectiveFovLh (float half_fovy_sin, float half_fovy_cos, float aspect, float near_z, float far_z) noexcept
 Creates a perspective projection matrix in a left-handed coordinate system. More...
 
static SimdMatrix PerspectiveFovRh (float half_fovy_sin, float half_fovy_cos, float aspect, float near_z, float far_z) noexcept
 Creates a perspective projection matrix in a right-handed coordinate system. More...
 
static SimdMatrix PerspectiveOffCenterLh (float left, float right, float bottom, float top, float near_z, float far_z) noexcept
 Creates a perspective projection matrix in a left-handed coordinate system. More...
 
static SimdMatrix PerspectiveOffCenterRh (float left, float right, float bottom, float top, float near_z, float far_z) noexcept
 Creates a perspective projection matrix in a right-handed coordinate system. More...
 
static SimdMatrix OrthographicLh (float width, float height, float near_z, float far_z) noexcept
 Creates an orthographic projection matrix in a left-handed coordinate system. More...
 
static SimdMatrix OrthographicRh (float width, float height, float near_z, float far_z) noexcept
 Creates an orthographic projection matrix in a right-handed coordinate system. More...
 
static SimdMatrix OrthographicOffCenterLh (float left, float right, float bottom, float top, float near_z, float far_z) noexcept
 Creates an orthographic projection matrix in a left-handed coordinate system. More...
 
static SimdMatrix OrthographicOffCenterRh (float left, float right, float bottom, float top, float near_z, float far_z) noexcept
 Creates an orthographic projection matrix in a right-handed coordinate system. More...
 
static SimdMatrix Shadow (SimdPlaneArg shadow_plane, SimdVector light_pos) noexcept
 Creates a matrix that projects from light_pos to shadow_plane. More...
 
static SimdMatrix Reflect (SimdPlaneArg reflection_plane) noexcept
 Creates a matrix to reflect a vector from the plane reflection_plane. More...
 
static void Decompose (SimdVector *scale, SimdMatrix *rot, SimdVector *trans, SimdMatrixArg m) noexcept
 Decomposes a matrix into its scale, rotation, and translation matrices. More...
 
Loading From Memory
static SimdMatrix LoadFloat4x4 (const Float4x4 *p) noexcept
 Loads a 4x4 matrix from memory.
 
static SimdMatrix LoadFloat3x4 (const Float3x4 *p) noexcept
 Loads a 3x4 matrix from memory.
 
static SimdMatrix LoadFloat4x3 (const Float4x3 *p) noexcept
 Loads a 4x3 matrix from memory.
 
static SimdMatrix LoadFloat3x3 (const Float3x3 *p) noexcept
 Loads a 3x3 matrix from memory.
 
Storing to Memory
static void StoreFloat4x4 (Float4x4 *p, SimdMatrixArg m) noexcept
 Writes a 4x4 matrix to memory.
 
static void StoreFloat3x4 (Float3x4 *p, SimdMatrixArg m) noexcept
 Transposes a matrix and writes the top three rows to memory.
 
static void StoreFloat4x3 (Float4x3 *p, SimdMatrixArg m) noexcept
 Writes a 4x3 matrix to memory.
 
static void StoreFloat3x3 (Float3x3 *p, SimdMatrixArg m) noexcept
 Writes a 3x3 matrix to memory.
 

Detailed Description

The class with the collection of functions that handle 4x4 matrices.

Description
All members of this class are static functions. The class cannot be instantiated.

Definition at line 15 of file SimdMatrix.h.

Member Function Documentation

§ Decompose()

nn::nlib::simd::Matrix::Decompose ( SimdVector scale,
SimdMatrix rot,
SimdVector trans,
SimdMatrixArg  m 
)
staticnoexcept

Decomposes a matrix into its scale, rotation, and translation matrices.

Parameters
[out]scalePointer to where the scale is stored.
[out]rotPointer to where the rotation is stored.
[out]transPointer to where the translation is stored.
[in]mThe 4x4 matrix to decompose.
Store values of 0 or larger for each scale.

§ Determinant()

nn::nlib::simd::Matrix::Determinant ( SimdMatrixArg  m)
staticnoexcept

Calculates the determinant.

Parameters
[in]mA 4x4 matrix.
Returns
The determinant is stored in each lane.

§ FromRotationAxisAndSinCos()

nn::nlib::simd::Matrix::FromRotationAxisAndSinCos ( SimdVectorArg  axis_normalized,
float  sin_value,
float  cos_value 
)
staticnoexcept

Calculates a rotation matrix from the axis and the sin/cos of the angle of rotation.

Parameters
[in]axis_normalizedA normalized 3D rotation axis vector.
[in]sin_valuePasses sin(rad), where rad is the angle of rotation.
[in]cos_valuePasses cos(rad), where rad is the angle of rotation.
Returns
A rotation matrix.

§ FromRotationQuaternion()

nn::nlib::simd::Matrix::FromRotationQuaternion ( SimdQuaternionArg  quat)
staticnoexcept

Calculates a rotation matrix from a quaternion.

Parameters
[in]quatA quaternion (x, y, z, w).
Returns
A rotation matrix.

§ FromRotationX()

nn::nlib::simd::Matrix::FromRotationX ( float  sin_value,
float  cos_value 
)
staticnoexcept

Creates a matrix rotated around the x-axis.

Parameters
[in]sin_valuesin(rad), where rad is the angle of rotation.
[in]cos_valuecos(rad), where rad is the angle of rotation.
Returns
A rotation matrix.

§ FromRotationY()

nn::nlib::simd::Matrix::FromRotationY ( float  sin_value,
float  cos_value 
)
staticnoexcept

Creates a matrix rotated around the y-axis.

Parameters
[in]sin_valuesin(rad), where rad is the angle of rotation.
[in]cos_valuecos(rad), where rad is the angle of rotation.
Returns
A rotation matrix.

§ FromRotationZ()

nn::nlib::simd::Matrix::FromRotationZ ( float  sin_value,
float  cos_value 
)
staticnoexcept

Creates a matrix rotated around the z-axis.

Parameters
[in]sin_valuesin(rad), where rad is the angle of rotation.
[in]cos_valuecos(rad), where rad is the angle of rotation.
Returns
A rotation matrix.

§ FromRotationZXY()

nn::nlib::simd::Matrix::FromRotationZXY ( SimdVectorArg  sin_xyz,
SimdVectorArg  cos_xyz 
)
staticnoexcept

Calculates a rotation matrix from the sin/cos of the angle of rotation around each of the ZXY axes.

Parameters
[in]sin_xyzA three-dimensional vector(sin(rad_x), sin(rad_y), sin(rad_z)).
[in]cos_xyzA three-dimensional vector(cos(rad_x), cos(rad_y), cos(rad_z)).
Returns
A rotation matrix.

§ FromScaling() [1/2]

nn::nlib::simd::Matrix::FromScaling ( float  scale_x,
float  scale_y,
float  scale_z 
)
staticnoexcept

Creates a scaling matrix.

Parameters
[in]scale_xThe scaling along the x-axis.
[in]scale_yThe scaling along the y-axis.
[in]scale_zThe scaling along the z-axis.
Returns
A scaling matrix.

§ FromScaling() [2/2]

nn::nlib::simd::Matrix::FromScaling ( SimdVectorArg  scale)
staticnoexcept

Creates a scaling matrix.

Parameters
[in]scaleThe three-dimensional vector storing the scaling along the x-axis, y-axis, and z-axis.
Returns
A scaling matrix.

§ FromTranslation() [1/2]

nn::nlib::simd::Matrix::FromTranslation ( float  ofs_x,
float  ofs_y,
float  ofs_z 
)
staticnoexcept

Creates a translation matrix.

Parameters
[in]ofs_xThe translation along the x-axis.
[in]ofs_yThe translation along the y-axis.
[in]ofs_zThe translation along the z-axis.
Returns
A translation matrix.

§ FromTranslation() [2/2]

nn::nlib::simd::Matrix::FromTranslation ( SimdVectorArg  ofs)
staticnoexcept

Creates a translation matrix.

Parameters
[in]ofsThe three-dimensional vector storing the translation along the x-axis, y-axis, and z-axis.
Returns
A translation matrix.

§ Inverse()

nn::nlib::simd::Matrix::Inverse ( SimdVector det,
SimdMatrixArg  m 
)
staticnoexcept

Calculates the inverse matrix.

Parameters
[in]detStores the determinant, if not NULL.
[in]mA 4x4 matrix.
Returns
Returns the inverse matrix.

§ IsIdentity()

nn::nlib::simd::Matrix::IsIdentity ( SimdMatrixArg  m)
staticnoexcept

Determines whether a matrix is an identity matrix.

Parameters
[in]mA 4x4 matrix.
Returns
Returns true if the matrix is an identity matrix, and false otherwise.

§ IsInfinite()

nn::nlib::simd::Matrix::IsInfinite ( SimdMatrixArg  m)
staticnoexcept

Determines whether matrix m has any infinite elements.

Parameters
[in]mA 4x4 matrix.
Returns
Returns true if m has any elements that are infinite, and false otherwise.

§ IsNaN()

nn::nlib::simd::Matrix::IsNaN ( SimdMatrixArg  m)
staticnoexcept

Determines whether matrix m has any non-numeric elements.

Parameters
[in]mA 4x4 matrix.
Returns
Returns true if m has any non-numeric elements, and false otherwise.

§ LookAtLh()

nn::nlib::simd::Matrix::LookAtLh ( SimdVectorArg  eye_pos,
SimdVectorArg  at_pos,
SimdVectorArg  up_dir_normalized 
)
staticnoexcept

Creates a camera matrix in a left-handed coordinate system from the camera position, the focal point, and the up direction.

Parameters
[in]eye_posThe camera position.
[in]at_posThe focal point.
[in]up_dir_normalizedThe normalized up direction.
Returns
A matrix converted from world coordinates into camera coordinates.

§ LookAtRh()

nn::nlib::simd::Matrix::LookAtRh ( SimdVectorArg  eye_pos,
SimdVectorArg  at_pos,
SimdVectorArg  up_dir_normalized 
)
staticnoexcept

Creates a camera matrix in a right-handed coordinate system from the camera position, the focal point, and the up direction.

Parameters
[in]eye_posThe camera position.
[in]at_posThe focal point.
[in]up_dir_normalizedThe normalized up direction.
Returns
A matrix converted from world coordinates into camera coordinates.

§ LookToLh()

nn::nlib::simd::Matrix::LookToLh ( SimdVectorArg  eye_pos,
SimdVectorArg  eye_dir_normalized,
SimdVectorArg  up_dir_normalized 
)
staticnoexcept

Creates a camera matrix in a left-handed coordinate system from the camera position, the camera direction, and the up direction.

Parameters
[in]eye_posThe camera position.
[in]eye_dir_normalizedThe normalized camera direction.
[in]up_dir_normalizedThe normalized up direction.
Returns
A matrix converted from world coordinates into camera coordinates.

§ LookToRh()

nn::nlib::simd::Matrix::LookToRh ( SimdVectorArg  eye_pos,
SimdVectorArg  eye_dir_normalized,
SimdVectorArg  up_dir_normalized 
)
staticnoexcept

Creates a camera matrix in a right-handed coordinate system from the camera position, the camera direction, and the up direction.

Parameters
[in]eye_posThe camera position.
[in]eye_dir_normalizedThe normalized camera direction.
[in]up_dir_normalizedThe normalized up direction.
Returns
A matrix converted from world coordinates into camera coordinates.

§ Mult()

nn::nlib::simd::Matrix::Mult ( SimdMatrixArg  a,
SimdMatrixArg  b 
)
staticnoexcept

Multiplies matrices.

Parameters
[in]aA 4x4 matrix.
[in]bA 4x4 matrix.
Returns
The product of a and b.

§ MultTranspose()

nn::nlib::simd::Matrix::MultTranspose ( SimdMatrixArg  a,
SimdMatrixArg  b 
)
staticnoexcept

Calculates the transpose of the product of two matrices.

Parameters
[in]aA 4x4 matrix.
[in]bA 4x4 matrix.
Returns
The transpose of the matrix product of a and b.

§ OrthographicLh()

nn::nlib::simd::Matrix::OrthographicLh ( float  width,
float  height,
float  near_z,
float  far_z 
)
staticnoexcept

Creates an orthographic projection matrix in a left-handed coordinate system.

Parameters
[in]widthThe width of the view frustum.
[in]heightThe height of the view frustum.
[in]near_znear Depth in the near plane.
[in]far_zfar Depth in the far plane.
Returns
An orthographic projection matrix.

§ OrthographicOffCenterLh()

nn::nlib::simd::Matrix::OrthographicOffCenterLh ( float  left,
float  right,
float  bottom,
float  top,
float  near_z,
float  far_z 
)
staticnoexcept

Creates an orthographic projection matrix in a left-handed coordinate system.

Parameters
[in]leftThe x-coordinate on the left side of the view frustum.
[in]rightThe x-coordinate on the right side of the view frustum.
[in]bottomThe y-coordinate at the bottom of the view frustum.
[in]topThe y-coordinate at the top of the view frustum.
[in]near_znear Depth in the near plane.
[in]far_zfar Depth in the far plane.
Returns
An orthographic projection matrix.

§ OrthographicOffCenterRh()

nn::nlib::simd::Matrix::OrthographicOffCenterRh ( float  left,
float  right,
float  bottom,
float  top,
float  near_z,
float  far_z 
)
staticnoexcept

Creates an orthographic projection matrix in a right-handed coordinate system.

Parameters
[in]leftThe x-coordinate on the left side of the view frustum.
[in]rightThe x-coordinate on the right side of the view frustum.
[in]bottomThe y-coordinate at the bottom of the view frustum.
[in]topThe y-coordinate at the top of the view frustum.
[in]near_znear Depth in the near plane.
[in]far_zfar Depth in the far plane.
Returns
An orthographic projection matrix.

§ OrthographicRh()

nn::nlib::simd::Matrix::OrthographicRh ( float  width,
float  height,
float  near_z,
float  far_z 
)
staticnoexcept

Creates an orthographic projection matrix in a right-handed coordinate system.

Parameters
[in]widthThe width of the view frustum.
[in]heightThe height of the view frustum.
[in]near_znear Depth in the near plane.
[in]far_zfar Depth in the far plane.
Returns
An orthographic projection matrix.

§ PerspectiveFovLh()

nn::nlib::simd::Matrix::PerspectiveFovLh ( float  half_fovy_sin,
float  half_fovy_cos,
float  aspect,
float  near_z,
float  far_z 
)
staticnoexcept

Creates a perspective projection matrix in a left-handed coordinate system.

Parameters
[in]half_fovy_sinsin(rad/2), where rad is the screen angle.
[in]half_fovy_coscos(rad/2), where rad is the screen angle.
[in]aspectThe aspect ratio of the display area.
[in]near_znear Depth in the near plane.
[in]far_zfar Depth in the far plane.
Returns
A perspective projection matrix.

§ PerspectiveFovRh()

nn::nlib::simd::Matrix::PerspectiveFovRh ( float  half_fovy_sin,
float  half_fovy_cos,
float  aspect,
float  near_z,
float  far_z 
)
staticnoexcept

Creates a perspective projection matrix in a right-handed coordinate system.

Parameters
[in]half_fovy_sinsin(rad/2), where rad is the screen angle.
[in]half_fovy_coscos(rad/2), where rad is the screen angle.
[in]aspectThe aspect ratio of the display area.
[in]near_znear Depth in the near plane.
[in]far_zfar Depth in the far plane.
Returns
A perspective projection matrix.

§ PerspectiveLh()

nn::nlib::simd::Matrix::PerspectiveLh ( float  width,
float  height,
float  near_z,
float  far_z 
)
staticnoexcept

Creates a perspective projection matrix in a left-handed coordinate system.

Parameters
[in]widthThe width of the view frustum.
[in]heightThe height of the view frustum.
[in]near_znear Depth in the near plane.
[in]far_zfar Depth in the far plane.
Returns
A perspective projection matrix.

§ PerspectiveOffCenterLh()

nn::nlib::simd::Matrix::PerspectiveOffCenterLh ( float  left,
float  right,
float  bottom,
float  top,
float  near_z,
float  far_z 
)
staticnoexcept

Creates a perspective projection matrix in a left-handed coordinate system.

Parameters
[in]leftThe x-coordinate on the left side of the view frustum.
[in]rightThe x-coordinate on the right side of the view frustum.
[in]bottomThe y-coordinate at the bottom of the view frustum.
[in]topThe y-coordinate at the top of the view frustum.
[in]near_znear Depth in the near plane.
[in]far_zfar Depth in the far plane.
Returns
A perspective projection matrix.

§ PerspectiveOffCenterRh()

nn::nlib::simd::Matrix::PerspectiveOffCenterRh ( float  left,
float  right,
float  bottom,
float  top,
float  near_z,
float  far_z 
)
staticnoexcept

Creates a perspective projection matrix in a right-handed coordinate system.

Parameters
[in]leftThe x-coordinate on the left side of the view frustum.
[in]rightThe x-coordinate on the right side of the view frustum.
[in]bottomThe y-coordinate at the bottom of the view frustum.
[in]topThe y-coordinate at the top of the view frustum.
[in]near_znear Depth in the near plane.
[in]far_zfar Depth in the far plane.
Returns
A perspective projection matrix.

§ PerspectiveRh()

nn::nlib::simd::Matrix::PerspectiveRh ( float  width,
float  height,
float  near_z,
float  far_z 
)
staticnoexcept

Creates a perspective projection matrix in a right-handed coordinate system.

Parameters
[in]widthThe width of the view frustum.
[in]heightThe height of the view frustum.
[in]near_znear Depth in the near plane.
[in]far_zfar Depth in the far plane.
Returns
A perspective projection matrix.

§ Reflect()

nn::nlib::simd::Matrix::Reflect ( SimdPlaneArg  reflection_plane)
staticnoexcept

Creates a matrix to reflect a vector from the plane reflection_plane.

Parameters
[in]reflection_planeThe plane that reflects the vector.
Returns
The transform matrix to reflect the vector.

§ Shadow()

nn::nlib::simd::Matrix::Shadow ( SimdPlaneArg  shadow_plane,
SimdVector  light_pos 
)
staticnoexcept

Creates a matrix that projects from light_pos to shadow_plane.

Parameters
[in]shadow_planeThe projection plane.
[in]light_posIf lane 3 (the w element) is 0, the light source is an infinite parallel light. If 1, it is a point light.
Returns
Returns the transform matrix that maps a point on a projection plane.

§ Transpose()

nn::nlib::simd::Matrix::Transpose ( SimdMatrixArg  m)
staticnoexcept

Transposes a matrix.

Parameters
[in]mA 4x4 matrix.
Returns
The transposed matrix of m.

The documentation for this class was generated from the following files: