X coordinate of the vector
Y coordinate of the vector
Z coordinate of the vector
Static
NEGATIVE_Negative X-Axis
Static
NEGATIVE_Negative Y-Axis
Static
NEGATIVE_Negative Z-Axis
Static
X_X-Axis
Static
Y_Y-Axis
Static
Z_Z-Axis
Add the specified 3d vector to this vector.
Input a 3d vector
Return this vector
Add the multiple of v and s to this vector.
Input a 3d vector
Input a scalar value
Return this vector
Set this vector to a + b.
Input the first 3d vector
Input the second 3d vector
Return this vector
Return the angle between this vector and vector v in radians.
Input a 3d vector
Return the angle between this vector and vector v in radians.
Apply a rotation specified by an axis and an angle to this vector.
Input a normalized Vector3.
Input an angle in radians.
Return this vector
Multipliy this vector by m
Input a 3*3 matrix
Return this vector
Multiplies this vector (with an implicit 1 in the 4th dimension) by m, and divides by perspective.
Input one 4x4 matrix
Return this vector
Multiply this vector by normal matrix m and normalizes the result.
Input one normal matrix
Return this vector
Apply a quaternion transform to this vector.
Input one quaternion transform
Return this vector
If this vector's x, y or z value is greater than the max vector's x, y or z value, it is replaced by the corresponding value. If this vector's x, y or z value is less than the min vector's x, y or z value, it is replaced by the corresponding value.
Input the minimum x, y and z values.
Input the maximum x, y and z values in the desired range
Return this vector
If this vector's length is greater than the max value, the vector will be scaled down so its length is the max value. If this vector's length is less than the min value, the vector will be scaled up so its length is the min value.
Input the minimum value the length will be clamped to
Input the maximum value the length will be clamped to
Return this vector
If this vector's x, y or z values are greater than the max value, they are replaced by the max value. If this vector's x, y or z values are less than the min value, they are replaced by the min value.
Input the minimum value the components will be clamped to
Input the maximum value the components will be clamped to
Return this vector
Return a new vector3 with the same x, y and z values as this one.
Return a new vector3 with the same x, y and z values as this one.
Copy the values of the passed vector3's x, y and z properties to this vector3.
Input the vector to copy
Return this vector
Set this vector to cross product of itself and v.
Input a 3d vector
Return this vector
Set this vector to cross product of a and b.
Input a 3d vector
Input a 3d vector
Return this vector
Compute the distance from this vector to v.
Input a 3d vector
Return the distance from this vector to v
Compute the squared distance from this vector to v. If you are just comparing the distance with another distance, you should compare the distance squared instead as it is slightly more efficient to calculate.
Input a 3d vector
Return the squared distance from this vector to v
Divide this vector by v.
Input a 3d vector
Return this vector
Calculate the dot product of this vector and v.
Input a 3d vector
Return the dot product of this vector and v
Return true if the components of this vector and v are strictly equal; false otherwise.
Input a 3d vector
Return true if the components of this vector and v are strictly equal; false otherwise.
Set this vector's x value to be array[ offset + 0 ], y value to be array[ offset + 1 ] and z value to be array[ offset + 2 ].
Input the source array.
Optional
offset: number(optional) Input offset into the array. Default is 0.
Return this vector
Return vector component by index - 0, 1 or 2.
Input index value - 0, 1 or 2.
Return vector component with the specified index
Return true if vec is parallel to this vector
Input vector to check parallelism
Return true if vec is parallel to this vector
Compute the square of the Euclidean length (straight-line length) from (0, 0, 0) to (x, y, z). If you are comparing the lengths of vectors, you should compare the length squared instead as it is slightly more efficient to calculate.
Return the square of the Euclidean length
Linearly interpolate between this vector and v, where alpha is the percent distance along the line - alpha = 0 will be this vector, and alpha = 1 will be v.
Input vector to interpolate towards
Input interpolation factor, typically in the closed interval [0, 1]
Return this vector
Set this vector to be the vector linearly interpolated between v1 and v2 where alpha is the percent distance along the line connecting the two vectors - alpha = 0 will be v1, and alpha = 1 will be v2.
Input the starting vector
Input vector to interpolate towards
Input interpolation factor, typically in the closed interval [0, 1].
Return this vector
Compute the Manhattan distance from this vector to v.
Input a 3d vector
Return the Manhattan distance from this vector to v
If this vector's x, y or z value is less than v's x, y or z value, replace that value with the corresponding max value.
Input a 3d vector
Return this vector
If this vector's x, y or z value is greater than v's x, y or z value, replace that value with the corresponding min value.
Input a 3d vector
Return this vector
Multiply this vector by v.
Input a 3d vector
Return this vector
Set this vector equal to a * b, component-wise.
Input a 3d vector
Input a 3d vector
Return this vector
Project this vector onto a plane by subtracting this vector projected onto the plane's normal from this vector.
Input a vector representing a plane normal.
Return this vector
Project this vector onto v.
Input a 3d vector
Return this vector
Reflect this vector off of plane orthogonal to normal. Normal is assumed to have unit length.
Input the normal to the reflecting plane
Return this vector
Set vector component by index - 0, 1 or 2.
Input index value - 0, 1 or 2.
Input value to be set
Return this vector
Set this vector's x, y and z components from index column of matrix.
Input one 3x3 matrix
Input column index
Return this vector
Set this vector's x, y and z components from index column of matrix.
Input one 4x4 matrix
Input column index
Return this vector
Set this vector to the position elements of the transformation matrix m.
Input one 4x4 matrix
Return this vector
Set this vector to the scale elements of the transformation matrix m.
Input one 4x4 matrix
Return this vector
Subtract v from this vector.
Input a 3d vector to subtract
Return this vector
Set this vector to a - b.
Input a 3d vector
Input a 3d vector
Return this vector
Return an array [x, y, z], or copies x, y and z into the provided array.
Optional
array: number[] | Float32Array(optional) Input array to store this vector to. If this is not provided a new array will be created.
Optional
offset: number(optional) Input optional offset into the array.
Return an array [x, y, z], or copies x, y and z into the provided array.
Transforms the direction of this vector by a matrix (the upper left 3 x 3 subset of a m) and then normalizes the result.
Class representing a vector in 3-dimensional space. A 3d vector is an ordered triplet of numbers (labeled x, y, and z).