M

object M

A utility class providing various mathematical operations for 3x3 and 4x4 matrices, vectors, and rotations.

Properties

Link copied to clipboard
val PI: Float

The value of PI as a float.

Link copied to clipboard

Conversion factor for radians to degrees.

Link copied to clipboard

Conversion factor for degrees to radians.

Link copied to clipboard

Twice the value of PI as a float.

Functions

Link copied to clipboard

Calculate the absolute difference between two angles in radians. This function handles wrap-around.

Link copied to clipboard

Concatenates two 3x3 matrices.

Link copied to clipboard

Computes the cross product of two 3-dimensional vectors.

Link copied to clipboard

Computes the dot product of two float arrays

fun dot(a: FloatArray, aOffset: Int, aLength: Int, b: FloatArray, bOffset: Int): Float

Computes the dot product of two float arrays with specified offsets and lengths.

Link copied to clipboard

Computes the dot product of two 3-dimensional vectors.

Link copied to clipboard

Calculate Euler angles between two 3x1 vectors

Link copied to clipboard
fun eye2world(eyeVec: FloatArray, q: Quaternion, res: FloatArray)
fun eye2world(xEye: Float, yEye: Float, zEye: Float, q: Quaternion, res: FloatArray)

Transforms eye coordinates to world coordinates using a quaternion.

Link copied to clipboard

Sets the elements of a 3x3 matrix to the identity matrix.

Link copied to clipboard

Sets the elements of a 4x4 matrix to the identity matrix.

Link copied to clipboard

Invert a 4x4 matrix.

Link copied to clipboard

Invert a 3x3 matrix.

Link copied to clipboard
fun lerp31x31(start: FloatArray, end: FloatArray, alpha: Float): FloatArray

Perform linear interpolation between two 3x1 vectors.

Link copied to clipboard
fun lerp31x31v(start: FloatArray, startOffset: Int, end: FloatArray, endOffset: Int, alpha: Float): FloatArray

Performs linear interpolation between two 3x1 vectors.

Link copied to clipboard
fun LLA2world(targetLLA: DoubleArray, userLLA: DoubleArray, res: FloatArray)

Converts latitude, longitude, and altitude to world coordinates.

Link copied to clipboard
fun mul(m: FloatArray, scalar: Float)

Multiplies each element of a float array by a scalar.

Link copied to clipboard

Multiply 3x3 matrices with a vector 3x1.

Link copied to clipboard

Multiply two 3x3 matrices.

Link copied to clipboard

Multiplies a 3x4 matrix by a 4x1 vector.

Link copied to clipboard
fun mul44x31one(m1: FloatArray, v: FloatArray, vOffset: Int, res: FloatArray)

Multiplies a 4x4 matrix by a 3x1 vector.

Link copied to clipboard

Multiplies a 4x4 matrix by a 4x1 matrix (vector).

Link copied to clipboard

Multiply two 4x4 matrices.

Link copied to clipboard

Normalizes a vector (any size).

Link copied to clipboard

Normalizes a 3x1 vector.

Link copied to clipboard

Normalize an angle in radians to the range 0-2pi.

Link copied to clipboard
fun perspective4x4(fovy: Float, aspect: Float, zNear: Float, zFar: Float, res: FloatArray)

Constructs a perspective projection 4x4 matrix.

Link copied to clipboard
fun rotateMat3x3(deg: Float, x: Float, y: Float, res: FloatArray)

Creates a rotate 3x3 matrix.

Link copied to clipboard

Convert rotation from axis-angle representation to Euler angles.

Link copied to clipboard
fun rotMat44(deg: Float, x: Float, y: Float, z: Float, res: FloatArray)

Creates a rotation 4x4 matrix.

Link copied to clipboard
fun scaleMat3x3(sx: Float, sy: Float, x: Float, y: Float, res: FloatArray)

Creates a scale and translation 3x3 matrix.

Link copied to clipboard
fun scaleMat44(sx: Float, sy: Float, sz: Float, res: FloatArray)

Constructs a scale 4x4 matrix.

Link copied to clipboard
fun Slerp31x31(start: FloatArray, end: FloatArray, alpha: Float): FloatArray

Performs spherical linear interpolation between two 3x1 vectors.

Link copied to clipboard
fun Slerp31x31v(start: FloatArray, startOffset: Int, end: FloatArray, endOffset: Int, alpha: Float): FloatArray

Performs spherical linear interpolation between two 3x1 vectors.

Link copied to clipboard

Constructs a translation 3x3 matrix.

Link copied to clipboard
fun translateMat44(tx: Float, ty: Float, tz: Float, res: FloatArray)

Constructs a translation 4x4 matrix.

Link copied to clipboard

Transposes a 3x3 matrix.

Link copied to clipboard

Transposes a 4x4 matrix.

Link copied to clipboard

Calculate the angle between two 3x1 vectors.

Link copied to clipboard
fun world2eye(worldVec: FloatArray, q: Quaternion, outEyeVec: FloatArray)

Transforms world coordinates to eye coordinates using a quaternion.

Link copied to clipboard

Converts a 3x3 matrix to a 4x4 matrix with an additional row and column of zeros, and a one in the bottom-right corner.

Link copied to clipboard

Sets all elements of a float array to zero.