Documentation

Classes

Class Vect3d

3d vector class with lots of operators and methods

Class Overview
Vect3d(x, y, z)
3d vector class with lots of operators and methods. Usually used to store 3d positions and directions.
Parameters:
x
{Number} x coordinate, can be null.
y
{Number} y coordinate, can be null.
z
{Number} z coordinate, can be null.

Field Summary
Field Attributes Field Name and Description
 
X
X coordinate of the vector
 
Y
Y coordinate of the vector
 
Z
Z coordinate of the vector
Method Summary
Method Attributes Method Name and Description
 
add(other)
Adds another vector to this vector and returns a new vector param other {Vect3d} other vector
 
addToThis(other)
Adds another vector to this vector, modifying this vector param other {Vect3d} other vector
 
Creates a copy of this vector and returns it
 
copyTo(tgt)
Copies the content of this vector to another vector
 
returns the cross product of this vector with another vector as new vector.
 
Divides each coordinate with the coordinate of another vector, modifying this vector.
 
Divides each coordinate with the coordinate of another vector, returning the result as a new vector.
 
dotProduct(other)
returns the dot procduct of this vector with another vector
 
equals(other)
Returns true if this vector equals another vector.
 
equalsByNumbers(x, y, z)
Returns true if this vector equals x, y, and z given as argument.
 
Returns true if this vector equals zero.
 
Returns the squared distance to another point
 
Returns the distance to another point
 
Get the rotations that would make a (0,0,1) direction vector point in the same direction as this direction vector.
 
Returns the lenght of this vector
 
Returns the squared lenght of this vector, is faster than Vect3d.getLength.
 
Creates a new vector which is the normalized version of this vector (set to a length of 1) param other {Vect3d} other vector
 
Returns true if this vector == zero.
 
Multiplies this vector with a scalar value (= a number), modifying this vector
 
Multiplies each coordinate with the coordinate of another vector, modifying this vector.
 
Multiplies this vector with a scalar value (= a number) and returns the result as a new vector
 
Multiplies each coordinate with the coordinate of another vector, returning the result as a new vector.
 
Normalizes this vector, setting it to a length of 1, modifying this vector
 
set(x, y, z)
Sets all 3 coordinates to new values
 
Sets the lengthh of this vector to the specified value
 
setTo(other)
Sets all coordinates of this vector to the coordinates of the other vector
 
substract(other)
Substracts another vector from this vector and returns a new vector param other {Vect3d} other vector
 
Substracts another vector from this vector, modifying this vector param other {Vect3d} other vector
 
Returns a string representation of this vector.
Field Detail
{Number} X
X coordinate of the vector

{Number} Y
Y coordinate of the vector

{Number} Z
Z coordinate of the vector
Method Detail
{Vect3d} add(other)
Adds another vector to this vector and returns a new vector param other {Vect3d} other vector
Parameters:
other
Returns:
{Vect3d} new vector with the result

addToThis(other)
Adds another vector to this vector, modifying this vector param other {Vect3d} other vector
Parameters:
other

{Vect3d} clone()
Creates a copy of this vector and returns it

copyTo(tgt)
Copies the content of this vector to another vector
Parameters:
tgt
{Vect3d} Target vector

{Vect3d} crossProduct(p)
returns the cross product of this vector with another vector as new vector.
Parameters:
p
Returns:
{Vect3d} a new vector with the result cross product

divideThisThroughVect(v)
Divides each coordinate with the coordinate of another vector, modifying this vector.
Parameters:
v

divideThroughVect(v)
Divides each coordinate with the coordinate of another vector, returning the result as a new vector.
Parameters:
v

dotProduct(other)
returns the dot procduct of this vector with another vector
Parameters:
other

equals(other)
Returns true if this vector equals another vector. Doesn't use the comparison operator but the Core.equals function.
Parameters:
other
{Vect3d} other vector

equalsByNumbers(x, y, z)
Returns true if this vector equals x, y, and z given as argument. Doesn't use the comparison operator but the Core.equals function.
Parameters:
x
y
z

equalsZero()
Returns true if this vector equals zero. Doesn't use the comparison operator but the Core.iszero function.

getDistanceFromSQ(v)
Returns the squared distance to another point
Parameters:
v
{Vect3d} another point

getDistanceTo(v)
Returns the distance to another point
Parameters:
v
{Vect3d} another point

getHorizontalAngle()
Get the rotations that would make a (0,0,1) direction vector point in the same direction as this direction vector. This utility method is very useful for orienting scene nodes towards specific targets. For example, if this vector represents the difference between two scene nodes, then applying the result of getHorizontalAngle() to one scene node will point it at the other one.

getLength()
Returns the lenght of this vector

getLengthSQ()
Returns the squared lenght of this vector, is faster than Vect3d.getLength.

{Vect3d} getNormalized()
Creates a new vector which is the normalized version of this vector (set to a length of 1) param other {Vect3d} other vector
Returns:
{Vect3d} Returns a new vector with the result

isZero()
Returns true if this vector == zero.

multiplyThisWithScal(v)
Multiplies this vector with a scalar value (= a number), modifying this vector
Parameters:
v

multiplyThisWithVect(v)
Multiplies each coordinate with the coordinate of another vector, modifying this vector.
Parameters:
v

multiplyWithScal(v)
Multiplies this vector with a scalar value (= a number) and returns the result as a new vector
Parameters:
v

multiplyWithVect(v)
Multiplies each coordinate with the coordinate of another vector, returning the result as a new vector.
Parameters:
v

normalize()
Normalizes this vector, setting it to a length of 1, modifying this vector

set(x, y, z)
Sets all 3 coordinates to new values
Parameters:
x
y
z

setLength(n)
Sets the lengthh of this vector to the specified value
Parameters:
n

setTo(other)
Sets all coordinates of this vector to the coordinates of the other vector
Parameters:
other
{Vect3d} other vector

{Vect3d} substract(other)
Substracts another vector from this vector and returns a new vector param other {Vect3d} other vector
Parameters:
other
Returns:
{Vect3d} new vector with the result

substractFromThis(other)
Substracts another vector from this vector, modifying this vector param other {Vect3d} other vector
Parameters:
other

toString()
Returns a string representation of this vector.

© 2010 N.Gebhardt, Ambiera
Documentation generated by JsDoc Toolkit