Vector4
A 4D vector: an ordered quadruplet of numbers (x, y, z, w).
A 4D vector can represent a point in 4D space, a direction and length in 4D space (the length being the Euclidean distance from (0, 0, 0, 0) to (x, y, z, w)), or any arbitrary ordered quadruplet of numbers.
Vectors are mutable and not thread-safe; confine an instance (and any object graph holding it) to a single thread, exactly as in three.js. Most methods mutate this and return it for chaining.
Iterating a vector yields its components (x, y, z, w) in order.
Note: the w component defaults to 1.0 (matching three.js), unlike the other three components which default to 0.0.
Constructors
Functions
Sets this vector to a + b.
Multiplies this vector by the 4x4 matrix m.
Clamps this vector's length into [min, max].
Clamps each component into the scalar range [minVal, maxVal].
Divides all components by scalar.
Sets x = array[offset], y = array[offset + 1], z = array[offset + 2], w = array[offset + 3].
Returns the component at index (0 = x, 1 = y, 2 = z, 3 = w).
Returns the Manhattan length of this vector.
Multiplies all components by scalar.
Rounds each component toward zero.
Sets the x, y and z components of this vector to the quaternion q's axis and w to the angle.
Sets the x, y and z components of this vector to the axis of rotation and w to the angle, from the 4x4 matrix m (whose upper-left 3x3 is assumed to be a pure rotation matrix).
Sets the vector components to the position elements of the transformation matrix m.
Sets this vector to a - b.