Packagesandy.core.scenegraph
Classpublic final class Geometry3D

The Geometry3D class holds a complete description of the geometry of a Shape3D. It contains points, faces, normals and uv coordinates. NOTE: For best performance, Geometry should be created in offline mode, especially all faces, as createFace() validates all points if these points exist in points array. NOTE: This object is going to work well _ONLY_ if arrays wont be changed directlly [ie. push()] but _ONLY_ via accessor methods: createFace, createFaceByIds, addFace, addFaces. In the future we can make these Arrays PRIVATE but then the only way to make them safe is to deliver additionall accessors like getPoint(index:int), getFace(index:int) what could potentially slow affect performance of this structure (well, we need to test it, and if there is no problem, make arrays private and provide accessors for _SINGLE_ array's elements to make them safe ).

[ToDo: Revise this and adopt tp ASDoc]



Public Properties
 PropertyDefined by
  aEdges : Array
Geometry3D
  aFaceEdges : Array
Geometry3D
  aFacesNormals : Array
Array ov normals
Geometry3D
  aFacesUVCoordsID : Array
Geometry3D
  aFacesVertexID : Array
Array of faces composed from vertices
Geometry3D
  aUVCoords : Array
UV Coords for faces
Geometry3D
  aVertex : Array
Array of vertices
Geometry3D
  aVertexNormals : Array
Geometry3D
Public Methods
 MethodDefined by
  
Geometry3D(p_points:Array = null)
Creates a 3D geometry.
Geometry3D
  
Returns a clone of this Geometry3D.
Geometry3D
  
dispose():void
Dispose all the geometry ressources.
Geometry3D
  
Geometry3D
  
Geometry3D
  
getNextFaceID():Number
Returns the next unused face id.
Geometry3D
  
Returns the next unused normal id.
Geometry3D
  
Returns the next unused face UV coordinates id.
Geometry3D
  
Returns the next unused UV coordinates id.
Geometry3D
  
getNextVertexID():Number
Returns the next unused vertex id.
Geometry3D
  
Returns the next unused vertex normal id.
Geometry3D
  
getVertexId(p_point:Vertex):Number
Returns the index of a specified point in the vertex list.
Geometry3D
  
init():void
Not used in this version.
Geometry3D
  
setFaceNormal(p_nNormalID:Number, p_nX:Number, p_nY:Number, p_nZ:Number):Number
Adds new normal at the specified index of the face normal list.
Geometry3D
  
setFaceUVCoordsIds(p_nFaceID:Number, ... arguments):Number
Set the ID's of face UV coordinates.
Geometry3D
  
setFaceVertexIds(p_nFaceID:Number, ... arguments):Number
Sets the ID's of the face vertices.
Geometry3D
  
setUVCoords(p_nID:Number, p_UValue:Number, p_nVValue:Number):Number
Adds UV coordinates for single face.
Geometry3D
  
setVertex(p_nVertexID:Number, p_nX:Number, p_nY:Number, p_nZ:Number):Number
Adds new point at the specified index of the vertex list.
Geometry3D
  
setVertexNormal(p_nNormalID:Number, p_nX:Number, p_nY:Number, p_nZ:Number):Number
Add new point the specified index of the vertex normal list.
Geometry3D
  
toString():String
Returns a string representation of this geometry.
Geometry3D
Property detail
aEdgesproperty
public var aEdges:Array
aFaceEdgesproperty 
public var aFaceEdges:Array
aFacesNormalsproperty 
public var aFacesNormals:Array

Array ov normals

aFacesUVCoordsIDproperty 
public var aFacesUVCoordsID:Array
aFacesVertexIDproperty 
public var aFacesVertexID:Array

Array of faces composed from vertices

aUVCoordsproperty 
public var aUVCoords:Array

UV Coords for faces

aVertexproperty 
public var aVertex:Array

Array of vertices

aVertexNormalsproperty 
public var aVertexNormals:Array
Constructor detail
Geometry3D()constructor
public function Geometry3D(p_points:Array = null)

Creates a 3D geometry.

Parameters
p_points:Array (default = null) — Not used in this version
Method detail
clone()method
public function clone():Geometry3D

Returns a clone of this Geometry3D.

NOTE: Because polygons also stores instance-specific data like Appearance on the Geometry level, we are considering it only as a set of connections between points, so only coordinates and normals are copied in the clone process.

Returns
Geometry3D — A copy of this geometry
dispose()method 
public function dispose():void

Dispose all the geometry ressources. Arrays data is removed, arrays are set to null value to make garbage collection possible

generateFaceNormals()method 
public function generateFaceNormals():void
generateVertexNormals()method 
public function generateVertexNormals():void
getNextFaceID()method 
public function getNextFaceID():Number

Returns the next unused face id.

This is the next free index in the faces list, and used by setFaceVertexIds

Returns
Number — The index
getNextFaceNormalID()method 
public function getNextFaceNormalID():Number

Returns the next unused normal id.

This is the next free index in the normal list, and used by setFaceNormal

Returns
Number — The normal id
getNextFaceUVCoordID()method 
public function getNextFaceUVCoordID():Number

Returns the next unused face UV coordinates id.

This is the next free index in the UV coordinate id list, and used by setFaceUVCoords

Returns
Number — The index
getNextUVCoordID()method 
public function getNextUVCoordID():Number

Returns the next unused UV coordinates id.

This is the next free index in the UV coordinates list, and used by setUVCoords

Returns
Number — The index
getNextVertexID()method 
public function getNextVertexID():Number

Returns the next unused vertex id.

this is the next free index in the verex list, and used by setVertex

Returns
Number — The vertex id
getNextVertexNormalID()method 
public function getNextVertexNormalID():Number

Returns the next unused vertex normal id.

This is the next free index in the vertex normal list, and used by setVertexNormal

Returns
Number — The vertex normal id
getVertexId()method 
public function getVertexId(p_point:Vertex):Number

Returns the index of a specified point in the vertex list.

Parameters
p_point:Vertex

Returns
Number — The index
init()method 
public function init():void

Not used in this version.

setFaceNormal()method 
public function setFaceNormal(p_nNormalID:Number, p_nX:Number, p_nY:Number, p_nZ:Number):Number

Adds new normal at the specified index of the face normal list.

Parameters
p_nNormalID:Number — Index at which to save the normal
 
p_nX:Number — The x component of the normal
 
p_nY:Number — The y component of the normal
 
p_nZ:Number — The z component of the normal

Returns
Number — The next free index or -1 it the index is already occupied
setFaceUVCoordsIds()method 
public function setFaceUVCoordsIds(p_nFaceID:Number, ... arguments):Number

Set the ID's of face UV coordinates.

Parameters
p_nFaceID:Number — The id of the face
 
... arguments — An array of data containing the ID's of the UV coords list for the face

Returns
Number — The next free index or -1 it the index is already occupied
setFaceVertexIds()method 
public function setFaceVertexIds(p_nFaceID:Number, ... arguments):Number

Sets the ID's of the face vertices.

Parameters
p_nFaceID:Number — Id of the face
 
... arguments

Returns
Number — The next free index or -1 it the index is already occupied
setUVCoords()method 
public function setUVCoords(p_nID:Number, p_UValue:Number, p_nVValue:Number):Number

Adds UV coordinates for single face. [ToDo: Explain this ]

Parameters
p_nID:Number — The id of the face
 
p_UValue:Number — The u component of the UV coordinate
 
p_nVValue:Number — The v component of the UV coordinate

Returns
Number — The next free index or -1 it the index is already occupied
setVertex()method 
public function setVertex(p_nVertexID:Number, p_nX:Number, p_nY:Number, p_nZ:Number):Number

Adds new point at the specified index of the vertex list.

Parameters
p_nVertexID:Number — Index at which to save the vertex
 
p_nX:Number — x coordinate of the vertex
 
p_nY:Number — y coordinate of the vertex
 
p_nZ:Number — z coordinate of the vertex

Returns
Number — The next free index or -1 it the index is already occupied
setVertexNormal()method 
public function setVertexNormal(p_nNormalID:Number, p_nX:Number, p_nY:Number, p_nZ:Number):Number

Add new point the specified index of the vertex normal list.

Parameters
p_nNormalID:Number — Index at which to save the vertex normal
 
p_nX:Number — x coordinate of the vertex normal
 
p_nY:Number — y coordinate of the vertex normal
 
p_nZ:Number — z coordinate of the vertex normal

Returns
Number — The next free index or -1 it the index is already occupied
toString()method 
public function toString():String

Returns a string representation of this geometry.

The string contins the lengths of the arrays of data defining this geometry.

[ToDo: Decide if this is the best representation ]

Returns
String — The string representation