Packagesandy.core.data
Classpublic final class Vertex

A vertex of a 3D mesh or polygon.

A vertex is a point which can be represented in different coordinate systems.



Public Properties
 PropertyDefined by
  aFaces : Array
An array of faces.
Vertex
  nbFaces : uint = 0
Number of polygons this vertex belongs to.
Vertex
  projected : Boolean = false
Has this vertex been projected? State flag.
Vertex
  sx : Number
properties used to store transformed coordinates in screen World.
Vertex
  sy : Number
Vertex
  wx : Number
properties used to store transformed positions in the World coordinates
Vertex
  wy : Number
Vertex
  wz : Number
Vertex
  x : Number
Vertex
  y : Number
Vertex
  z : Number
Vertex
Public Methods
 MethodDefined by
  
Vertex(p_nx:Number = 0, p_ny:Number = 0, p_nz:Number = 0, ... rest)
Creates a new vertex.
Vertex
  
add(v:Vertex):void
Adds a specified vertex to this vertex.
Vertex
  
Returns a clone of this vertex.
Vertex
  
Returns a new vertex build on the transformed values of this vertex.
Vertex
  
copy(p_oVector:Vertex):void
Makes this vertex equal to the specified vertex.
Vertex
  
[static] Creates and returns a new vertex from the specified vector.
Vertex
  
Returns the cross product between this vertex and the specified vertex.
Vertex
  
deserialize(convertFrom:String):void
Sets the elements of this vertex from a string representation.
Vertex
  
dot(w:Vertex):Number
Returns the dot product between this vertex and a specified vertex.
Vertex
  
equals(p_vertex:Vertex):Boolean
Is this vertex equal to the specified vertex?.
Vertex
  
getAngle(w:Vertex):Number
Returns the angle between this vertex and the specified vertex.
Vertex
  
getNorm():Number
Returns the norm of this vertex.
Vertex
  
Returns the 2D position of this vertex.
Vertex
  
Returns a vector representing the original x, y, z values.
Vertex
  
Returns the transformed vertex in world coordinates.
Vertex
  
Return the invers of this vertex.
Vertex
  
normalize():void
Normalizes this vertex.
Vertex
  
pow(pow:Number):void
Raises the vertex to the specified power.
Vertex
  
scale(n:Number):void
Multiplies this vertex by the specified scalar value.
Vertex
  
serialize(decPlaces:Number = 0):String
Returns a string representation of this vertex with rounded values.
Vertex
  
sub(v:Vertex):void
Substracts a specified vertex from this vertex.
Vertex
  
toString(decPlaces:Number = 0):String
Returns a string representing this vertex.
Vertex
Public Constants
 ConstantDefined by
  id : uint
Vertex
Property detail
aFacesproperty
public var aFaces:Array

An array of faces.

[ToDo: This isn't used - is it ;-P ]

nbFacesproperty 
public var nbFaces:uint = 0

Number of polygons this vertex belongs to.

Default value is 0.

projectedproperty 
public var projected:Boolean = false

Has this vertex been projected? State flag.

Default value is false.

sxproperty 
public var sx:Number

properties used to store transformed coordinates in screen World.

syproperty 
public var sy:Number
wxproperty 
public var wx:Number

properties used to store transformed positions in the World coordinates

wyproperty 
public var wy:Number
wzproperty 
public var wz:Number
xproperty 
public var x:Number
yproperty 
public var y:Number
zproperty 
public var z:Number
Constructor detail
Vertex()constructor
public function Vertex(p_nx:Number = 0, p_ny:Number = 0, p_nz:Number = 0, ... rest)

Creates a new vertex.

Parameters
p_nx:Number (default = 0) — The x position
 
p_ny:Number (default = 0) — The y position
 
p_nz:Number (default = 0) — The z position
 
... rest — optional values for wx, wy, wz
Method detail
add()method
public final function add(v:Vertex):void

Adds a specified vertex to this vertex.

Parameters
v:Vertex — The vertex to add to this vertex
clone()method 
public final function clone():Vertex

Returns a clone of this vertex.

Returns
Vertex — The clone
clone2()method 
public final function clone2():Vertex

Returns a new vertex build on the transformed values of this vertex.

A new vertex is created with this vertex's transformed coordinates as start position.
So ( x, y, z ) of the new vertex is the ( wx, wy, wz ) of this vertex.

[ToDo: What can this one be used for? - Explain! ]

Returns
Vertex — The new vertex
copy()method 
public final function copy(p_oVector:Vertex):void

Makes this vertex equal to the specified vertex.

All components of the argument vertex are copied to this vertex.

Parameters
p_oVector:Vertex — The vertex to copy to this
createFromVector()method 
public static function createFromVector(p_v:Vector):Vertex

Creates and returns a new vertex from the specified vector.

Parameters
p_v:Vector — The vertex position vector

Returns
Vertex — The new vertex
cross()method 
public final function cross(v:Vertex):Vertex

Returns the cross product between this vertex and the specified vertex.

Only the original positions values are used for this cross product.

Parameters
v:Vertex — The vertex to make a cross product with

Returns
Vertex — the resulting vertex of the cross product.
deserialize()method 
public final function deserialize(convertFrom:String):void

Sets the elements of this vertex from a string representation.

[ToDo: Explain why this is good for XML intput! ]

Parameters
convertFrom:String — A string representing the vertex ( specific serialize format )
dot()method 
public final function dot(w:Vertex):Number

Returns the dot product between this vertex and a specified vertex.

Only the original positions values are used for this dot product.

Parameters
w:Vertex — The vertex to make a dot product with

Returns
Number — The dot product
equals()method 
public final function equals(p_vertex:Vertex):Boolean

Is this vertex equal to the specified vertex?.

This vertex is compared to the argument vertex, component by component.
If all components of the two vertices are equal, a true value is returned. Parameters

p_vertex:Vertex

Returns
Boolean — true if the vertices are considered equal, false otherwise
getAngle()method 
public final function getAngle(w:Vertex):Number

Returns the angle between this vertex and the specified vertex.

Parameters
w:Vertex — The vertex making an angle with this one

Returns
Number — The angle in radians
getNorm()method 
public final function getNorm():Number

Returns the norm of this vertex.

The norm of the vertex is calculated as the length of its position vector.
That is sqrt( x + y + z )

Returns
Number — The norm
getScreenPoint()method 
public function getScreenPoint():Vector

Returns the 2D position of this vertex. This 2D position is the position on the screen after the camera projection. WARNING: There's actually a third value (the z one) which correspond to the depth screen position.

Returns
Vector — Vector The 2D position of this vertex once projected.
getVector()method 
public final function getVector():Vector

Returns a vector representing the original x, y, z values.

Returns
Vector — The vector
getWorldVector()method 
public final function getWorldVector():Vector

Returns the transformed vertex in world coordinates.

Returns
Vector
negate()method 
public final function negate():Vertex

Return the invers of this vertex.

A new vertex is created with the negative of all values in this vertex.

Returns
Vertex — The invers
normalize()method 
public final function normalize():void

Normalizes this vertex.

Normalization means that all components of the vertex are divided by its norm.
The norm is calculated as the sqrt(x + y + z), that is the length of the position vector.

pow()method 
public final function pow(pow:Number):void

Raises the vertex to the specified power.

All components of this vertex is raised to the power specified in the argument.

Parameters
pow:Number — {
scale()method 
public final function scale(n:Number):void

Multiplies this vertex by the specified scalar value.

All components of the vertex are multiplied by the specified value

Parameters
n:Number — The number to multiply with
serialize()method 
public final function serialize(decPlaces:Number = 0):String

Returns a string representation of this vertex with rounded values.

[ToDo: Explain why this is good for XML output! ]

Parameters
decPlaces:Number (default = 0) — Number of decimals

Returns
String — The specific serialize string
sub()method 
public function sub(v:Vertex):void

Substracts a specified vertex from this vertex.

Parameters
v:Vertex — The vertex to subtract from this vertex
toString()method 
public final function toString(decPlaces:Number = 0):String

Returns a string representing this vertex.

Parameters
decPlaces:Number (default = 0) — Number of decimals

Returns
String — The representation
Constant detail
idconstant
public const id:uint