Packagesandy.math
Classpublic class VectorMath
SubclassesVertexMath

Math functions for vector manipulations.



Public Methods
 MethodDefined by
  
[static] Adds two 3D vectors.
VectorMath
  
[static] Clones a 3D vector.
VectorMath
  
cross(p_oW:Vector, p_oV:Vector):Vector
[static] Computes the cross product of two 3D vectors.
VectorMath
  
dot(p_oV:Vector, p_oW:Vector):Number
[static] Computes the dot product the two 3D vectors.
VectorMath
  
getAngle(p_oV:Vector, p_oW:Vector):Number
[static] Calculates the angle between two 3D vectors.
VectorMath
  
getNorm(p_oV:Vector):Number
[static] Computes the norm of a 3D vector.
VectorMath
  
[static] Computes the oposite vector of a specified 3D vector.
VectorMath
  
normalize(p_oV:Vector):Boolean
[static] Normalizes a 3d vector.
VectorMath
  
pow(p_oV:Vector, p_nExp:Number):Vector
[static] Computes the power of a 3D vector.
VectorMath
  
scale(p_oV:Vector, n:Number):Vector
[static] Multiplies a 3D vector by specified scalar.
VectorMath
  
sphrand(inner:Number, outer:Number):Vector
[static] Returns a random vector contained betweeen the first and second values.
VectorMath
  
sub(p_oV:Vector, p_oW:Vector):Vector
[static] Substracts one 3D vector from another.
VectorMath
Method detail
addVector()method
public static function addVector(p_oV:Vector, p_oW:Vector):Vector

Adds two 3D vectors.

Parameters
p_oV:Vector — The first vector.
 
p_oW:Vector — The second vector.

Returns
Vector — The resulting vector.
clone()method 
public static function clone(p_oV:Vector):Vector

Clones a 3D vector.

Parameters
p_oV:Vector — The vector.

Returns
Vector — The clone.
cross()method 
public static function cross(p_oW:Vector, p_oV:Vector):Vector

Computes the cross product of two 3D vectors.

Parameters
p_oW:Vector — The first vector.
 
p_oV:Vector — The second vector.

Returns
Vector — The resulting cross product.
dot()method 
public static function dot(p_oV:Vector, p_oW:Vector):Number

Computes the dot product the two 3D vectors.

Parameters
p_oV:Vector — The first vector.
 
p_oW:Vector — The second vector.

Returns
Number — The dot procuct.
getAngle()method 
public static function getAngle(p_oV:Vector, p_oW:Vector):Number

Calculates the angle between two 3D vectors.

Parameters
p_oV:Vector — The first vector.
 
p_oW:Vector — The second vector.

Returns
Number — The angle in radians between the two vectors.
getNorm()method 
public static function getNorm(p_oV:Vector):Number

Computes the norm of a 3D vector.

Parameters
p_oV:Vector — The vector.

Returns
Number — The norm of the vector.
negate()method 
public static function negate(p_oV:Vector):Vector

Computes the oposite vector of a specified 3D vector.

Parameters
p_oV:Vector — The vector.

Returns
Vector — The opposed vector.
normalize()method 
public static function normalize(p_oV:Vector):Boolean

Normalizes a 3d vector.

Parameters
p_oV:Vector — The vector to normalize.

Returns
Boolean — Whether the normalization was successful.
pow()method 
public static function pow(p_oV:Vector, p_nExp:Number):Vector

Computes the power of a 3D vector.

Here the meaning of the power of a vector is a new vector where each element is the the n:th power of the corresponding element.

Ex: A^n = ( A.x^n, A.y^n, A.z^n )

Parameters
p_oV:Vector — The vector.
 
p_nExp:Number — The exponent.

Returns
Vector — The resulting vector.
scale()method 
public static function scale(p_oV:Vector, n:Number):Vector

Multiplies a 3D vector by specified scalar.

Parameters
p_oV:Vector — The vector to multiply.
 
n:Number — The scaler to multiply.

Returns
Vector — The resulting vector.
sphrand()method 
public static function sphrand(inner:Number, outer:Number):Vector

Returns a random vector contained betweeen the first and second values.

Parameters
inner:Number
 
outer:Number

Returns
Vector
sub()method 
public static function sub(p_oV:Vector, p_oW:Vector):Vector

Substracts one 3D vector from another.

Parameters
p_oV:Vector — The vector to subtract from.
 
p_oW:Vector — The vector to subtract.

Returns
Vector — The resulting vector.