Static_Forcefully sets the internal values of a mathematical object to match another object's values. This method directly modifies the internal array representation for performance. Performs equality check to avoid unnecessary operations.
Target object to modify
Source object or value to copy from
True if values were changed, false if they were already equal
StaticaddPerforms addition operation on various mathematical types. Supports numbers, vectors, quaternions, and arrays.
Left-hand side operand
Right-hand side operand
Result of the addition operation, type depends on input types
StaticarrayConverts a 4-element array to a Quaternion instance.
Array of 4 numbers representing quaternion components [x, y, z, w]
Quaternion instance created from the array elements
StaticarrayStaticarrayConverts an array of numbers to the appropriate Vector or Matrix type based on array length. Supports conversion to Matrix44, Matrix33, Vector4, Vector3, or Vector2.
Array of numbers to convert
Matrix44, Matrix33, Vector4, Vector3, or Vector2 instance based on array length, or the original element if not an array
StaticcloneCreates a deep clone of mathematical objects (matrices and vectors).
The mathematical object to clone
A cloned instance of the input object, or the original element if it's not a mathematical object
StaticcomponentDetermines the number of components in a vector instance or array.
Vector instance or array to analyze
Number of components (2 for Vector2, 3 for Vector3, 4 for Vector4/Quaternion, array length for arrays, 0 for unsupported types)
StaticdivideDivides various mathematical types by a scalar number. Supports numbers, vectors, quaternions, and arrays.
Mathematical object to divide
Scalar divisor
Result of the scalar division, type depends on input type
StaticgetGets the immutable value class constructor for a given composition type.
The composition type enum value
Constructor function for the corresponding immutable math class, or undefined if not supported
StaticgetGets the mutable value class constructor for a given composition type.
The composition type enum value
Constructor function for the corresponding mutable math class, or undefined if not supported
StaticinitInitializes a mutable mathematical object from a value using a provided Float32Array as storage. This method efficiently reuses memory by using the provided array as the backing store.
Value to initialize from (can be various mathematical types)
Float32Array to use as backing storage
Mutable mathematical object using the provided array as storage
StaticinitInitializes a mathematical object of the same type as the input with a scalar value. For vectors and arrays, all components are set to the scalar value. For quaternions, creates an identity quaternion.
Object used to determine the target type
Scalar value to initialize with
New instance of the same type as objForDetectType initialized with val
StaticisChecks if an array is suitable for quaternion conversion (has 4 elements).
Array to check
True if the array has 4 elements and can be converted to a quaternion
StaticmakeCreates a sub-array with the specified number of components from the beginning of the input array.
Source array to extract elements from
Number of components to extract (1-4)
Sub-array with the specified number of elements, or single element if componentN is 1
StaticmultiplyMultiplies various mathematical types by a scalar number. Supports numbers, vectors, quaternions, and arrays.
Mathematical object to multiply
Scalar multiplier
Result of the scalar multiplication, type depends on input type
StaticpackPacks a normalized 4D vector into a 2D vector using a grid-based encoding scheme. Input values must be in the range [-1, 1] and are converted to [0, 1] internally.
X component of the 4D vector (must be in range [-1, 1])
Y component of the 4D vector (must be in range [-1, 1])
Z component of the 4D vector (must be in range [-1, 1])
W component of the 4D vector (must be in range [-1, 1])
Grid resolution for encoding (determines precision)
Array of 2 values representing the packed vector
StaticsubtractPerforms subtraction operation on various mathematical types. Supports numbers, vectors, quaternions, and arrays.
Left-hand side operand (minuend)
Right-hand side operand (subtrahend)
Result of the subtraction operation, type depends on input types
StaticunUnprojects a window coordinate to world space using the inverse projection-view matrix. Converts 2D screen coordinates with depth to 3D world coordinates.
X coordinate in window space
Y coordinate in window space
Z coordinate (depth) in window space
Inverse of the projection-view matrix
Viewport parameters [x, y, width, height]
Output vector to store the result
The unprojected 3D world position
StaticvectorConverts vector instances to arrays of their component values.
Vector2, Vector3, Vector4, or Quaternion instance
Array representation of the vector components, or the original element if not a vector
Utility class providing various mathematical operations and conversions for vector, matrix, and quaternion types. This class contains static methods for converting between different mathematical representations, performing arithmetic operations, and manipulating mathematical objects.