# [name]

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

### [name]( [page:Float x], [page:Float y], [page:Float z] )

x -- [page:Float] the vector's x value
y -- [page:Float] the vector's y value
z -- [page:Float] the vector's z value
A 3 dimensional vector

## Properties

### [property:Float x]

### [property:Float y]

### [property:Float z]

## Methods

### [method:Vector3 set]( [page:Float x], [page:Float y], [page:Float z] ) [page:Vector3 this]

Sets value of this vector.

### [method:Vector3 setX]( [page:Float x] ) [page:Vector3 this]

Sets x value of this vector.

### [method:Vector3 setY]( [page:Float y] ) [page:Vector3 this]

Sets y value of this vector.

### [method:Vector3 setZ]( [page:Float z] ) [page:Vector3 this]

Sets z value of this vector.

### [method:Vector3 copy]( [page:Vector3 v] ) [page:Vector3 this]

Copies value of *v* to this vector.

### [method:Vector3 fromArray]( [page:Array array], [page:Integer offset] ) [page:Vector3 this]

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]

### [method:Vector3 add]( [page:Vector3 v] ) [page:Vector3 this]

Adds *v* to this vector.

### [method:Vector3 addVectors]( [page:Vector3 a], [page:Vector3 b] ) [page:Vector3 this]

Sets this vector to *a + b*.

### [method:Vector3 addScaledVector]( [page:Vector3 v], [page:Float s] ) [page:Vector3 this]

Adds the multiple of v and s to this vector.

### [method:Vector3 sub]( [page:Vector3 v] ) [page:Vector3 this]

Subtracts *v* from this vector.

### [method:Vector3 subVectors]( [page:Vector3 a], [page:Vector3 b] ) [page:Vector3 this]

Sets this vector to *a - b*.

### [method:Vector3 multiplyScalar]( [page:Float s] ) [page:Vector3 this]

Multiplies this vector by scalar *s*.

### [method:Vector3 divideScalar]( [page:Float s] ) [page:Vector3 this]

Divides this vector by scalar *s*.
Set vector to *( 0, 0, 0 )* if *s == 0*.

### [method:Vector3 negate]() [page:Vector3 this]

Inverts this vector.

### [method:Float dot]( [page:Vector3 v] ) [page:Vector3 this]

Computes dot product of this vector and *v*.

### [method:Float lengthSq]() [page:Vector3 this]

Computes the squared length of this vector.

### [method:Float length]() [page:Vector3 this]

Computes the length of this vector.

### [method:Float lengthManhattan]() [page:Vector3 this]

Computes the Manhattan length of this vector.
[link:http://en.wikipedia.org/wiki/Taxicab_geometry]

### [method:Vector3 normalize]() [page:Vector3 this]

Normalizes this vector. Transforms this Vector into a Unit vector by dividing the vector by its length.

### [method:Float distanceTo]( [page:Vector3 v] )

Computes the distance from this vector to *v*.

### [method:Float distanceToSquared]( [page:Vector3 v] )

Computes the squared distance from this vector to *v*.

### [method:Float distanceToManhattan]( [page:Vector3 v] )

Computes the Manhattan distance from this vector to *v*.

### [method:Vector3 setLength]( [page:Float l] ) [page:Vector3 this]

Normalizes this vector and multiplies it by *l*.

### [method:Vector3 cross]( [page:Vector3 v] ) [page:Vector3 this]

Sets this vector to cross product of itself and *v*.

### [method:Vector3 crossVectors]( [page:Vector3 a], [page:Vector3 b] ) [page:Vector3 this]

Sets this vector to cross product of *a* and *b*.

### [method:Vector3 setFromMatrixPosition]( [page:Matrix4 m] ) [page:Vector3 this]

Sets this vector extracting position from matrix transform.

### [method:Vector3 setFromMatrixScale]( [page:Matrix4 m] ) [page:Vector3 this]

Sets this vector extracting scale from matrix transform.

### [method:Vector3 clamp]( [page:Vector3 min], [page:Vector3 max] ) [page:Vector3 this]

min -- [page:Vector3]
max -- [page:Vector3]
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.

### [method:Vector3 clampScalar]( [page:Float min], [page:Float max] ) [page:Vector3 this]

min -- [page:Float] the minimum value the components will be clamped to
max -- [page: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.

### [method:Vector3 clampLength]( [page:Float min], [page:Float max] ) [page:Vector3 this]

min -- [page:Float] the minimum value the length will be clamped to
max -- [page: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.

### [method:Vector3 floor]() [page:Vector3 this]

The components of the vector are rounded downwards (towards negative infinity) to an integer value.

### [method:Vector3 ceil]() [page:Vector3 this]

The components of the vector are rounded upwards (towards positive infinity) to an integer value.

### [method:Vector3 round]() [page:Vector3 this]

The components of the vector are rounded towards the nearest integer value.

### [method:Vector3 roundToZero]() [page:Vector3 this]

The components of the vector are rounded towards zero (up if negative, down if positive) to an integer value.

### [method:Vector3 applyMatrix3]( [page:Matrix3 m] ) [page:Vector3 this]

m -- [page:Matrix3]
Multiplies this vector times a 3 x 3 matrix.

### [method:Vector3 applyMatrix4]( [page:Matrix3 m] ) [page:Vector3 this]

m -- [page:Matrix4]
Multiplies this vector by 4 x 3 subset of a Matrix4.

### [method:Vector3 projectOnPlane]( [page:Vector3 planeNormal] ) [page:Vector3 this]

planeNormal -- [page:Vector3 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.

### [method:Vector3 projectOnVector]( [page:Vector3] ) [page:Vector3 this]

vector -- [page:Vector3]
Projects this vector onto another vector.

### [method:Vector3 addScalar]( [page:Float] ) [page:Vector3 this]

s -- [page:Float]
Adds a s to this vector.

### [method:Vector3 divide]( [page:Vector3 v] ) [page:Vector3 this]

v -- [page:Vector3]
Divides this vector by vector v.

### [method:Vector3 min]( [page:Vector3 v] ) [page:Vector3 this]

v -- [page:Vector3]
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.

### [method:Vector3 max]( [page:Vector3 v] ) [page:Vector3 this]

v -- [page:Vector3]
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.

### [method:null setComponent]( [page:Integer index], [page:Float value] ) [page:Vector3 this]

index -- 0, 1, or 2
value -- [page: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

### [method:Vector3 transformDirection]( [page:Matrix4 m] ) [page:Vector3 this]

m -- [page:Matrix4]
Transforms the direction of this vector by a matrix (a 3 x 3 subset of a Matrix4) and then normalizes the result.

### [method:Vector3 multiplyVectors]( [page:Vector3 a], [page:Vector3 b] ) [page:Vector3 this]

a -- [page:Vector3]
b -- [page:Vector3]
Sets this vector equal to the result of multiplying vector a by vector b.

### [method:Float getComponent]( [page:Integer index] ) [page:Vector3 this]

index -- [page:Integer] 0, 1, or 2
Returns the value of the vector component x, y, or z by an index.
Index 0: x
Index 1: y
Index 2: z

### [method:Vector3 applyAxisAngle]( [page:Vector3 axis], [page:Float angle] ) [page:Vector3 this]

axis -- A normalized [page:Vector3]
angle -- An angle in radians
Applies a rotation specified by an axis and an angle to this vector.

### [method:Vector3 lerp]( [page:Vector3 v], [page:Float alpha] ) [page:Vector3 this]

v -- [page:Vector3]
alpha -- [page:Float] between 0 and 1.
Linear Interpolation between this vector and vector v, where alpha is the percent along the line.

### [method:Vector3 lerpVectors]( [page:Vector3 v1], [page:Vector3 v2], [page:Float alpha] ) [page:Vector3 this]

v1 -- [page:Vector3]
v2 -- [page:Vector3]
alpha -- [page:Float] between 0 and 1.
Sets this vector to be the vector linearly interpolated between *v1* and *v2* with *alpha* factor.

### [method:Float angleTo]( [page:Vector3 v] ) [page:Vector3 this]

v -- [page:Vector3]
Returns the angle between this vector and vector v in radians.

### [method:Vector3 setFromMatrixColumn]( [page:Integer index], [page:Matrix4 matrix] ) [page:Vector3 this]

index -- 0, 1, 2, or 3
matrix -- [page:Matrix4]
Sets this vector's x, y, and z equal to the column of the matrix specified by the index.

### [method:Vector3 reflect]( [page:Vector3 normal] ) [page:Vector3 this]

normal -- [page:Vector3] the normal to the reflecting plane
Reflect incident vector off of plane orthogonal to normal. Normal is assumed to have unit length.

### [method:Vector3 multiply]( [page:Vector3 v] ) [page:Vector3 this]

v -- [page:Vector3]
Multiplies this vector by vector v.

### [method:Vector3 applyProjection]( [page:Matrix4 m] ) [page:Vector3 this]

m -- [page:Matrix4] projection matrix.
Multiplies this vector and m, and divides by perspective.

### [method:Vector3 applyEuler]( [page:Euler euler] ) [page:Vector3 this]

euler -- [page:Euler]
Applies euler transform to this vector by converting the [page:Euler] object to a [page:Quaternion] and applying.

### [method:Vector3 applyQuaternion]( [page:Quaternion quaternion] ) [page:Vector3 this]

quaternion -- [page:Quaternion]
Applies a [page:Quaternion] transform to this vector.

### [method:Vector3 project]( [page:Camera camera] ) [page:Vector3 this]

[page:Camera camera] — camera to use in the projection.
Projects the vector with the camera.

### [method:Vector3 unproject]( [page:Camera camera] ) [page:Vector3 this]

[page:Camera camera] — camera to use in the projection.
Unprojects the vector with the camera.

### [method:Boolean equals]( [page:Vector3 v] ) [page:Vector3 this]

Checks for strict equality of this vector and *v*.

### [method:Vector3 clone]() [page:Vector3 this]

Clones this vector.

### [method:Array toArray]( [page:Array array], [page:Integer offset] ) [page:Vector3 this]

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

[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]