Adds the scalar value s to this vector's values.
Returns a new Vector with the same .x and .y values as this one.
Calculates the dot product of this vector and v.
equals(v:T):boolean;
0 or 1. If index equals 0 returns the .x value. If index equals 1 returns the .y value.
Computes the Euclidean length (straight-line length) from (0, 0) to (x, y).
Computes the square of the Euclidean length (straight-line length) from (0, 0) to (x, y). If you are comparing the lengths of vectors, you should compare the length squared instead as it is slightly more efficient to calculate.
Inverts this vector - i.e. sets x = -x and y = -y.
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 and .y components of this vector.
0 or 1.
Sets this vector to a vector with the same direction as this one, but .length
Generated using TypeDoc
( interface Vector )
Abstract interface of Vector2, Vector3 and Vector4.
Currently the members of Vector is NOT type safe because it accepts different typed vectors.
Those definitions will be changed when TypeScript innovates Generics to be type safe. See the ngx3js docs page for details.
const v:THREE.Vector = new THREE.Vector3(); v.addVectors(new THREE.Vector2(0, 1), new THREE.Vector2(2, 3)); // invalid but compiled successfully