Vector in Anark Studio 2.5
X/Y/Z location.
Inherits from:
Instance Properties
| name | type | description |
|---|---|---|
| constructor | Object | A reference to the constructor class for the current object instance. [from Object] |
| prototype | Object | The prototype for a class. [from Object] |
| x | Number | X location. |
| y | Number | Y location. |
| z | Number | Z location. |
Instance Methods
| name | returns | description |
|---|---|---|
| add(otherVector) | (none) | Add on a vector. |
| copy() | Vector | Return a copy of the vector. |
| cross(otherVector) | (none) | Perform a cross-product on the vector. |
| distance(otherVector) | Number | Calculate the distance to another vector. |
| distanceSquared(otherVector) | Number | Calculate the squared distance to another vector. |
| dot(otherVector) | Vector | Calculate the dot product. |
| equals(otherVector) | Boolean | Compare two vectors for equivalence. |
| hasOwnProperty(propertyOrMethodName) | Boolean | Determines if the object/instance itself has the named property or method. [from Object] |
| isPrototypeOf(instanceToTest) | Boolean | Determines if the calling object prototype is in the inheritance chain for the supplied argument. [from Object] |
| length() | Number | Length of the vector. |
| lengthSquared() | Number | Length of the vector, squared. |
| linear(targetVector,weightFactor) | (none) | Move the vector towards another vector. |
| maxVector(otherVector) | (none) | Calculate the maximum vector. |
| minVector(otherVector) | (none) | Calculate the minimum vector. |
| normalize() | (none) | Normalize the vector. |
| propertyIsEnumerable(propertyOrMethodName) | Boolean |
Determines if the object/instance itself has a property or method of the supplied name which will appear in a for (prop in obj) enumeration.
[from Object]
|
| scale(scaleFactor) | (none) | Scale the vector by a factor. |
| subtract(otherVector) | (none) | Subtract a vector. |
| toLocaleString() | String |
For most objects, the same as toString() unless explicitly overridden.
[from Object]
|
| toString() | String | Returns a string representation of the object. [from Object] |
| transform(transformMatrix) | (none) | Transform the vector by a matrix. |
| valueOf() | String |
Returns the internal this value of the object.
[from Object]
|
Description
A vector is a utility object encapsulating the three floating point components X, Y and Z.
Constructor syntax
var vector = new Vector( x, y, z );
x- optional — The floating point value representing the X position.
y- optional — The floating point value representing the Y position.
z- optional — The floating point value representing the Z position.
Properties that are a Vector
| name | object | description |
|---|---|---|
| boxMax | Model | (read only) Maximum bounding-box point. |
| boxMin | Model | (read only) Minimum bounding-box point. |
| lookAtPoint | Camera | Location for the camera to look at. |
| pivot | Node | Pivot point location. |
| position | Node | Location of the object. |
| scale | Node | Scale of the object. |
Methods that return a Vector
| name | of object | description |
|---|---|---|
| copy() | Vector | Return a copy of the vector. |
| dot(otherVector) | Vector | Calculate the dot product. |
Arguments that are a Vector
| name | in method | of object | description |
|---|---|---|---|
| globalDirection | intersect(useBackface,globalOrigin,globalDirection,…) | Model | Vector specifying the ray dire |
| globalOrigin | intersect(useBackface,globalOrigin,globalDirection,…) | Model | The vector in global 3D space< |
| intersection | intersect(useBackface,globalOrigin,globalDirection,…) | Model | Returns the positional vector< |
| normal | intersect(useBackface,globalOrigin,globalDirection,…) | Model | Returns a directional vector t |
| otherVector | equals(otherVector) | Vector | The vector to compare to. |
| otherVector | distance(otherVector) | Vector | The vector to calculate the di |
| otherVector | distanceSquared(otherVector) | Vector | The vector to calculate the di |
| otherVector | maxVector(otherVector) | Vector | The vector to compare to. |
| otherVector | minVector(otherVector) | Vector | The vector to compare to. |
| otherVector | cross(otherVector) | Vector | Vector to use for calculating< |
| otherVector | add(otherVector) | Vector | The Vector to add. |
| otherVector | subtract(otherVector) | Vector | The Vector to subtract. |
| otherVector | dot(otherVector) | Vector | Vector to use for calculating< |
| targetVector | linear(targetVector,weightFactor) | Vector | The vector to weight towards.< |
| targetVector | linear(targetVector,weightFactor) | Rotation | The rotation to weight towards |