Class Index | File Index

Classes


Class vector

vector
Defined in: vector.js.

Class Summary
Constructor Attributes Constructor Name and Description
 
vector()
A hybrid class suitable for both 2D and 3D positional and physics operations.
Field Summary
Field Attributes Field Name and Description
 
x
X component of the vector
 
y
Y component of the vector
 
z
Z component of the vector
Method Summary
Method Attributes Method Name and Description
 
Instantiates a new vector that is a copy of this one's data.
 
cross(other)
Returns the cross product of this vector and another in that order.
 
cross2D(other)
Returns the 2D cross product => this x other.
 
distance(other)
Gets the non-directional distance between 2 vectors as positions.
 
dot(b)
Returns the dot product of the two vectors.
 
Returns the length of the vector.
 
Sets this vector to a normalized form where its length becomes 1.0.
 
Rotates the directional vector about the {1, 0, 0} axis in degrees.
 
Rotates the directional vector about the {1, 0, 0} axis in degrees from a different origin.
 
Rotates the directional vector about the {0, 1, 0} axis in degrees.
 
Rotates the directional vector about the {0, 1, 0} axis in degrees from a different origin.
 
Rotates the directional vector about the {0, 0, 1} axis in degrees.
 
Rotates the directional vector about the {0, 0, 1} axis in degrees from a different origin.
 
X axis rotation in degrees If a vector has length zero in these dimensions , the angle is always zero.
 
returns the YZ angle between the 2 vectors in relation to the origin in degrees
 
returns the angle between the 2 vectors in relation to this vector in degrees
 
Y axis rotation in degrees If a vector has length zero in these dimensions , the angle is always zero.
 
returns the ZX angle between the 2 vectors in relation to the origin in degrees
 
returns the angle between the 2 vectors in relation to this vector in degrees
 
Z axis rotation in degrees These deal with angles between the x and y axes.
 
returns the XY angle between the 2 vectors in relation to the origin in degrees
 
returns the angle between the 2 vectors in relation to this vector in degrees
 
Returns this vector in string form
Class Detail
vector()
A hybrid class suitable for both 2D and 3D positional and physics operations. See sandboxe.vector.create
Field Detail
x
X component of the vector

y
Y component of the vector

z
Z component of the vector
Method Detail
{vector} clone()
Instantiates a new vector that is a copy of this one's data.
Returns:
{vector}

{Number} cross(other)
Returns the cross product of this vector and another in that order.
Parameters:
{vector} other
Returns:
{Number}

{Number} cross2D(other)
Returns the 2D cross product => this x other. A cross product is computed as if the z components were equal to zero. This gives the magnitude, or Z of the cross product.
Parameters:
{vector} other
Returns:
{Number}

distance(other)
Gets the non-directional distance between 2 vectors as positions.
Parameters:
{vector} other

{Number} dot(b)
Returns the dot product of the two vectors. The dot product is defined as (a.length() * b.length() * cos(\theta)) where theta is the angle between the 2 vectors
Parameters:
{vector} b
Returns:
{Number}

{Number} length()
Returns the length of the vector.
Returns:
{Number}

normalized()
Sets this vector to a normalized form where its length becomes 1.0.

rotateX()
Rotates the directional vector about the {1, 0, 0} axis in degrees.
Parameters:
{Number}

rotateXFrom(, )
Rotates the directional vector about the {1, 0, 0} axis in degrees from a different origin.
Parameters:
{vector}
{Number}

rotateY()
Rotates the directional vector about the {0, 1, 0} axis in degrees.
Parameters:
{Number}

rotateYFrom(, )
Rotates the directional vector about the {0, 1, 0} axis in degrees from a different origin.
Parameters:
{vector}
{Number}

rotateZ()
Rotates the directional vector about the {0, 0, 1} axis in degrees.
Parameters:
{Number}

rotateZFrom(, )
Rotates the directional vector about the {0, 0, 1} axis in degrees from a different origin.
Parameters:
{vector}
{Number}

{Number} rotationX()
X axis rotation in degrees If a vector has length zero in these dimensions , the angle is always zero. The rotation is about the directional vector (1, 0, 0) and Positive rotation is towards the positive Z direction.
Returns:
{Number}

{Number} rotationXDiff()
returns the YZ angle between the 2 vectors in relation to the origin in degrees
Parameters:
{vector}
Returns:
{Number}

{Number} rotationXDiffRelative()
returns the angle between the 2 vectors in relation to this vector in degrees
Parameters:
{vector}
Returns:
{Number}

{Number} rotationY()
Y axis rotation in degrees If a vector has length zero in these dimensions , the angle is always zero. The rotation is about the directional vector (0, 1, 0) and Positive rotation is towards the positive X direction.
Returns:
{Number}

{Number} rotationYDiff()
returns the ZX angle between the 2 vectors in relation to the origin in degrees
Parameters:
{vector}
Returns:
{Number}

{Number} rotationYDiffRelative()
returns the angle between the 2 vectors in relation to this vector in degrees
Parameters:
{vector}
Returns:
{Number}

{Number} rotationZ()
Z axis rotation in degrees These deal with angles between the x and y axes. XY is most useful for 2D angles and transformations. If a vector has length zero in these dimensions , the angle is always zero. The rotation is about the directional vector (0, 0, 1). Positive rotation is towards the positive Y direction.
Returns:
{Number}

{Number} rotationZDiff()
returns the XY angle between the 2 vectors in relation to the origin in degrees
Parameters:
{vector}
Returns:
{Number}

{Number} rotationZDiffRelative()
returns the angle between the 2 vectors in relation to this vector in degrees
Parameters:
{vector}
Returns:
{Number}

{String} toString()
Returns this vector in string form
Returns:
{String}

Documentation generated by JsDoc Toolkit 2.4.0 on Sun Feb 03 2019 18:30:57 GMT-0500 (EST)