Packagesandy.math
Classpublic class VertexMath
InheritanceVertexMath Inheritance VectorMath

Math functions for vertex manipulation.



Public Methods
 MethodDefined by
  
Creates a VertexMath object.
VertexMath
 Inherited
[static] Adds two 3D vectors.
VectorMath
  
[static] Adds the two vertices.
VertexMath
  
[static] Clones a vertex.
VertexMath
  
cross(p_oW:Vertex, p_oV:Vertex):Vertex
[static] Computes the cross product the two vertices.
VertexMath
  
dot(p_oV:Vertex, p_oW:Vertex):Number
[static] Computes the dot product of the two vertices.
VertexMath
 Inherited
getAngle(p_oV:Vector, p_oW:Vector):Number
[static] Calculates the angle between two 3D vectors.
VectorMath
  
[static] Returns an instance of this class.
VertexMath
 Inherited
getNorm(p_oV:Vector):Number
[static] Computes the norm of a 3D vector.
VectorMath
  
linearGradientMatrix(p_oV0:Vertex, p_oV1:Vertex, p_oV2:Vertex, p_nR0:Number, p_nR1:Number, p_nR2:Number, p_oMatrix:Matrix = null):Matrix
[static] Calculates linear gradient matrix from three vertices and ratios.
VertexMath
  
[static] Computes the opposite of a vertex.
VertexMath
 Inherited
normalize(p_oV:Vector):Boolean
[static] Normalizes a 3d vector.
VectorMath
 Inherited
pow(p_oV:Vector, p_nExp:Number):Vector
[static] Computes the power of a 3D vector.
VectorMath
 Inherited
scale(p_oV:Vector, n:Number):Vector
[static] Multiplies a 3D vector by specified scalar.
VectorMath
 Inherited
sphrand(inner:Number, outer:Number):Vector
[static] Returns a random vector contained betweeen the first and second values.
VectorMath
  
sub(p_oV:Vertex, p_oW:Vertex):Vertex
[static] Substracts one vertices from another.
VertexMath
Constructor detail
VertexMath()constructor
public function VertexMath()

Creates a VertexMath object.

This is a singleton constructor, and should not be called directly.
If called from outside the ColorMath class, it throws a SingletonError.

[ToDo: Why instantiate this at all? - all methods are class methods! ]

Method detail
addVertex()method
public static function addVertex(p_oV:Vertex, p_oW:Vertex):Vertex

Adds the two vertices.

[ToDo: Check here! We should add all the properties of the vertices! ]

Parameters
p_oV:Vertex — The first vertex.
 
p_oW:Vertex — The second vertex.

Returns
Vertex — The resulting vertex.
clone()method 
public static function clone(p_oV:Vertex):Vertex

Clones a vertex.

Parameters
p_oV:Vertex — A vertex to clone.

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

Computes the cross product the two vertices.

Parameters
p_oW:Vertex — The first vertex.
 
p_oV:Vertex — The second vertex.

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

Computes the dot product of the two vertices.

Parameters
p_oV:Vertex — The first vertex.
 
p_oW:Vertex — The second vertex.

Returns
Number — The dot procuct.
getInstance()method 
public static function getInstance():VertexMath

Returns an instance of this class.

Call this method to get an instance of VertexMath.

Returns
VertexMath
linearGradientMatrix()method 
public static function linearGradientMatrix(p_oV0:Vertex, p_oV1:Vertex, p_oV2:Vertex, p_nR0:Number, p_nR1:Number, p_nR2:Number, p_oMatrix:Matrix = null):Matrix

Calculates linear gradient matrix from three vertices and ratios.

This function expects vertices to be ordered in such a way that p_nR0 < p_nR1 < p_n2. Ratios can be scaled by any positive factor.

See flash.display.Graphics.beginGradientFill() documentation for ratios meaning.

Parameters
p_oV0:Vertex — The leftmost vertex in a gradient.
 
p_oV1:Vertex — The inner vertex in a gradient.
 
p_oV2:Vertex — The rightmost vertex in a gradient.
 
p_nR0:Number — The ratio for the leftmost vertext.
 
p_nR1:Number — The ratio for the inner vertex.
 
p_nR2:Number — The ratio for the rightmost.
 
p_oMatrix:Matrix (default = null) — The matrix to use.

Returns
Matrix — The transformation matrix to use with beginGradientFill (GradientType.LINEAR only).
negate()method 
public static function negate(p_oV:Vertex):Vertex

Computes the opposite of a vertex.

The opposite vertex is a vertex where all components are multiplied by -1.

Parameters
p_oV:Vertex — The vertex.

Returns
Vertex — The opposite vertex.
sub()method 
public static function sub(p_oV:Vertex, p_oW:Vertex):Vertex

Substracts one vertices from another.

Parameters
p_oV:Vertex — The vertex to subtract from.
 
p_oW:Vertex — The vertex to subtract.

Returns
Vertex — The resulting vertex.