Vector3
3D vector.
Example
var a = new THREE.Vector3( 1, 0, 0 ); var b = new THREE.Vector3( 0, 1, 0 ); var c = new THREE.Vector3(); c.crossVectors( a, b );
Constructor
Vector3( x, y, z )
x --
Float the vector's x value
y --
Float the vector's y value
z --
Float the vector's z value
A 3 dimensional vector
Properties
Methods
Sets value of this vector.
Sets x value of this vector.
Sets y value of this vector.
Sets z value of this vector.
Copies value of v to this vector.
array -- The source array in the form [x, y, z].
offset -- An optional offset into the array.
Sets the vector's components based on an array formatted like [x, y, z]
Adds v to this vector.
Sets this vector to a + b.
Adds the multiple of v and s to this vector.
Subtracts v from this vector.
Sets this vector to a - b.
Multiplies this vector by scalar s.
Divides this vector by scalar s.
Set vector to ( 0, 0, 0 ) if s == 0.
Inverts this vector.
Computes dot product of this vector and v.
Computes the squared length of this vector.
Computes the length of this vector.
Normalizes this vector. Transforms this Vector into a Unit vector by dividing the vector by its length.
Computes the distance from this vector to v.
Computes the squared distance from this vector to v.
Computes the Manhattan distance from this vector to v.
Normalizes this vector and multiplies it by l.
Sets this vector to cross product of itself and v.
Sets this vector to cross product of a and b.
Sets this vector extracting position from matrix transform.
Sets this vector extracting scale from matrix transform.
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.
min --
Float the minimum value the components will be clamped to
max --
Float the maximum value the components will be clamped to
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.
min --
Float the minimum value the length will be clamped to
max --
Float 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 length is less than the min value, it is replaced by the min value.
The components of the vector are rounded downwards (towards negative infinity) to an integer value.
The components of the vector are rounded upwards (towards positive infinity) to an integer value.
The components of the vector are rounded towards the nearest integer value.
The components of the vector are rounded towards zero (up if negative, down if positive) to an integer value.
Multiplies this vector times a 3 x 3 matrix.
Multiplies this vector by 4 x 3 subset of a Matrix4.
planeNormal --
planeNormal A vector representing a plane normal.
Projects this vector onto a plane by subtracting this vector projected onto the plane's normal from this vector.
Projects this vector onto another vector.
Adds a s to this vector.
Divides this vector by vector v.
If this vector's x, y, or z value is greater than vector v's x, y, or z value, that value is replaced by the corresponding vector v value.
If this vector's x, y, or z value is less than vector v's x, y, or z value, that value is replaced by the corresponding vector v value.
index -- 0, 1, or 2
value --
Float
If index equals 0 the method sets this vector's x value to value
If index equals 1 the method sets this vector's y value to value
If index equals 2 the method sets this vector's z value to value
Transforms the direction of this vector by a matrix (a 3 x 3 subset of a Matrix4) and then normalizes the result.
Sets this vector equal to the result of multiplying vector a by vector b.
Returns the value of the vector component x, y, or z by an index.
Index 0: x
Index 1: y
Index 2: z
axis -- A normalized
Vector3
angle -- An angle in radians
Applies a rotation specified by an axis and an angle to this vector.
Linear Interpolation between this vector and vector v, where alpha is the percent along the line.
Sets this vector to be the vector linearly interpolated between v1 and v2 with alpha factor.
Returns the angle between this vector and vector v in radians.
index -- 0, 1, 2, or 3
matrix --
Matrix4
Sets this vector's x, y, and z equal to the column of the matrix specified by the index.
normal --
Vector3 the normal to the reflecting plane
Reflect incident vector off of plane orthogonal to normal. Normal is assumed to have unit length.
Multiplies this vector by vector v.
Multiplies this vector and m, and divides by perspective.
Applies euler transform to this vector by converting the
Euler object to a
Quaternion and applying.
camera — camera to use in the projection.
Projects the vector with the camera.
camera — camera to use in the projection.
Unprojects the vector with the camera.
Checks for strict equality of this vector and v.
Clones this vector.
array -- An optional array to store the vector to.
offset -- An optional offset into the array.
Assigns this vector's x value to array[0].
Assigns this vector's y value to array[1].
Assigns this vector's z value to array[2].
Returns the created array.
Source
src/math/Vector3.js
Edit