nn::math Namespace

Description

The namespace of the arithmetic library.

Classes

Matrices
nn::math::MTX22 A 2x2 matrix class.
nn::math::MTX23 A 2x3 matrix class.
nn::math::MTX33 A 3x3 matrix class.
nn::math::MTX34 A 3x4 matrix class.
nn::math::MTX43 A 4x3 matrix class.
nn::math::MTX44 A 4x4 matrix class.
Pseudorandom number generator
nn::math::MersenneTwister A random number generator class using the Mersenne twister.
nn::math::RandomGenerator The class for generating 32-bit random numbers using the linear congruential method.
nn::math::TinyMt A random number generator class using TinyMT.
Quaternions
nn::math::QUAT Quaternion class.
Vectors
nn::math::VEC2 A two-dimensional vector class.
nn::math::VEC3 A three-dimensional vector class.
nn::math::VEC4 A four-dimensional vector class.

Structures

Matrices
nn::math::MTX22_ Structure defining only elements in a 2 x 2 matrix.
nn::math::MTX23_ Structure defining only elements in a 2 x 3 matrix.
nn::math::MTX33_ Structure defining only elements in a 3 x 3 matrix.
nn::math::MTX34_ Structure defining only elements in a 3 x 4 matrix.
nn::math::MTX43_ Structure defining only elements in a 4 x 3 matrix.
nn::math::MTX44_ Structure defining only elements in a 4 x 4 matrix.
Quaternions
nn::math::QUAT_ Structure with members in a quaternion.
Vectors
nn::math::VEC2_ Structure with members in a 2D vector.
nn::math::VEC3_ Structure with members in a 3D vector.
nn::math::VEC4_ Structure with members in a 4D vector.

Enumerated Types

PivotDirection Enumerated type for specifying the rotation matrix to multiply the projection matrix by.

typedef Definitions

Matrices
Matrix22 Alternate name for MTX22.
Matrix23 Alternate name for MTX23.
Matrix33 Alternate name for MTX33.
Matrix34 Alternate name for MTX34.
Matrix43 Alternate name for MTX43.
Matrix44 Alternate name for MTX44.
Quaternions
Quaternion Alternate name for QUAT.
Vectors
Vector2 Alternate name for VEC2.
Vector3 Alternate name for VEC3.
Vector4 Alternate name for VEC4.

Functions

2x2 matrices
MTX22Copy Copies a 2x2 matrix.
MTX22Identity Creates a 2x2 identity matrix.
MTX22IsIdentity Determines whether a matrix is an identity matrix.
MTX22MAdd Multiplies a matrix by a real number and adds a separate matrix to the product.
MTX22Zero Creates a zero matrix.
2x3 matrices
MTX23Add Adds two 2x3 matrices.
MTX23Copy Copies a 2x3 matrix.
MTX23Identity Creates a 2x3 identity matrix.
MTX23IsIdentity Determines whether a matrix is an identity matrix.
MTX23MAdd Multiplies a matrix by a real number and adds a separate matrix to the product.
MTX23Mult Calculates the scalar product of a 2x3 matrix.
MTX23MultTranslate Translates a 2x3 matrix. Post-multiplies the input matrix by the translation matrix.
MTX23RotCenterFIdx Creates a rotation matrix having the specified center of rotation.
MTX23RotFIdx Creates a rotation matrix.
MTX23Sub Subtracts a 2x3 matrix from a 2x3 matrix.
MTX23Translate Creates a translation matrix.
MTX23Zero Creates a zero matrix.
MTX23Scale Scales a 2x3 matrix.
3x3 matrices
MTX33Identity Creates an identity matrix.
MTX33IsIdentity Determines whether a matrix is an identity matrix.
MTX33Zero Creates a zero matrix.
MTX33Copy Copies a 3x3 matrix.
MTX33MAdd Multiplies a matrix by a real number and adds a separate matrix to the product.
MTX33Mult Calculates the product of two 3x3 matrices.
3x4 matrix
MTX34Identity Creates an identity matrix.
MTX34IsIdentity Determines whether a matrix is an identity matrix.
MTX34RotAxisFIdx Creates a rotation matrix for rotating around the specified axis.
MTX34RotXYZTranslateFIdx Produces a matrix that is the result of pre-multiplying a rotation matrix by a translation matrix.
MTX34Sub Calculates the difference of two matrices.
MTX34TextureProjectionFrustum Creates a texture projection matrix based on the viewing frustum.
MTX34TextureProjectionOrtho Creates an orthogonal texture projection matrix.
MTX34TextureProjectionPerspective Creates a texture projection matrix.
MTX34ShadowProjectionFrustum Creates a projection matrix for referencing shadow textures based on the viewing frustum.
MTX34ShadowProjectionOrtho Creates an orthogonal projection matrix for referencing shadow texture.
MTX34ShadowProjectionPerspective Creates a projection matrix for referencing shadow textures.
MTX34Zero Creates a zero matrix.
MTX34Add Calculates the sum of two matrices.
MTX34CameraRotate Sets the camera matrix.
MTX34Copy Copies a matrix.
MTX34Inverse Calculates the inverse of a matrix.
MTX34InvTranspose Calculates the inverse transpose of a matrix.
MTX34LookAt Sets the camera matrix.
MTX34MAdd Multiplies a matrix by a real number and adds a separate matrix to the product.
MTX34Mult Calculates the product of two matrices.
MTX34MultArray Pre-multiplies an array of matrices by another matrix.
MTX34MultScale Scales a matrix. Post-multiplies the input matrix by the scaling vector.
MTX34MultTranslate Translates a matrix. Pre-multiplies the input matrix by the translation vector.
MTX34RotAxisDeg Creates a rotation matrix for rotating around the specified axis.
MTX34RotAxisDegPartially Updates the values of the rotation-related elements in the specified matrix, in terms of rotation around the specified axis.
MTX34RotAxisRad Creates a rotation matrix for rotating around the specified axis.
MTX34RotAxisRadPartially Updates the values of the rotation-related elements in the specified matrix, in terms of rotation around the specified axis.
MTX34RotXYZDeg Creates a rotation matrix.
MTX34RotXYZDegPartially Updates rotation-related elements in the specified matrix.
MTX34RotXYZFIdx Creates a rotation matrix.
MTX34RotXYZRad Creates a rotation matrix.
MTX34RotXYZRadPartially Updates rotation-related elements in the specified matrix.
MTX34Scale Creates a matrix to use for scaling transformations.
MTX34Translate Creates a translation matrix.
MTX34Transpose Creates the transpose of a matrix.
4x3 matrices
MTX43Identity Creates an identity matrix.
MTX43IsIdentity Determines whether a matrix is an identity matrix.
MTX43Sub Calculates the difference of two matrices.
MTX43Zero Creates a zero matrix.
MTX43Add Calculates the sum of two matrices.
MTX43Copy Copies a matrix.
MTX43Mult Calculates the product of two matrices.
MTX43Transpose Gets the transpose of a 4x3 matrix, resulting in a 3x4 matrix.
4x4 matrix
MTX44FrustumPivot Creates a projection matrix that has been multiplied by a screen rotation. Creates a projection matrix based on the viewing frustum at the near clipping plane.
MTX44Identity Creates an identity matrix.
MTX44IsIdentity Determines whether a matrix is an identity matrix.
MTX44OrthoPivot Creates a projection matrix that has been multiplied by a screen rotation. Creates an orthographic projection matrix.
MTX44PerspectivePivotRad Creates a projection matrix that has been multiplied by a screen rotation. Creates a projection matrix based on a field-of-view angle and an aspect ratio.
MTX44RotAxisFIdx Creates a rotation matrix for rotating around the specified axis.
MTX44Sub Calculates the difference of two matrices.
MTX44Zero Creates a zero matrix.
MTX44Add Calculates the sum of two matrices.
MTX44Copy Copies a matrix.
MTX44Frustum Creates a projection matrix based on the viewing frustum at the near clipping plane.

Note: The order of the arguments follows the OpenGL standard.
MTX44Inverse Calculates the inverse of a matrix.
MTX44Mult Calculates the product of two matrices.
MTX44MultArray Pre-multiplies an array of matrices by another matrix.
MTX44MultScale Scales a matrix. Post-multiplies the input matrix by the scaling vector.
MTX44MultTranslate Translates a matrix. Pre-multiplies the input matrix by the translation vector.
MTX44Ortho Creates an orthographic projection matrix.

Note: The order of the arguments follows the OpenGL standard.
MTX44PerspectiveDeg Creates a projection matrix based on a field-of-view angle and an aspect ratio.
MTX44PerspectivePivotDeg Creates a projection matrix based on a field-of-view angle and an aspect ratio.
MTX44PerspectiveRad Creates a projection matrix based on a field-of-view angle and an aspect ratio.
MTX44Pivot Rotates the specified projection matrix in the direction the screen is facing.
MTX44RotAxisDeg Creates a rotation matrix for rotating around the specified axis.
MTX44RotAxisRad Creates a rotation matrix for rotating around the specified axis.
MTX44RotXYZDeg Creates a rotation matrix.
MTX44RotXYZFIdx Creates a rotation matrix.
MTX44RotXYZRad Creates a rotation matrix.
MTX44Scale Creates a matrix to use for scaling transformations.
MTX44Translate Creates a translation matrix.
MTX44Transpose Creates the transpose of a matrix.
Quaternions
QUATAdd Calculates the sum of two quaternions.
QUATDivide Calculates the quotient of two quaternions.
QUATDot Calculates the dot product of two quaternions.
QUATMakeClosest Modifies q so it is on the same side of the hypersphere as qto.
QUATRotAxisRad Configures a quaternion to perform a rotation around an arbitrary axis defined by the (x, y, z) components of axis.
QUATScale Multiplies a quaternion by a real number.
QUATSquad Calculates the spherical cubic interpolation between two quaternions.
QUATSub Calculates the result of quaternion subtraction.
QUATExp Calculates the base of the natural logarithm (the constant e) raised to the power of a quaternion.
QUATInverse Calculates the inverse of a quaternion.
QUATLerp Calculates the linear interpolation between two quaternions.
QUATLogN Calculates the natural logarithm of a quaternion.
QUATMult Calculates the product of two quaternions.
QUATNormalize Normalizes a quaternion.
QUATSlerp Calculates the spherical linear interpolation between two quaternions.
Utilities
MTX22ToMTX23 Copies a 2x2 matrix to a 2x3 matrix.
MTX23ToMTX22 Copies a 2x3 matrix to a 2x2 matrix.
MTX33ToMTX34 Copies a 3x3 matrix to a 3x4 matrix.
MTX34ToMTX33 Copies a 3x4 matrix to a 3x3 matrix.
QUATToMTX34 Creates a rotation matrix from a quaternion.
QUATToMTX34Partially Creates a rotation matrix from a quaternion and applies only the rotation-related elements of the specified matrix.
MTX34ToQUAT Creates a quaternion from a rotation matrix.
VEC2Transform Transforms a two-dimensional vector using a matrix.
VEC3TransformNormal Transforms a vector by using a matrix. The fourth element of the vector is taken as 0 during calculation.
VEC3TransformNormalArray Transforms a vector array by using a matrix. The fourth element of each vector is taken as 0 during calculation.
VEC3TransformCoord Transforms a vector by using a matrix. The fourth element of the vector is taken as 1 during calculation. After calculation, the first, second, and third elements are divided by the fourth element to create a three-dimensional vector that is stored in pOut.
VEC3TransformCoordArray Transforms a vector array by using a matrix. The fourth element of each vector is taken as 1 during calculation. After calculation, the first, second, and third elements in each vector are divided by the fourth element to create three-dimensional vectors that are stored in pOut.
VEC4TransformArray Transforms a vector array by using a matrix.
VEC3Transform Transforms a vector by using a matrix.
VEC3TransformArray Transforms a vector array by using a matrix. The fourth element of each vector is taken as 1 during calculation.
VEC4Transform Transforms a vector by using a matrix.
2D vectors
VEC2IsZero Determines whether a vector is the zero vector.
VEC2Maximize Creates the vector formed by the larger of each component of two input vectors.
VEC2Minimize Creates the vector formed by the smaller of each component of two input vectors.
VEC2Normalize Normalizes a vector.
VEC2SafeNormalize Normalizes a vector. If normalization fails, sets the specified vector.
VEC2Add Calculates the resultant vector that is the result of vector addition.
VEC2DistSq Calculates the square of the distance between two vectors.
VEC2Dot Calculates the dot product of two vectors.
VEC2Len Calculates the vector length.
VEC2LenSq Calculates the square of a vector length.
VEC2Lerp Calculates the linear interpolation between vectors.
VEC2Mult Calculates the product of two vectors.
VEC2Scale Calculates a scalar multiple of a vector.
VEC2Sub Calculates the result of vector subtraction.
3D vectors
VEC3Cross Calculates the cross product of two vectors.
VEC3IsZero Determines whether a vector is the zero vector.
VEC3Maximize Creates the vector formed by the larger of each component of two input vectors.
VEC3Minimize Creates the vector formed by the smaller of each component of two input vectors.
VEC3SafeNormalize Normalizes a vector. If normalization fails, sets the specified vector.
VEC3SquareDist Calculates the square of the distance between two vectors.
VEC3Add Calculates the resultant vector that is the result of vector addition.
VEC3Dist Calculates the distance between two vectors.
VEC3Dot Calculates the dot product of two vectors.
VEC3Len Calculates the vector length.
VEC3Lerp Calculates the linear interpolation between two vectors.
VEC3Mult Calculates the product of two vectors.
VEC3Normalize Normalizes a vector.
VEC3Scale Calculates a scalar multiple of a vector.
VEC3SquareLen Calculates the square of a vector length.
VEC3Sub Calculates the result of vector subtraction.
4D vectors
VEC4Add Calculates the resultant vector that is the result of vector addition.
VEC4DistSq Calculates the square of the distance between two vectors.
VEC4Dot Calculates the dot product of two vectors.
VEC4IsZero Determines whether a vector is the zero vector.
VEC4IsZeroWOne Determines whether a vector is the zero vector in homogeneous coordinates.
VEC4Len Calculates the vector length.
VEC4Maximize Creates the vector formed by the larger of each component of two input vectors.
VEC4Mult Calculates the product of two vectors.
VEC4Normalize Normalizes a vector.
VEC4SafeNormalize Normalizes a vector. If normalization fails, sets the specified vector.
VEC4Minimize Creates the vector formed by the smaller of each component of two input vectors.
VEC4Scale Calculates a scalar multiple of a vector.
VEC4Sub Calculates the result of vector subtraction.
VEC4LenSq Calculates the square of a vector length.
VEC4Lerp Calculates the linear interpolation between two vectors.
Floating-Point Math Functions
U32AsF32 Converts a u32 type into an f32 type without changing the bit array.
FGetExpPart Gets the exponential part of a floating-point number.
FGetMantPart Finds the mantissa of a floating-point number.
FSelect Selects a value depending on the sign of the input.
FAbs Finds an absolute value.
FNAbs Finds the number whose sign is negative but whose absolute value is the same as the input.
FCopySign Copies the sign of one number to another number.
FExp Finds e^x.
FLog Finds the natural logarithm.
FLog10 Finds the common logarithm.
FMod Calculates the remainder.
FModf Breaks up a floating-point value into an integer part and a fractional part. The integer and fractional parts both have the same sign as x.
FCeil Finds the smallest integer value no smaller than x.
FFloor Finds the largest integer value no larger than x.
F32ToS16 Converts values in f32 format to s16 format.
F32ToU16 Converts values in f32 format to u16 format.
U16ToF32 Converts values in u16 format to f32 format.
S16ToF32 Converts values in s16 format to f32 format.
FInv Finds the multiplicative inverse at high speed and low precision.
FrSqrt Finds the inverse square root.
FSqrt Finds the square root.
FCbrt Finds the cube root.
Hermite Performs Hermite interpolation.
Integer Math Functions
CntLz Counts the number of consecutive bits set to 0, starting from the most significant bit (MSB).
IsPwr2 Determines whether an integer is a power of 2.
Rightmost1 Gets the rightmost bit (closest to the LSB) that is set to 1.
Rightmost0 Gets the rightmost bit (closest to the LSB) that is set to 0.
DistBit Calculates the hamming distance between two bit arrays.
CntTz Counts the number of consecutive bits set to 0, starting from the least significant bit (LSB).
ILog2 Calculates the base 2 logarithm of an integer and returns the result as an integer.
FloorPwr2 Calculates the highest power of 2 that is less than or equal to the integer provided.
CeilPwr2 Calculates the lowest power of 2 that is greater than or equal to the integer provided.
Trigonometric Functions
SinFIdx Finds the sine.
CosFIdx Finds the cosine.
SinCosFIdx Finds the sine and cosine.
TanFIdx Finds the tangent.
SinRad Finds the sine.
CosRad Finds the cosine.
SinCosRad Finds the sine and cosine.
TanRad Finds the tangent.
SinDeg Finds the sine.
CosDeg Finds the cosine.
SinCosDeg Finds the sine and cosine.
TanDeg Finds the tangent.
SinIdx Finds the sine.
CosIdx Finds the cosine.
SinCosIdx Finds the sine and cosine.
TanIdx Finds the tangent.
NN_fAcos Finds the inverse cosine (arccosine). In contrast with AcosRad, no warning message is displayed.
NN_fAsin Finds the inverse sine (arcsine). In contrast with AsinRad, no warning message is displayed.
NN_fAtan Finds the inverse tangent (arctangent).
NN_fAtan2 Finds the inverse tangent (also known as the arctangent).
AsinFIdx Finds the inverse sine (also known as the arcsine).
AcosFIdx Finds the inverse cosine (also known as the arccosine).
AtanFIdx Finds the arctangent by table lookup.
Atan2FIdx Finds the inverse tangent (also known as the arctangent).
AsinRad Finds the inverse sine (also known as the arcsine). In contrast with NN_fAsin, a warning is displayed depending on the arguments that are used.
AcosRad Finds the inverse cosine (also known as the arccosine). In contrast with NN_Acos, a warning is displayed depending on the arguments that are used.
AtanRad Finds the arctangent by table lookup.
Atan2Rad Finds the inverse tangent (also known as the arctangent).
AsinDeg Finds the inverse sine (also known as the arcsine).
AcosDeg Finds the inverse cosine (also known as the arccosine).
AtanDeg Finds the inverse tangent (also known as the arctangent).
Atan2Deg Finds the inverse tangent (also known as the arctangent).
AsinIdx Finds the inverse sine (also known as the arcsine).
AcosIdx Finds the inverse cosine (also known as the arccosine).
AtanIdx Finds the inverse tangent (also known as the arctangent).
Atan2Idx Finds the inverse tangent (also known as the arctangent).
Math Functions
Abs Finds the absolute value.
Max Finds the maximum value.
Min Finds the minimum value.
Clamp Clamps a value to the specified range.
RoundUp Rounds a value up so it is a multiple of the specified value.
RoundDown Rounds a value down so it is a multiple of the specified value.
DivUp Finds the quotient of a division operation that takes two values. The remainder is rounded up.
Bit Operations
ExtractBits Extracts the bitstring used to maintain the position.
GetBits Gets a bit string.
MakeBits Formats a bit string.

Revision History

2010/01/07
Initial version.

CONFIDENTIAL