The underlying TypedArray type.
The underlying TypedArray type.
The length in bytes of the array.
Returns the number of vectors in this array.
Clones this array.
Copies an element from one location to another in the array.
Allocates a new underlying array to match the new size, then copy the content of the previous array at the beginning of the new array.
The new size, in number of vectors.
Performs the specified action for each element in an array.
Note that mutating the callback value will not mutate the underlying array. To mutate the underlying array, use the index provided as second argument, then mutate the array with a mutating method, such as setVector:
const array = new Vector3Array(...);
// Add one to each Y value of the array
array.forEach((v, index) => {
// This has no effect on the Vector3Array:
v.setY(v.y + 1);
// Use this pattern instead:
array.setVector(index, new Vector3(v.x, v.y + 1, v.z));
// Or this one
array.setY(index, v.y + 1);
})
A function that accepts up to three arguments. forEach calls the callbackfn function one time for each element in the array.
Gets the vector at the specified index.
Optionaltarget: Vector2Gets the fourth component of the vector at the specified index, or null if the dimension
of this array is less than 4.
Gets the first component of the vector at the specified index.
Gets the second component of the vector at the specified index.
Gets the third component of the vector at the specified index, or null if the dimension
of this array is less than 3.
Pushes a vector at the end of the array, allocating memory if necessary.
Optionalz: numberOptionalw: numberPushes a vector at the end of the array, allocating memory if necessary.
Sets the component of the array at the specified index.
Optionalz: numberOptionalw: numberSets the vector at the specified index.
Returns the Float32Array equivalent of this vector array. Note: if the underlying array is already a Float32Array, this array is returned. Otherwise, a new array is constructed.
Removes unused capacity.
A typed array of three.js Vector2s.