Packagealternativa.engine3d.core
Classpublic class Mesh
InheritanceMesh Inheritance Object3D
SubclassesBox, Cone, GeoPlane, GeoSphere, Plane, Sphere

Base class for three-dimentional objects, consisting of a set of vertices and faces.



Public Properties
 PropertyDefined by
 Inheritedchildren : Set
A set of child objects.
Object3D
 Inheritedcoords : Point3D
Object coordinates.
Object3D
  faces : Map
[read-only] A set of an object faces.
Mesh
 Inheritedmobility : int
Mobility level.
Object3D
 InheritedmouseEnabled : Boolean = true
Specifies whether this object receives mouse messages.
Object3D
 Inheritedname : String
Object name.
Object3D
 Inheritedparent : Object3D
Parent object.
Object3D
 InheritedrotationX : Number
X-axis rotation angle in radians.
Object3D
 InheritedrotationY : Number
Y-axis rotation angle in radians.
Object3D
 InheritedrotationZ : Number
Z-axis rotation angle in radians.
Object3D
 InheritedscaleX : Number
X-axis scale coefficient.
Object3D
 InheritedscaleY : Number
Y-axis scale coefficient.
Object3D
 InheritedscaleZ : Number
Z-axis scale coefficient.
Object3D
 Inheritedscene : Scene3D
Scene containing given object.
Object3D
  surfaces : Map
[read-only] A set of object's surfaces.
Mesh
 Inheritedtransformation : Matrix3D
Full (global) transformation matrix of an object.
Object3D
  vertices : Map
[read-only] A set of object's vertices.
Mesh
 Inheritedx : Number
X coordinate.
Object3D
 Inheritedy : Number
Y coordinate.
Object3D
 Inheritedz : Number
Z coordinate.
Object3D
Public Methods
 MethodDefined by
  
Mesh(name:String = null)
Create an instance of class.
Mesh
 Inherited
Adds a child object.
Object3D
 Inherited
addEventListener(type:String, listener:Function, useCapture:Boolean = false, priority:int = 0, useWeakReference:Boolean = false):void
Registers an event listener.
Object3D
 Inherited
Clones object.
Object3D
  
Setting a material for all surfaces of the object.
Mesh
  
createFace(vertices:Array, id:Object = null):Face
Add new face.
Mesh
  
createSurface(faces:Array = null, id:Object = null):Surface
Add new surface.
Mesh
  
createVertex(x:Number = 0, y:Number = 0, z:Number = 0, id:Object = null):Vertex
Add new vertex.
Mesh
 Inherited
dispatchEvent(event:Event):Boolean
Dispatches an event.
Object3D
 Inherited
forEach(func:Function):void
Calls the specified function for the object an all its children, passing the current object as an argument.
Object3D
 Inherited
getChildByName(name:String, deep:Boolean = false):Object3D
Gets a child object with the given name.
Object3D
  
getFaceById(id:Object):Face
Get face by it's identifier
Mesh
  
getFaceId(face:Face):Object
Get face identifier.
Mesh
  
getSurfaceById(id:Object):Surface
Get surface by it's identifier
Mesh
  
getSurfaceId(surface:Surface):Object
Get surface identifier.
Mesh
  
getVertexById(id:Object):Vertex
Get vertex by it's identifier
Mesh
  
getVertexId(vertex:Vertex):Object
Get vertex identifier
Mesh
 Inherited
globalToLocal(point:Point3D, result:Point3D = null):Point3D
Transforms a point form global coordinate system to an object's coordinate system
Object3D
 Inherited
hasEventListener(type:String):Boolean
Checks if there are registered event listeners for events of the specified type.
Object3D
  
hasFace(face:Object):Boolean
Check if face is present in object.
Mesh
  
hasSurface(surface:Object):Boolean
Check if surface is present in object.
Mesh
  
hasVertex(vertex:Object):Boolean
Check if vertex is present in object.
Mesh
 Inherited
localToGlobal(point:Point3D, result:Point3D = null):Point3D
Transforms a point from local coordinate system of an object to global coordinate system.
Object3D
  
moveAllFacesToSurface(surface:Object = null, removeSurfaces:Boolean = false):Surface
Adds all object faces to a given surface.
Mesh
 Inherited
Delete child object.
Object3D
 Inherited
removeEventListener(type:String, listener:Function, useCapture:Boolean = false):void
Removes an event listener.
Object3D
  
removeFace(face:Object):Face
Delete face.
Mesh
  
removeSurface(surface:Object):Surface
Delete surface.
Mesh
  
removeVertex(vertex:Object):Vertex
Delete vertex.
Mesh
  
setMaterialToSurface(material:SurfaceMaterial, surface:Object):void
Set material to a given surface.
Mesh
  
setUVsToFace(aUV:Point, bUV:Point, cUV:Point, face:Object):void
Set UV-coordinates to a given face.
Mesh
  
toString():String
Get string representation of object.
Mesh
 Inherited
willTrigger(type:String):Boolean
Object3D
Protected Methods
 MethodDefined by
 Inherited
addToScene(scene:Scene3D):void
Method is being called when adding object to scene.
Object3D
  
Copy source object properties.
Mesh
  
Create empty object without inner structure.
Mesh
  
defaultName():String
Default object name.
Mesh
 Inherited
Method is being called whed deleting object from a scene.
Object3D
Events
 EventSummaryDefined by
 Inherited Dispatched when a user presses and releases left mouse button over the same object.Object3D
 Inherited Dispatched when a user presses left mouse button over an object.Object3D
 Inherited Dispatched when a user moves mouse pointer while it is over an object.Object3D
 Inherited Dispatched when a user moves mouse pointer away from an object.Object3D
 Inherited Dispatched when a user moves mouse pointer over an object.Object3D
 Inherited Dispatched when a user releases left mouse button over an object.Object3D
 Inherited Dispatched when a user spins mouse wheel over an object.Object3D
Property detail
facesproperty
faces:Map  [read-only]

A set of an object faces. Map keys are faces' identifiers.

Implementation
    public function get faces():Map
surfacesproperty 
surfaces:Map  [read-only]

A set of object's surfaces. Map keys are surfaces' identifiers.

Implementation
    public function get surfaces():Map
verticesproperty 
vertices:Map  [read-only]

A set of object's vertices. Map keys are surfaces' identifiers.

Implementation
    public function get vertices():Map
Constructor detail
Mesh()constructor
public function Mesh(name:String = null)

Create an instance of class.

Parameters
name:String (default = null)instance name
Method detail
cloneMaterialToAllSurfaces()method
public function cloneMaterialToAllSurfaces(material:SurfaceMaterial):void

Setting a material for all surfaces of the object. For each surface a copy of the material is being set. If null value is passed then materials of all surfaces are cleared.

Parameters
material:SurfaceMaterialmeterial that is being set
clonePropertiesFrom()method 
protected override function clonePropertiesFrom(source:Object3D):void

Copy source object properties. This method is being used in clone() method and must be redefined in it's descendants to get a right object. Every descendant must copy only properties that were added to base class in this exact method. Inherited properties copying is made by calling super.clonePropertiesFrom(source).

Parameters
source:Object3Dobject, which properties are being copied
createEmptyObject()method 
protected override function createEmptyObject():Object3D

Create empty object without inner structure. For example, if geometrical primitive, when added, forms a bunch of vertices, faces and surfaces, this method don't create them. This method is being used in clone() and has to be redefined in descendants in order to get the right object.

Returns
Object3Da new empty object
createFace()method 
public function createFace(vertices:Array, id:Object = null):Face

Add new face.

Parameters
vertices:ArrayA set of face's vertices, in counterclockwise order. Every array element is the alternativa.engine3d.core.Vertex class instance, or face's vertice identifier. In both cases an object must contain given vertice.
 
id:Object (default = null)face identifier. If null value is given, the identifier will be created automatically.

Returns
Faceadded face instance

Throws
FaceNeedMoreVerticesError invalid vertex identifier value
 
FaceExistsError invalid vertex identifier value
 
InvalidIDError invalid vertex identifier value
 
VertexNotFoundError invalid vertex identifier value

See also

createSurface()method 
public function createSurface(faces:Array = null, id:Object = null):Surface

Add new surface.

Parameters
faces:Array (default = null)a set of faces containing the surface. Avery array element is alternativa.engine3d.core.Face class instance or face identifier. In both cases an object must contain given face. If null is given, an empty surface will be created. If any face is placed in other surface, it will be moved to a new one.
 
id:Object (default = null)new surface identifier. If null is given, the identifier will be created automatically.

Returns
Surfaceadded surface instance

Throws
SurfaceExistsError an attempt to refer to a face with reserved value
 
InvalidIDError an attempt to refer to a face with reserved value

See also

createVertex()method 
public function createVertex(x:Number = 0, y:Number = 0, z:Number = 0, id:Object = null):Vertex

Add new vertex.

Parameters
x:Number (default = 0)X coordinate in local coordinates system
 
y:Number (default = 0)Y coordinate in local coordinates system
 
z:Number (default = 0)Z coordinate in local coordinates system
 
id:Object (default = null)vertex identifier. If null is given, the identifier will be created automatically.

Returns
Vertexadded vertex instance

Throws
VertexExistsError an attempt to refer to a face with reserved value
 
InvalidIDError an attempt to refer to a face with reserved value
defaultName()method 
protected override function defaultName():String

Default object name.

Returns
Stringdefault object name
getFaceById()method 
public function getFaceById(id:Object):Face

Get face by it's identifier

Parameters
id:Objectface identifier

Returns
Facea face with given ID

Throws
FaceNotFoundError invalid face identifier value
 
InvalidIDError invalid face identifier value
getFaceId()method 
public function getFaceId(face:Face):Object

Get face identifier.

Parameters
face:Faceface instance

Returns
Objectthe identifier of given face

Throws
FaceNotFoundError object does not contain given face
getSurfaceById()method 
public function getSurfaceById(id:Object):Surface

Get surface by it's identifier

Parameters
id:Objectsurface identifier

Returns
Surfacea surface instance with given ID

Throws
SurfaceNotFoundError invalid surface identifier value
 
InvalidIDError invalid surface identifier value
getSurfaceId()method 
public function getSurfaceId(surface:Surface):Object

Get surface identifier.

Parameters
surface:Surfacesurface instance

Returns
Objectsurface identifier

Throws
SurfaceNotFoundError object does not contain given surface
getVertexById()method 
public function getVertexById(id:Object):Vertex

Get vertex by it's identifier

Parameters
id:Objectvertex identifier

Returns
Vertexa vertex instance with given ID

Throws
VertexNotFoundError invalid vertex identifier value
 
InvalidIDError invalid vertex identifier value
getVertexId()method 
public function getVertexId(vertex:Vertex):Object

Get vertex identifier

Parameters
vertex:Vertexvertices

Returns
Objectvertex identifier

Throws
VertexNotFoundError object does not contain given vertex
hasFace()method 
public function hasFace(face:Object):Boolean

Check if face is present in object.

Parameters
face:ObjectFace class instance or face identifier

Returns
Booleantrue, if the object contains given face, otherwise false

Throws
FaceNotFoundError invalid face identifier value
 
InvalidIDError invalid face identifier value
hasSurface()method 
public function hasSurface(surface:Object):Boolean

Check if surface is present in object.

Parameters
surface:ObjectSurface class instance or face identifier

Returns
Booleantrue, if the object contains given surface, otherwise false

Throws
SurfaceNotFoundError invalid surface identifier value
 
InvalidIDError invalid surface identifier value
hasVertex()method 
public function hasVertex(vertex:Object):Boolean

Check if vertex is present in object.

Parameters
vertex:Objectalternativa.engine3d.core.Vertex class instance or vertex identifier

Returns
Booleantrue if the object contains given vertex, otherwise false

Throws
VertexNotFoundError invalid vertex identifier value
 
InvalidIDError invalid vertex identifier value

See also

moveAllFacesToSurface()method 
public function moveAllFacesToSurface(surface:Object = null, removeSurfaces:Boolean = false):Surface

Adds all object faces to a given surface.

Parameters
surface:Object (default = null)alternativa.engine3d.core.Surface class instance or surface indentifier, in which faces are being added. If identifier is set, and there is no such surface, a new surface will be created.
 
removeSurfaces:Boolean (default = false)to remove or not to remove empty surfaces after faces removing

Returns
Surfacea surface to which faces were moved

Throws
SurfaceNotFoundError an attempt to refer to a face with reserved value
 
InvalidIDError an attempt to refer to a face with reserved value
removeFace()method 
public function removeFace(face:Object):Face

Delete face.

Parameters
face:Objectalternativa.engine3d.core.Face class instance or face identifier

Returns
Facethe instance of the removed face

Throws
FaceNotFoundError invalid face identifier value
 
InvalidIDError invalid face identifier value
removeSurface()method 
public function removeSurface(surface:Object):Surface

Delete surface.

Parameters
surface:Objectalternativa.engine3d.core.Face class instance or face identifier

Returns
Surfacethe instance of the removed surface

Throws
SurfaceNotFoundError invalid surface identifier value
 
InvalidIDError invalid surface identifier value
removeVertex()method 
public function removeVertex(vertex:Object):Vertex

Delete vertex. Faces containing this vertex will be deleted too.

Parameters
vertex:Objectalternativa.engine3d.core.Vertex class instance or vertex identifier

Returns
Vertexthe instance of the removed vertex

Throws
VertexNotFoundError invalid vertex identifier
 
InvalidIDError invalid vertex identifier
setMaterialToSurface()method 
public function setMaterialToSurface(material:SurfaceMaterial, surface:Object):void

Set material to a given surface.

Parameters
material:SurfaceMaterialmeterial that is being set to a surface. One SurfaceMaterial may be assigned to only one surface.
 
surface:Objectalternativa.engine3d.core.Surface class instance or surface identifier

Throws
SurfaceNotFoundError invalid surface identifier value
 
InvalidIDError invalid surface identifier value

See also

setUVsToFace()method 
public function setUVsToFace(aUV:Point, bUV:Point, cUV:Point, face:Object):void

Set UV-coordinates to a given face. Transformation matrix is being calculated using first three vertices of the face.

Parameters
aUV:PointUV-coordinates of first vertex
 
bUV:PointUV-coordinates of second vertex
 
cUV:PointUV-coordinates of third vertex
 
face:Objectalternativa.engine3d.core.Face class instance or face identifier

Throws
FaceNotFoundError invalid face identifier value
 
InvalidIDError invalid face identifier value

See also

toString()method 
public override function toString():String

Get string representation of object.

Returns
Stringa string representation of the object