Documentation

Classes

Class CL3D.Vect3d

3d vector class with lots of operators and methods

Class Overview
CL3D.Vect3d(x, y, z)
3d vector class with lots of operators and methods. Usually used to store 3d positions and directions.
Parameters:
{Number} x
x coordinate, can be null.
{Number} y
y coordinate, can be null.
{Number} z
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 {CL3D.Vect3d} other vector
 
addToThis(other)
Adds another vector to this vector, modifying this vector param other {CL3D.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.
 
getInterpolated(other, d)
returns a new interpolated vector, between this and another 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 {CL3D.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
 
rotateXYBy(degrees)
Rotates the vector around XY by a specic angle
 
rotateXZBy(degrees)
Rotates the vector around XZ by a specic angle
 
rotateYZBy(degrees)
Rotates the vector around YZ by a specic angle
 
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 {CL3D.Vect3d} other vector
 
Substracts another vector from this vector, modifying this vector param other {CL3D.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
{CL3D.Vect3d} add(other)
Adds another vector to this vector and returns a new vector param other {CL3D.Vect3d} other vector
Parameters:
other
Returns:
{CL3D.Vect3d} new vector with the result

addToThis(other)
Adds another vector to this vector, modifying this vector param other {CL3D.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:
{CL3D.Vect3d} tgt
Target vector

{CL3D.Vect3d} crossProduct(p)
returns the cross product of this vector with another vector as new vector.
Parameters:
p
Returns:
{CL3D.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 CL3D.equals function.
Parameters:
other
{CL3D.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 CL3D.equals function.
Parameters:
x
y
z

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

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

getDistanceTo(v)
Returns the distance to another point
Parameters:
{CL3D.Vect3d} v
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.

getInterpolated(other, d)
returns a new interpolated vector, between this and another vector.
Parameters:
{CL3D.Vect3d} other
another point or vector
{Number} d
value between 0 and 1, specifying the interpolation

getLength()
Returns the lenght of this vector

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

{CL3D.Vect3d} getNormalized()
Creates a new vector which is the normalized version of this vector (set to a length of 1) param other {CL3D.Vect3d} other vector
Returns:
{CL3D.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

rotateXYBy(degrees)
Rotates the vector around XY by a specic angle
Parameters:
degrees

rotateXZBy(degrees)
Rotates the vector around XZ by a specic angle
Parameters:
degrees

rotateYZBy(degrees)
Rotates the vector around YZ by a specic angle
Parameters:
degrees

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:
{CL3D.Vect3d} other
other vector

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

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

toString()
Returns a string representation of this vector.

© 2011-2017 N.Gebhardt, Ambiera
Documentation generated by JsDoc Toolkit