Creates a new Vector4.
The x value of this vector. Default is 0.
The y value of this vector. Default is 0.
The z value of this vector. Default is 0.
The w value of this vector. Default is 1.
Alias for .w.
the w value of this vector. Default is 0.
Alias for .z.
the x value of this vector. Default is 0.
the y value of this vector. Default is 0.
the z value of this vector. Default is 0.
If this vector's x, y, z or w value is less than the min vector's x, y, z or w value, it is replaced by the corresponding value.
The minimum .x, .y, .z and .w values.
The maximum .x, .y, .z and .w values in the desired range If this vector's x, y, z or w value is greater than the max vector's x, y, z or w value, it is replaced by the corresponding value.
If this vector's length is less than the min value, it is replaced by the min value.
The minimum value the length will be clamped to
The maximum value the length will be clamped to If this vector's length is greater than the max value, it is replaced by the max value.
If this vector's x, y, z or w values are less than the min value, they are replaced by the min value.
The minimum value the components will be clamped to
The maximum value the components will be clamped to If this vector's x, y, z or w values are greater than the max value, they are replaced by the max value.
Calculates the dot product of this vector and v.
Sets this vector's .x, .y, .z and .w values from the attribute.
The source attribute.
index in the attribute.
If index equals 0 returns the .x value. If index equals 1 returns the .y value. If index equals 2 returns the .z value. If index equals 3 returns the .w value.
0, 1, 2 or 3.
Computes the Euclidean length (straight-line length) from (0, 0, 0, 0) to (x, y, z, w).
Computes the square of the Euclidean length (straight-line length) from (0, 0, 0, 0) to (x, y, z, w). If you are comparing the lengths of vectors, you should compare the length squared instead as it is slightly more efficient to calculate.
Computes the Manhattan length of this vector.
Converts this vector to a unit vector - that is, sets it equal to a vector with the same direction as this one, but .length 1.
Sets the .x, .y and .z components of this vector to the quaternion's axis and .w to the angle.
A normalized Quaterion
array to store this vector to. If this is not provided, a new array will be created.
optional offset into the array.
Returns an array [x, y, z, w], or copies x, y, z and w into the provided array.
Generated using TypeDoc
Class representing a 4D vector. A 4D vector is an ordered quadruplet of numbers (labeled x, y, z, and w), which can be used to represent a number of things, such as: A point in 4D space. A direction and length in 4D space. In three.js the length will always be the Euclidean distancee (straight-line distance) from (0, 0, 0, 0) to (x, y, z, w) and the direction is also measured from (0, 0, 0, 0) towards (x, y, z, w). Any arbitrary ordered quadruplet of numbers. There are other things a 4D vector can be used to represent, however these are the most common uses in three.js. Iterating through a Vector4 instance will yield its components (x, y, z, w) in the corresponding order. See the ngx3js docs page for details.
Examples
webgl / buffergeometry / instancing | webgl / camera / array | webgl / geometry / nurbs | webgl / postprocessing / godrays | webgl / shadowmesh
Code Example