[name]
4D vector.
Constructor
[name]( [page:Float x], [page:Float y], [page:Float z], [page:Float w] )
x -- [page:Float]
y -- [page:Float]
z -- [page:Float]
w -- [page:Float]
Properties
[property:Float x]
[property:Float y]
[property:Float z]
[property:Float w]
Methods
[method:Vector4 set]( [page:Float x], [page:Float y], [page:Float z], [page:Float w] ) [page:Vector4 this]
Sets value of this vector.
[method:Vector4 setX]( [page:Float x] ) [page:Vector4 this]
x -- [page:Float]
Sets the x component of the vector.
[method:Vector4 setY]( [page:Float y] ) [page:Vector4 this]
y -- [page:Float]
Sets the y component of the vector.
[method:Vector4 setZ]( [page:Float z] ) [page:Vector4 this]
z -- [page:Float]
Sets the z component of the vector.
[method:Vector4 setW]( [page:Float w] ) [page:Vector4 this]
w -- [page:Float]
Sets the w component of the vector.
[method:Vector4 copy]( [page:Vector4 v] ) [page:Vector4 this]
Copies value of *v* to this vector.
[method:Vector4 fromArray]( [page:Array array] ) [page:Vector4 this]
array -- The source array in the form [x, y, z, w].
offset -- An optional offset into the array.
Sets the vector's components based on an array formatted like [x, y, z, w]
[method:Vector4 add]( [page:Vector4 v] ) [page:Vector4 this]
Adds *v* to this vector.
[method:Vector4 addVectors]( [page:Vector4 a], [page:Vector4 b] ) [page:Vector4 this]
Sets this vector to *a + b*.
[method:Vector4 addScaledVector]( [page:Vector4 v], [page:Float s] ) [page:Vector4 this]
Adds the multiple of v and s to this vector.
[method:Vector4 sub]( [page:Vector4 v] ) [page:Vector4 this]
Subtracts *v* from this vector.
[method:Vector4 subVectors]( [page:Vector4 a], [page:Vector4 b] ) [page:Vector4 this]
Sets this vector to *a - b*.
[method:Vector4 multiplyScalar]( [page:Float s] ) [page:Vector4 this]
Multiplies this vector by scalar *s*.
[method:Vector4 divideScalar]( [page:Float s] ) [page:Vector4 this]
Divides this vector by scalar *s*.
Set vector to *( 0, 0, 0 )* if *s == 0*.
[method:Vector4 negate]() [page:Vector4 this]
Inverts this vector.
[method:Float dot]( [page:Vector4 v] ) [page:Vector4 this]
Computes dot product of this vector and *v*.
[method:Float lengthSq]() [page:Vector4 this]
Computes the squared length of this vector.
[method:Float length]() [page:Vector4 this]
Computes the length of this vector.
[method:Float lengthManhattan]() [page:Vector4 this]
Computes the Manhattan length of this vector.
[link:http://en.wikipedia.org/wiki/Taxicab_geometry]
[method:Vector4 normalize]() [page:Vector4 this]
Normalizes this vector.
[method:Vector4 setLength]( [page:Float l] ) [page:Vector4 this]
Normalizes this vector and multiplies it by *l*.
[method:Vector4 lerp]( [page:Vector4 v], [page:Float alpha] ) [page:Vector4 this]
Linearly interpolate between this vector and *v* with *alpha* factor.
[method:Vector4 lerpVectors]( [page:Vector4 v1], [page:Vector4 v2], [page:Float alpha] ) [page:Vector4 this]
Sets this vector to be the vector linearly interpolated between *v1* and *v2* with *alpha* factor.
[method:Vector4 clamp]( [page:Vector4 min], [page:Vector4 max] ) [page:Vector4 this]
min -- [page:Vector4]
max -- [page:Vector4]
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 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.
[method:Vector4 clampScalar]( [page:Float min], [page:Float max] ) [page:Vector4 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, z or w values are greater than the max value, they are 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.
[method:Vector4 floor]() [page:Vector4 this]
The components of the vector are rounded downwards (towards negative infinity) to an integer value.
[method:Vector4 ceil]() [page:Vector4 this]
The components of the vector are rounded upwards (towards positive infinity) to an integer value.
[method:Vector4 round]() [page:Vector4 this]
The components of the vector are rounded towards the nearest integer value.
[method:Vector4 roundToZero]() [page:Vector4 this]
The components of the vector are rounded towards zero (up if negative, down if positive) to an integer value.
[method:Vector4 applyMatrix4]( [page:Matrix4 m] ) [page:Vector4 this]
m -- [page:Matrix4]
Transforms the vector by the matrix.
[method:Vector4 min]( [page:Vector4 v] ) [page:Vector4 this]
v -- [page:Vector4]
If this vector's x, y, z, or w value is greater than vector v's x, y, z, or w value, that value is replaced by the corresponding vector v value.
[method:Vector4 max]( [page:Vector4 v] ) [page:Vector4 this]
v -- [page:Vector4]
If this vector's x, y, z, or w value is less than vector v's x, y, z, or w value, that value is replaced by the corresponding vector v value.
[method:Vector4 addScalar]( [page:Float s] ) [page:Vector4 this]
s -- [page:Float]
Adds a scalar value to all of the vector's components.
[method:Boolean equals]( [page:Vector4 v] ) [page:Vector4 this]
v -- [page:Vector4]
Checks to see if this vector matches vector v.
[method:Vector4 setAxisAngleFromRotationMatrix]( [page:Matrix4 m] ) [page:Vector4 this]
m -- [page:Matrix4]
Sets this Vector4 to the computed
axis-angle representation of the rotation defined by Matrix4 m. Assumes the upper 3x3 of m is a pure rotation matrix (i.e, unscaled).
The axis is stored in components (x, y, z) of the vector, and the rotation in radians is stored in component w
[method:Vector4 setAxisAngleFromQuaternion]( [page:Quaternion q] ) [page:Vector4 this]
q -- [page:Quaternion]
Sets this Vector4 to the computed
axis-angle representation of the rotation defined by Quaternion q.
The axis is stored in components (x, y, z) of the vector, and the rotation in radians is stored in component w
[method:Float getComponent]( [page:Integer index] ) [page:Vector4 this]
index -- [page:Integer] 0, 1, 2, or 3
Returns the value of the vector component x, y, or z by an index.
Index 0: x
Index 1: y
Index 2: z
Index 3: w
[method:null setComponent]( [page:Integer index], [page:Float value] ) [page:Vector4 this]
index -- [page:Integer] 0 - 3
value -- [page:Float]
Sets the value of the vector component x, y, or z by an index.
Index 0: x
Index 1: y
Index 2: z
Index 3: w
[method:Vector4 clone]() [page:Vector4 this]
Clones this vector.
[method:Array toArray]( [page:Array array], [page:Integer offset] ) [page:Vector4 this]
array -- An optional array to store the vector.
offset -- An optional offset into the array.
Returns an array in the format [x, y, z, w]
Source
[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]