|
@@ -10,23 +10,64 @@
|
|
|
<body>
|
|
|
<h1>[name]</h1>
|
|
|
|
|
|
- <div class="desc">4D vector.</div>
|
|
|
+ <div class="desc">Class representing a 4D [link:https://en.wikipedia.org/wiki/Vector_space vector].
|
|
|
|
|
|
+ A 4D vector is an ordered quadruplet of numbers (labeled x, y, z, and w), which can be used to
|
|
|
+ represent a number of things, such as:
|
|
|
|
|
|
- <h2>Constructor</h2>
|
|
|
+ <ul>
|
|
|
+ <li>
|
|
|
+ A point in 4D space.
|
|
|
+ </li>
|
|
|
+ <li>
|
|
|
+ A direction and length in 4D space. In Three the length will always be the
|
|
|
+ [link:https://en.wikipedia.org/wiki/Euclidean_distance Euclidean distance]
|
|
|
+ (straight-line distance) from (0, 0, 0, 0, 0) to (x, y, z, w) and the direction is also
|
|
|
+ measured from (0, 0, 0, 0) towards (x, y, z, w).
|
|
|
+ </li>
|
|
|
+ <li>
|
|
|
+ Any arbitrary ordered quadruplet of numbers.
|
|
|
+ </li>
|
|
|
+ </ul>
|
|
|
+
|
|
|
+ There are other things a 4D vector can be used to represent, however these are the most common uses in Three.
|
|
|
+ </div>
|
|
|
+
|
|
|
+
|
|
|
+ <h2>Example</h2>
|
|
|
+
|
|
|
+ <code>
|
|
|
+ var a = new THREE.Vector4( 0, 1, 0, 0 );
|
|
|
+
|
|
|
+ //no arguments; will be initialised to (0, 0, 0, 1)
|
|
|
+ var b = new THREE.Vector4( );
|
|
|
|
|
|
+ var d = a.distanceTo( b );
|
|
|
+ </code>
|
|
|
+
|
|
|
+
|
|
|
+ <h2>Constructor</h2>
|
|
|
|
|
|
<h3>[name]( [page:Float x], [page:Float y], [page:Float z], [page:Float w] )</h3>
|
|
|
<div>
|
|
|
- x -- [page:Float] <br />
|
|
|
- y -- [page:Float] <br />
|
|
|
- z -- [page:Float] <br />
|
|
|
- w -- [page:Float]
|
|
|
+ [page:Float x] - the x value of the vector. Default is *0*.<br />
|
|
|
+ [page:Float y] - the y value of the vector. Default is *0*.<br />
|
|
|
+ [page:Float z] - the z value of the vector. Default is *0*.<br />
|
|
|
+ [page:Float w] - the w value of the vector. Default is *1*.
|
|
|
+
|
|
|
+ Created a new [name].
|
|
|
</div>
|
|
|
|
|
|
|
|
|
<h2>Properties</h2>
|
|
|
|
|
|
+ <h3>[property:Boolean isVector4]</h3>
|
|
|
+ <div>
|
|
|
+ Used to check whether this or derived classes are Vector4s. Default is *true*.<br /><br />
|
|
|
+
|
|
|
+ You should not change this, as it used internally for optimisation.
|
|
|
+ </div>
|
|
|
+
|
|
|
<h3>[property:Float x]</h3>
|
|
|
|
|
|
<h3>[property:Float y]</h3>
|
|
@@ -38,288 +79,243 @@
|
|
|
|
|
|
<h2>Methods</h2>
|
|
|
|
|
|
- <h3>[method:Vector4 set]( [page:Float x], [page:Float y], [page:Float z], [page:Float w] ) [page:Vector4 this]</h3>
|
|
|
- <div>
|
|
|
- Sets value of this vector.
|
|
|
- </div>
|
|
|
+ <h3>[method:Vector4 add]( [page:Vector4 v] )</h3>
|
|
|
+ <div>Adds [page:Vector4 v] to this vector.</div>
|
|
|
|
|
|
- <h3>[method:Vector4 setX]( [page:Float x] ) [page:Vector4 this]</h3>
|
|
|
- <div>
|
|
|
- x -- [page:Float]
|
|
|
- </div>
|
|
|
- <div>
|
|
|
- Sets the x component of the vector.
|
|
|
- </div>
|
|
|
+ <h3>[method:Vector4 addScalar]( [page:Float s] )</h3>
|
|
|
+ <div>Add the scalar value s to this vector's [page:.x x], [page:.y y], [page:.z z] and [page:.w w] values.</div>
|
|
|
|
|
|
- <h3>[method:Vector4 setY]( [page:Float y] ) [page:Vector4 this]</h3>
|
|
|
- <div>
|
|
|
- y -- [page:Float]
|
|
|
- </div>
|
|
|
- <div>
|
|
|
- Sets the y component of the vector.
|
|
|
- </div>
|
|
|
+ <h3>[method:Vector4 addScaledVector]( [page:Vector4 v], [page:Float s] )</h3>
|
|
|
+ <div>Adds the multiple of [page:Vector4 v] and [page:Float s] to this vector.</div>
|
|
|
|
|
|
- <h3>[method:Vector4 setZ]( [page:Float z] ) [page:Vector4 this]</h3>
|
|
|
- <div>
|
|
|
- z -- [page:Float]
|
|
|
- </div>
|
|
|
- <div>
|
|
|
- Sets the z component of the vector.
|
|
|
- </div>
|
|
|
+ <h3>[method:Vector4 addVectors]( [page:Vector4 a], [page:Vector4 b] )</h3>
|
|
|
+ <div>Sets this vector to [page:Vector4 a] + [page:Vector4 b].</div>
|
|
|
|
|
|
- <h3>[method:Vector4 setW]( [page:Float w] ) [page:Vector4 this]</h3>
|
|
|
- <div>
|
|
|
- w -- [page:Float]
|
|
|
- </div>
|
|
|
+ <h3>[method:Vector4 applyMatrix4]( [page:Matrix4 m] )</h3>
|
|
|
<div>
|
|
|
- Sets the w component of the vector.
|
|
|
+ Multiply this vector by 4 x 4 [page:Matrix4 m].
|
|
|
</div>
|
|
|
|
|
|
- <h3>[method:Vector4 setScalar]( [page:Float scalar] ) [page:Vector4 this]</h3>
|
|
|
+ <h3>[method:Vector4 ceil]()</h3>
|
|
|
<div>
|
|
|
- scalar -- [page:Float]
|
|
|
- </div>
|
|
|
- <div>
|
|
|
- set all component values of this vector to *scalar*.
|
|
|
+ The [page:.x x], [page:.y y], [page:.z z] and [page:.w w] components of the vector are rounded up to the nearest integer value.
|
|
|
</div>
|
|
|
|
|
|
- <h3>[method:Vector4 copy]( [page:Vector4 v] ) [page:Vector4 this]</h3>
|
|
|
+ <h3>[method:Vector4 clamp]( [page:Vector4 min], [page:Vector4 max] )</h3>
|
|
|
<div>
|
|
|
- Copies value of *v* to this vector.
|
|
|
- </div>
|
|
|
+ [page:Vector4 min] - the minimum [page:.x x], [page:.y y], [page:.z z] and [page:.w w] values.<br />
|
|
|
+ [page:Vector4 max] - the maximum [page:.x x], [page:.y y], [page:.z z] and [page:.w w] values in the desired range<br /><br />
|
|
|
|
|
|
- <h3>[method:Vector4 fromArray]( [page:Array array] ) [page:Vector4 this]</h3>
|
|
|
- <div>
|
|
|
- array -- The source array in the form [x, y, z, w]. <br />
|
|
|
- offset -- An optional offset into the array.
|
|
|
- </div>
|
|
|
- <div>
|
|
|
- Sets the vector's components based on an array formatted like [x, y, z, w]
|
|
|
+ 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. <br /><br />
|
|
|
+ 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.
|
|
|
</div>
|
|
|
|
|
|
- <h3>[method:Vector4 add]( [page:Vector4 v] ) [page:Vector4 this]</h3>
|
|
|
+ <h3>[method:Vector4 clampScalar]( [page:Float min], [page:Float max] )</h3>
|
|
|
<div>
|
|
|
- Adds *v* to this vector.
|
|
|
- </div>
|
|
|
+ [page:Float min] - the minimum value the components will be clamped to <br />
|
|
|
+ [page:Float max] - the maximum value the components will be clamped to<br /><br />
|
|
|
|
|
|
- <h3>[method:Vector4 addVectors]( [page:Vector4 a], [page:Vector4 b] ) [page:Vector4 this]</h3>
|
|
|
- <div>
|
|
|
- Sets this vector to *a + b*.
|
|
|
+ If this vector's x, y, z or w values are greater than the max value, they are replaced by the max value. <br /><br />
|
|
|
+ If this vector's x, y, z or w values are less than the min value, they are replaced by the min value.
|
|
|
</div>
|
|
|
|
|
|
- <h3>[method:Vector4 addScaledVector]( [page:Vector4 v], [page:Float s] ) [page:Vector4 this]</h3>
|
|
|
+ <h3>[method:Vector4 clone]()</h3>
|
|
|
<div>
|
|
|
- Adds the multiple of v and s to this vector.
|
|
|
+ Returns a new Vector4 with the same [page:.x x], [page:.y y], [page:.z z] and [page:.w w] values as this one.
|
|
|
</div>
|
|
|
|
|
|
- <h3>[method:Vector4 sub]( [page:Vector4 v] ) [page:Vector4 this]</h3>
|
|
|
+ <h3>[method:Vector4 copy]( [page:Vector4 v] )</h3>
|
|
|
<div>
|
|
|
- Subtracts *v* from this vector.
|
|
|
+ Copies the values of the passed Vector4's [page:.x x], [page:.y y], [page:.z z] and [page:.w w]
|
|
|
+ properties to this Vector4.
|
|
|
</div>
|
|
|
|
|
|
- <h3>[method:Vector4 subVectors]( [page:Vector4 a], [page:Vector4 b] ) [page:Vector4 this]</h3>
|
|
|
+ <h3>[method:Vector4 divideScalar]( [page:Float s] )</h3>
|
|
|
<div>
|
|
|
- Sets this vector to *a - b*.
|
|
|
+ Divides this vector by scalar [page:Float s].<br />
|
|
|
+ Sets vector to *( 0, 0 )* if *[page:Float s] = 0*.
|
|
|
</div>
|
|
|
|
|
|
- <h3>[method:Vector4 multiplyScalar]( [page:Float s] ) [page:Vector4 this]</h3>
|
|
|
+ <h3>[method:Float dot]( [page:Vector4 v] )</h3>
|
|
|
<div>
|
|
|
- Multiplies this vector by scalar *s*.
|
|
|
+ Calculate the [link:https://en.wikipedia.org/wiki/Dot_product dot product] of this
|
|
|
+ vector and [page:Vector4 v].
|
|
|
</div>
|
|
|
|
|
|
- <h3>[method:Vector4 divideScalar]( [page:Float s] ) [page:Vector4 this]</h3>
|
|
|
- <div>
|
|
|
- Divides this vector by scalar *s*.<br />
|
|
|
- Set vector to *( 0, 0, 0 )* if *s == 0*.
|
|
|
- </div>
|
|
|
+ <h3>[method:Boolean equals]( [page:Vector4 v] )</h3>
|
|
|
+ <div>Checks for strict equality of this vector and [page:Vector4 v].</div>
|
|
|
|
|
|
- <h3>[method:Vector4 negate]() [page:Vector4 this]</h3>
|
|
|
- <div>
|
|
|
- Inverts this vector.
|
|
|
- </div>
|
|
|
+ <h3>[method:Vector4 floor]()</h3>
|
|
|
+ <div>The components of the vector are rounded down to the nearest integer value.</div>
|
|
|
|
|
|
- <h3>[method:Float dot]( [page:Vector4 v] ) [page:Vector4 this]</h3>
|
|
|
+ <h3>[method:Vector4 fromArray]( [page:Array array], [page:Integer offset] )</h3>
|
|
|
<div>
|
|
|
- Computes dot product of this vector and *v*.
|
|
|
- </div>
|
|
|
+ [page:Array array] - the source array.<br />
|
|
|
+ [page:Integer offset] - ( optional) offset into the array. Default is 0.<br /><br />
|
|
|
|
|
|
- <h3>[method:Float lengthSq]() [page:Vector4 this]</h3>
|
|
|
- <div>
|
|
|
- Computes the squared length of this vector.
|
|
|
+ Sets this vector's [page:.x x] value to be array[ offset + 0 ], [page:.y y] value to be array[ offset + 1 ]
|
|
|
+ [page:.z z] value to be array[ offset + 2 ] and [page:.w w ] value to be array[ offset + 3 ].
|
|
|
</div>
|
|
|
|
|
|
- <h3>[method:Float length]() [page:Vector4 this]</h3>
|
|
|
+ <h3>[method:Vector4 fromAttribute]( [page:BufferAttribute attribute], [page:Integer index], [page:Integer offset] )</h3>
|
|
|
<div>
|
|
|
- Computes the length of this vector.
|
|
|
+ [page:BufferAttribute attribute] - the source attribute.<br />
|
|
|
+ [page:Integer index] - index in the attribute.<br /><br />
|
|
|
+ [page:Integer offset] - (optional) offset into the attribute. Default is 0.<br /><br />
|
|
|
+
|
|
|
+ Sets this vector's [page:.x x], [page:.y y], [page:.z z] and [page:.w w] values from the [page:BufferAttribute attribute].
|
|
|
</div>
|
|
|
|
|
|
- <h3>[method:Float lengthManhattan]() [page:Vector4 this]</h3>
|
|
|
+ <h3>[method:Float getComponent]( [page:Integer index] )</h3>
|
|
|
<div>
|
|
|
- Computes the Manhattan length of this vector.<br />
|
|
|
- [link:http://en.wikipedia.org/wiki/Taxicab_geometry]
|
|
|
+ [page:Integer index] - 0, 1 or 2.<br /><br />
|
|
|
+
|
|
|
+ If index equals 0 returns the [page:.x x] value. <br />
|
|
|
+ If index equals 1 returns the [page:.y y] value. <br />
|
|
|
+ If index equals 2 returns the [page:.z z] value.<br />
|
|
|
+ If index equals 3 returns the [page:.w w] value.
|
|
|
</div>
|
|
|
|
|
|
- <h3>[method:Vector4 normalize]() [page:Vector4 this]</h3>
|
|
|
+ <h3>[method:Float length]()</h3>
|
|
|
+ <div>Computes the [link:https://en.wikipedia.org/wiki/Euclidean_distance Euclidean length]
|
|
|
+ (straight-line length) from (0, 0, 0, 0) to (x, y, z, w).</div>
|
|
|
+
|
|
|
+ <h3>[method:Float lengthManhattan]()</h3>
|
|
|
<div>
|
|
|
- Normalizes this vector.
|
|
|
+ Computes the [link:http://en.wikipedia.org/wiki/Taxicab_geometry Manhattan length] of this vector.
|
|
|
</div>
|
|
|
|
|
|
- <h3>[method:Vector4 setLength]( [page:Float l] ) [page:Vector4 this]</h3>
|
|
|
+ <h3>[method:Float lengthSq]()</h3>
|
|
|
<div>
|
|
|
- Normalizes this vector and multiplies it by *l*.
|
|
|
+ Computes the square of the [link:https://en.wikipedia.org/wiki/Euclidean_distance Euclidean length]
|
|
|
+ (straight-line length) from (0, 0, 0, 0) to (x, y, z, w). If you are comparing the lengths of
|
|
|
+ vectors, you should compare the length squared instead as it is slightly more efficient to calculate.
|
|
|
</div>
|
|
|
|
|
|
- <h3>[method:Vector4 lerp]( [page:Vector4 v], [page:Float alpha] ) [page:Vector4 this]</h3>
|
|
|
+ <h3>[method:Vector4 lerp]( [page:Vector4 v], [page:Float alpha] )</h3>
|
|
|
<div>
|
|
|
- Linearly interpolate between this vector and *v* with *alpha* factor.
|
|
|
+ [page:Vector4 v] - [page:Vector4] to interpolate towards.<br />
|
|
|
+ alpha - [page:Float] between 0 and 1<br /><br />
|
|
|
+
|
|
|
+ Linearly interpolate between this vector and [page:Vector4 v], where alpha is the
|
|
|
+ distance along the line - alpha = 0 will be this vector, and alpha = 1 will be [page:Vector4 v].
|
|
|
</div>
|
|
|
|
|
|
- <h3>[method:Vector4 lerpVectors]( [page:Vector4 v1], [page:Vector4 v2], [page:Float alpha] ) [page:Vector4 this]</h3>
|
|
|
+ <h3>[method:Vector4 lerpVectors]( [page:Vector4 v1], [page:Vector4 v2], [page:Float alpha] )</h3>
|
|
|
<div>
|
|
|
- Sets this vector to be the vector linearly interpolated between *v1* and *v2* with *alpha* factor.
|
|
|
+ [page:Vector4 v1] - the starting [page:Vector4].<br />
|
|
|
+ [page:Vector4 v2] - [page:Vector4] to interpolate towards.<br />
|
|
|
+ [page:Float alpha] - number between 0 and 1.<br /><br />
|
|
|
+
|
|
|
+ Sets this vector to be the vector linearly interpolated between [page:Vector4 v1] and
|
|
|
+ [page:Vector4 v2] where alpha is the distance along the line connecting the two vectors
|
|
|
+ - alpha = 0 will be [page:Vector4 v1], and alpha = 1 will be [page:Vector4 v2].
|
|
|
</div>
|
|
|
|
|
|
+ <h3>[method:Vector4 negate]()</h3>
|
|
|
+ <div>Inverts this vector - i.e. sets x = -x, y = -y, z = -z and w = -w.</div>
|
|
|
|
|
|
- <h3>[method:Vector4 clamp]( [page:Vector4 min], [page:Vector4 max] ) [page:Vector4 this]</h3>
|
|
|
+ <h3>[method:Vector4 normalize]()</h3>
|
|
|
<div>
|
|
|
- min -- [page:Vector4] <br />
|
|
|
- max -- [page:Vector4]
|
|
|
- </div>
|
|
|
- <div>
|
|
|
- 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.<br/><br/>
|
|
|
- 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.
|
|
|
+ Convert this vector to a [link:https://en.wikipedia.org/wiki/Unit_vector unit vector] - that is, sets it equal to the vector with the same direction
|
|
|
+ as this one, but [page:.length length] 1.
|
|
|
</div>
|
|
|
|
|
|
- <h3>[method:Vector4 clampScalar]( [page:Float min], [page:Float max] ) [page:Vector4 this]</h3>
|
|
|
+ <h3>[method:Vector4 max]( [page:Vector4 v] )</h3>
|
|
|
<div>
|
|
|
- min -- [page:Float] the minimum value the components will be clamped to <br />
|
|
|
- max -- [page:Float] the maximum value the components will be clamped to
|
|
|
- </div>
|
|
|
- <div>
|
|
|
- If this vector's x, y, z or w values are greater than the max value, they are replaced by the max value. <br /><br />
|
|
|
- If this vector's x, y, z or w values are less than the min value, they are replaced by the min value.
|
|
|
+ If this vector's x, y, z or w value is less than [page:Vector4 v's] x, y, z or w value, replace
|
|
|
+ that value with the corresponding max value.
|
|
|
</div>
|
|
|
|
|
|
- <h3>[method:Vector4 floor]() [page:Vector4 this]</h3>
|
|
|
+ <h3>[method:Vector4 min]( [page:Vector4 v] )</h3>
|
|
|
<div>
|
|
|
- The components of the vector are rounded downwards (towards negative infinity) to an integer value.
|
|
|
+ If this vector's x, y, z or w value is greater than [page:Vector4 v's] x, y, z or w value, replace
|
|
|
+ that value with the corresponding min value.
|
|
|
</div>
|
|
|
|
|
|
- <h3>[method:Vector4 ceil]() [page:Vector4 this]</h3>
|
|
|
- <div>
|
|
|
- The components of the vector are rounded upwards (towards positive infinity) to an integer value.
|
|
|
- </div>
|
|
|
+ <h3>[method:Vector4 multiplyScalar]( [page:Float s] )</h3>
|
|
|
+ <div>Multiplies this vector by scalar [page:Float s].</div>
|
|
|
|
|
|
- <h3>[method:Vector4 round]() [page:Vector4 this]</h3>
|
|
|
- <div>
|
|
|
- The components of the vector are rounded towards the nearest integer value.
|
|
|
- </div>
|
|
|
+ <h3>[method:Vector4 round]()</h3>
|
|
|
+ <div>The components of the vector are rounded to the nearest integer value.</div>
|
|
|
|
|
|
- <h3>[method:Vector4 roundToZero]() [page:Vector4 this]</h3>
|
|
|
+ <h3>[method:Vector4 roundToZero]()</h3>
|
|
|
<div>
|
|
|
The components of the vector are rounded towards zero (up if negative, down if positive) to an integer value.
|
|
|
</div>
|
|
|
|
|
|
- <h3>[method:Vector4 applyMatrix4]( [page:Matrix4 m] ) [page:Vector4 this]</h3>
|
|
|
- <div>
|
|
|
- m -- [page:Matrix4]
|
|
|
- </div>
|
|
|
- <div>
|
|
|
- Transforms the vector by the matrix.
|
|
|
- </div>
|
|
|
+ <h3>[method:Vector4 set]( [page:Float x], [page:Float y] )</h3>
|
|
|
+ <div>Sets the [page:.x x], [page:.y y], [page:.z z] and [page:.w w] components of this vector.</div>
|
|
|
|
|
|
- <h3>[method:Vector4 min]( [page:Vector4 v] ) [page:Vector4 this]</h3>
|
|
|
- <div>
|
|
|
- v -- [page:Vector4]
|
|
|
- </div>
|
|
|
- <div>
|
|
|
- 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.
|
|
|
- </div>
|
|
|
+ <h3>[method:Vector4 set]( [page:Float x], [page:Float y] )</h3>
|
|
|
+ <div>Sets the [page:.x x], [page:.y y], [page:.z z] and [page:.w w] components of this vector.</div>
|
|
|
|
|
|
- <h3>[method:Vector4 max]( [page:Vector4 v] ) [page:Vector4 this]</h3>
|
|
|
- <div>
|
|
|
- v -- [page:Vector4]
|
|
|
- </div>
|
|
|
+ <h3>[method:Vector4 setAxisAngleFromQuaternion]( [page:Quaterion q] )</h3>
|
|
|
<div>
|
|
|
- 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.
|
|
|
- </div>
|
|
|
+ [page:Quaterion q] - a normalized [page:Quaterion]<br /><br />
|
|
|
|
|
|
- <h3>[method:Vector4 addScalar]( [page:Float s] ) [page:Vector4 this]</h3>
|
|
|
- <div>
|
|
|
- s -- [page:Float]
|
|
|
- </div>
|
|
|
- <div>
|
|
|
- Adds a scalar value to all of the vector's components.
|
|
|
+ Set the [page:.x x], [page:.y y] and [page:.z z] components of this vector to the
|
|
|
+ quaternion's axis and [page:.w w] to the angle.
|
|
|
</div>
|
|
|
|
|
|
- <h3>[method:Boolean equals]( [page:Vector4 v] ) [page:Vector4 this]</h3>
|
|
|
- <div>
|
|
|
- v -- [page:Vector4]
|
|
|
- </div>
|
|
|
+ <h3>[method:Vector4 setAxisAngleFromRotationMatrix]( [page:Matrix4 m] )</h3>
|
|
|
<div>
|
|
|
- Checks to see if this vector matches vector v.
|
|
|
- </div>
|
|
|
+ [page:Matrix4 m] - a [page:Matrix4] of which the upper left 3x3 matrix is a pure rotation matrix.<br /><br />
|
|
|
|
|
|
- <h3>[method:Vector4 setAxisAngleFromRotationMatrix]( [page:Matrix4 m] ) [page:Vector4 this]</h3>
|
|
|
- <div>
|
|
|
- m -- [page:Matrix4]
|
|
|
+ Set the [page:.x x], [page:.y y] and [page:.z z] to the axis of rotation and [page:.w w] to the angle.
|
|
|
</div>
|
|
|
+
|
|
|
+ <h3>[method:null setComponent]( [page:Integer index], [page:Float value] )</h3>
|
|
|
<div>
|
|
|
- Sets this Vector4 to the computed <a href='http://en.wikipedia.org/wiki/Axis%E2%80%93angle_representation' target='_blank'>axis-angle representation</a> of the rotation defined by Matrix4 m. Assumes the upper 3x3 of m is a pure rotation matrix (i.e, unscaled).<br/><br/>
|
|
|
+ [page:Integer index] - 0, 1 or 2.<br />
|
|
|
+ [page:Float value] - [page:Float]<br /><br />
|
|
|
|
|
|
- The axis is stored in components (x, y, z) of the vector, and the rotation in radians is stored in component w
|
|
|
+ If index equals 0 set [page:.x x] to [page:Float value].<br />
|
|
|
+ If index equals 1 set [page:.y y] to [page:Float value].<br />
|
|
|
+ If index equals 2 set [page:.z z] to [page:Float value].<br />
|
|
|
+ If index equals 2 set [page:.w w] to [page:Float value].
|
|
|
</div>
|
|
|
|
|
|
- <h3>[method:Vector4 setAxisAngleFromQuaternion]( [page:Quaternion q] ) [page:Vector4 this]</h3>
|
|
|
- <div>
|
|
|
- q -- [page:Quaternion]
|
|
|
- </div>
|
|
|
- <div>
|
|
|
- Sets this Vector4 to the computed <a href='http://en.wikipedia.org/wiki/Axis%E2%80%93angle_representation' target='_blank'>axis-angle representation</a> of the rotation defined by Quaternion q.<br/><br/>
|
|
|
|
|
|
- The axis is stored in components (x, y, z) of the vector, and the rotation in radians is stored in component w
|
|
|
+ <h3>[method:Vector4 setLength]( [page:Float l] )</h3>
|
|
|
+ <div>
|
|
|
+ Set this vector to the vector with the same direction as this one, but [page:.length length]
|
|
|
+ [page:Float l].
|
|
|
</div>
|
|
|
|
|
|
- <h3>[method:Float getComponent]( [page:Integer index] ) [page:Vector4 this]</h3>
|
|
|
+ <h3>[method:Vector4 setScalar]( [page:Float scalar] )</h3>
|
|
|
<div>
|
|
|
- index -- [page:Integer] 0, 1, 2, or 3
|
|
|
+ Set the [page:.x x], [page:.y y], [page:.z z] and [page:.w w] values of this vector both equal to [page:Float scalar].
|
|
|
</div>
|
|
|
- <div>
|
|
|
- Returns the value of the vector component x, y, or z by an index.<br/><br/>
|
|
|
|
|
|
- Index 0: x<br/>
|
|
|
- Index 1: y<br/>
|
|
|
- Index 2: z<br/>
|
|
|
- Index 3: w<br/>
|
|
|
+ <h3>[method:Vector4 setX]( [page:Float x] )</h3>
|
|
|
+ <div>Replace this vector's [page:.x x] value with [page:Float x].</div>
|
|
|
|
|
|
- </div>
|
|
|
+ <h3>[method:Vector4 setY]( [page:Float y] )</h3>
|
|
|
+ <div>Replace this vector's [page:.y y] value with [page:Float y].</div>
|
|
|
|
|
|
- <h3>[method:null setComponent]( [page:Integer index], [page:Float value] ) [page:Vector4 this]</h3>
|
|
|
- <div>
|
|
|
- index -- [page:Integer] 0 - 3 <br />
|
|
|
- value -- [page:Float]
|
|
|
- </div>
|
|
|
- <div>
|
|
|
- Sets the value of the vector component x, y, or z by an index.<br/><br/>
|
|
|
+ <h3>[method:Vector4 setZ( [page:Float z] )</h3>
|
|
|
+ <div>Replace this vector's [page:.z z] value with [page:Float z].</div>
|
|
|
|
|
|
- Index 0: x<br/>
|
|
|
- Index 1: y<br/>
|
|
|
- Index 2: z<br/>
|
|
|
- Index 3: w<br/>
|
|
|
- </div>
|
|
|
+ <h3>[method:Vector4 setW( [page:Float w] )</h3>
|
|
|
+ <div>Replace this vector's [page:.w w] value with [page:Float w].</div>
|
|
|
|
|
|
- <h3>[method:Vector4 clone]() [page:Vector4 this]</h3>
|
|
|
- <div>
|
|
|
- Clones this vector.
|
|
|
- </div>
|
|
|
+ <h3>[method:Vector4 sub]( [page:Vector4 v] )</h3>
|
|
|
+ <div>Subtracts [page:Vector4 v] from this vector.</div>
|
|
|
|
|
|
- <h3>[method:Array toArray]( [page:Array array], [page:Integer offset] ) [page:Vector4 this]</h3>
|
|
|
- <div>
|
|
|
- array -- An optional array to store the vector.
|
|
|
- offset -- An optional offset into the array.
|
|
|
- </div>
|
|
|
+ <h3>[method:Vector4 subScalar]( [page:Float s] )</h3>
|
|
|
+ <div>Subtracts [page:Float s] from this vector's [page:.x x], [page:.y y], [page:.z z] and [page:.w w] compnents.</div>
|
|
|
+
|
|
|
+ <h3>[method:Vector4 subVectors]( [page:Vector4 a], [page:Vector4 b] )</h3>
|
|
|
+ <div>Sets this vector to [page:Vector4 a] - [page:Vector4 b].</div>
|
|
|
+
|
|
|
+ <h3>[method:Array toArray]( [page:Array array], [page:Integer offset] )</h3>
|
|
|
<div>
|
|
|
- Returns an array in the format [x, y, z, w]
|
|
|
+ [page:Array array] - (optional) array to store the vector to. If this is not provided
|
|
|
+ a new array will be created.<br />
|
|
|
+ [page:Integer offset] - (optional) optional offset into the array.<br /><br />
|
|
|
+
|
|
|
+ Returns an array [x, y, z, w], or copies x, y, z and w into the provided [page:Array array].
|
|
|
</div>
|
|
|
|
|
|
<h2>Source</h2>
|