Class Index | File Index

Classes


Class threedee.Vector

A vector with three elements.
Defined in: Vector.js.

Class Summary
Constructor Attributes Constructor Name and Description
 
threedee.Vector(x, y, z)
Field Summary
Field Attributes Field Name and Description
 
x
The X coordinate.
 
y
The Y coordinate.
 
z
The Z coordinate.
Method Summary
Method Attributes Method Name and Description
 
add(v)
Adds the coordinates of the specified vector to this one.
 
copy(v)
Returns a copy of this vector.
<static>  
threedee.Vector.count()
Returns and resets the current instance counter.
 
cross(v)
Creates the cross product of this vector and the specified one and stores the result back into this vector.
 
dot(v)
Creates and returns the dot product of this vector and the specified one.
<static>  
threedee.Vector.fromJSON(data)
Creates a new vector instance with the data read from the specified JSON object (with keys 'x', 'y' and 'z').
 
Returns the angle between this vector and the specified one.
 
Returns the length of the vector.
 
scale(fx, fy, fz)
Scales the vector with the specified factors.
 
set(x, y, z)
Sets the vector coordinates.
 
sub(v)
Subtracts the coordinates of the specified vector from this one.
 
Converts the vector into a JSON object with keys 'x', 'y' and 'z'.
 
Converts this vector into a unit vector with length 1.
 
Transforms this vector with the specified matrix.
Class Detail
threedee.Vector(x, y, z)
Parameters:
{number=} x
The X coordinate (Optional)
{number=} y
The Y coordinate (Optional)
{number=} z
The Z coordinate (Optional)
Field Detail
x
The X coordinate.

y
The Y coordinate.

z
The Z coordinate.
Method Detail
{!threedee.Vector} add(v)
Adds the coordinates of the specified vector to this one.
Parameters:
{!threedee.Vector} v
The vector to add
Returns:
{!threedee.Vector} This vector

{!threedee.Vector} copy(v)
Returns a copy of this vector.
Parameters:
{?threedee.Vector=} v
Optional target vector
Returns:
{!threedee.Vector} A copy of this vector (or the target vector)

<static> {number} threedee.Vector.count()
Returns and resets the current instance counter.
Returns:
{number} The number of created instances since the last call

{!threedee.Vector} cross(v)
Creates the cross product of this vector and the specified one and stores the result back into this vector.
Parameters:
{!threedee.Vector} v
The other vector
Returns:
{!threedee.Vector} This vector

{number} dot(v)
Creates and returns the dot product of this vector and the specified one.
Parameters:
{!threedee.Vector} v
The other vector
Returns:
{number} The dot product

<static> {threedee.Vector} threedee.Vector.fromJSON(data)
Creates a new vector instance with the data read from the specified JSON object (with keys 'x', 'y' and 'z'). Returns null if data was empty.
Parameters:
{Object} data
The vector as JSON object
Returns:
{threedee.Vector} The vector object or null if data was empty

{number} getAngle(v)
Returns the angle between this vector and the specified one.
Parameters:
{!threedee.Vector} v
The other vector
Returns:
{number} The angle in clockwise RAD.

{number} length()
Returns the length of the vector.
Returns:
{number} The vector length

{!threedee.Vector} scale(fx, fy, fz)
Scales the vector with the specified factors.
Parameters:
{number} fx
The X factor
{number} fy
The Y factor (Optional. Defaults to fx)
{number} fz
The Z factor (Optional. Defaults to fx)
Returns:
{!threedee.Vector} This vector

{!threedee.Vector} set(x, y, z)
Sets the vector coordinates.
Parameters:
{number} x
The X coordinate
{number} y
The Y coordinate
{number} z
The Z coordinate
Returns:
{!threedee.Vector} This vector

{!threedee.Vector} sub(v)
Subtracts the coordinates of the specified vector from this one.
Parameters:
{!threedee.Vector} v
The vector to subtract
Returns:
{!threedee.Vector} This vector

{Object} toJSON()
Converts the vector into a JSON object with keys 'x', 'y' and 'z'.
Returns:
{Object} The vector as a JSON object

{!threedee.Vector} toUnit()
Converts this vector into a unit vector with length 1.
Returns:
{!threedee.Vector} This vector

{!threedee.Vector} transform(m)
Transforms this vector with the specified matrix.
Parameters:
{!threedee.Matrix} m
The matrix
Returns:
{!threedee.Vector} This vector

Documentation generated by JsDoc Toolkit 2.4.0 on Tue Jan 03 2012 16:18:58 GMT+0100 (CET)