Vector3
A 3D vector: an ordered triplet of numbers (x, y, z).
A 3D vector can represent a point in 3D space, a direction and length in 3D space (the length being the Euclidean distance from (0, 0, 0) to (x, y, z)), or any arbitrary ordered triplet 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) in order.
Constructors
Properties
Functions
Sets this vector to a + b.
Applies the Euler rotation euler to this vector.
Multiplies this vector by the 3x3 matrix m.
Multiplies this vector (with an implicit 1 in the 4th dimension) by m, and divides by perspective.
Multiplies this vector by the normal matrix m and normalizes the result.
Applies the Quaternion q (assumed to have unit length) to this vector.
Clamps this vector's length into [min, max].
Clamps each component into the scalar range [minVal, maxVal].
Returns the distance from this vector to v.
Returns the squared distance from this vector to v.
Divides all components by scalar.
Sets x = array[offset], y = array[offset + 1], z = array[offset + 2].
Returns the component at index (0 = x, 1 = y, 2 = z).
Returns the Manhattan distance from this vector to v.
Returns the Manhattan length of this vector.
Multiplies all components by scalar.
Sets this vector to a * b (component-wise).
Projects this vector onto the plane with normal planeNormal (by subtracting this vector's projection onto the normal). Leaves the vector unchanged when planeNormal is a zero vector.
Projects this vector onto v.
Sets this vector to a uniformly random point on a unit sphere.
Rounds each component toward zero.
Sets the vector components from the RGB components of the color c (x = r, y = g, z = b).
Sets the vector components from the cylindrical coordinates c.
Sets the vector components from the Euler angles e.
Sets the vector components to the position elements of the transformation matrix m.
Sets the vector components to the scale elements of the transformation matrix m.
Sets the vector components from the spherical coordinates s.
Sets this vector to a - b.
Transforms the direction of this vector by the upper-left 3x3 of the 4x4 matrix m, then normalizes the result.