[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
.[page:Float x]
.[page:Float y]
.[page:Float z]
.[page:Float w]
Methods
.set( [page:Float x], [page:Float y], [page:Float z], [page:Float w] ) [page:Vector4 this]
Sets value of this vector.
.copy( [page:Vector4 v] ) [page:Vector4 this]
Copies value of *v* to this vector.
.add( [page:Vector4 v] ) [page:Vector4 this]
Adds *v* to this vector.
.addVectors( [page:Vector4 a], [page:Vector4 b] ) [page:Vector4 this]
Sets this vector to *a + b*.
.sub( [page:Vector4 v] ) [page:Vector4]
Subtracts *v* from this vector.
.subVectors( [page:Vector4 a], [page:Vector4 b] ) [page:Vector4 this]
Sets this vector to *a - b*.
.multiplyScalar( [page:Float s] ) [page:Vector4 this]
Multiplies this vector by scalar *s*.
.divideScalar( [page:Float s] ) [page:Vector4 this]
Divides this vector by scalar *s*.
Set vector to *( 0, 0, 0 )* if *s == 0*.
.negate() [page:Vector4 this]
Inverts this vector.
.dot( [page:Vector4 v] ) [page:Float]
Computes dot product of this vector and *v*.
.lengthSq() [page:Float]
Computes squared length of this vector.
.length() [page:Float]
Computes length of this vector.
.normalize() [page:Vector4 this]
Normalizes this vector.
.setLength( [page:Float l] ) [page:Vector4 this]
Normalizes this vector and multiplies it by *l*.
.lerp( [page:Vector4 v], [page:Float alpha] ) [page:Vector4 this]
Linearly interpolate between this vector and *v* with *alpha* factor.
.clone() [page:Vector4]
Clones this vector.
.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 replace by the corresponding value.
.applyMatrix4([page:Matrix4 m]) [page:Vector4 this]
m -- [page:Matrix4]
Transforms the vector by the matrix.
.min([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.
.max([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.
.addScalar([page:Float s]) [page:Vector4 this]
s -- [page:Float]
Adds a scalar value to all of the vector's components.
.equals([page:Vector4 v]) [page:Boolean]
v -- [page:Vector4]
Checks to see if this vector matches vector v.
.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
.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
.getComponent([page:Integer index]) [page:Float]
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
.setComponent([page:Integer index], [page:Float value])
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
.fromArray([page:Array array]) [page:Vector4 this]
array -- [page:Array] An array formatted [x, y, z, w]
Sets the vector's components based on an array formatted like [x, y, z, w]
.toArray() [page:Array]
Returns an array in the format [x, y, z, w]
.lengthManhattan() [page:Float]
Computes Manhattan length of this vector.
[link:http://en.wikipedia.org/wiki/Taxicab_geometry]
.setX([page:Float x]) [page:Vector4 this]
x -- [page:Float]
Sets the x component of the vector.
.setY([page:Float y]) [page:Vector4 this]
y -- [page:Float]
Sets the y component of the vector.
.setZ([page:Float z]) [page:Vector4 this]
z -- [page:Float]
Sets the z component of the vector.
.setW([page:Float w]) [page:Vector4 this]
w -- [page:Float]
Sets the w component of the vector.
Source
[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]