Class Mesh

java.lang.Object
  |
  +--Mesh

public class Mesh
extends Object
implements Cloneable

Represents an object in 3D space expressed by a polygon mesh.

Version:
2.0
Author:
Sasmito Adibowo

Inner Class Summary
static class Mesh.Polygon
          Represents one polygon in the mesh.
static class Mesh.SameSurface
          Represents SameSurface
 
Field Summary
protected  CoorSys coorSys
          Represents the coordinate system used.
protected  String name
          The name of the mesh.
protected  Mesh.Polygon[] polygons
          A list of PolygonMesh.Polygon objects that defines the polygons in the mesh.
static CoorSys REAL_WORLD
          RealWorld coordinates
protected  Mesh.SameSurface[] sameSurface
           
protected  Point3D[] vertices
          A list containing Point3D objects that are all the vertices in the mesh.
 
Constructor Summary
(package private) Mesh(String name)
          Constructs the mesh object.
(package private) Mesh(String name, Point3D[] vertices, Mesh.Polygon[] poly)
          Constructs the mesh object.
 
Method Summary
 Object clone()
           
 boolean equals(Object o)
          True if the name of this mesh is equal to the name of the other mesh.
 CoorSys getCoorSys()
          Returns the coordinate system associated with the mesh.
 String getName()
          Returns the name of the polygon mesh.
 Mesh.Polygon[] getPolygons()
          returns the array of polygons in the mesh.
 Point3D[] getVertices()
          Returns the array of points that makes up the mesh.
 int hashCode()
          Returns the hash code for the Mesh's name.
 void setCoorSys(CoorSys cs)
          Sets the coordinate system.
 void setPolygons(Mesh.Polygon[] poly)
          Sets the polygon arrays to the mesh
 void setSameSurface(Mesh.SameSurface[] ss)
           
 void setVertices(Point3D[] pts)
          Sets the array of vertices of the mesh.
 String toString()
          Returns the name of the polygon mesh.
 
Methods inherited from class java.lang.Object
, finalize, getClass, notify, notifyAll, registerNatives, wait, wait, wait
 

Field Detail

name

protected String name
The name of the mesh.

vertices

protected Point3D[] vertices
A list containing Point3D objects that are all the vertices in the mesh. The vertices are in private coordinate system.
See Also:
Point3D

polygons

protected Mesh.Polygon[] polygons
A list of PolygonMesh.Polygon objects that defines the polygons in the mesh.
See Also:
Mesh.Polygon

sameSurface

protected Mesh.SameSurface[] sameSurface

coorSys

protected CoorSys coorSys
Represents the coordinate system used.

REAL_WORLD

public static final CoorSys REAL_WORLD
RealWorld coordinates
Constructor Detail

Mesh

Mesh(String name)
Constructs the mesh object.
Parameters:
name - the name of the mesh object.

Mesh

Mesh(String name,
     Point3D[] vertices,
     Mesh.Polygon[] poly)
Constructs the mesh object.
Parameters:
name - the name of the mesh object.
vertices - the points that make up the mesh.
poly - the polygons of the mesh.
Method Detail

setVertices

public void setVertices(Point3D[] pts)
Sets the array of vertices of the mesh.

hashCode

public int hashCode()
Returns the hash code for the Mesh's name. Required to facilitate placement of the mesh in a hashtable, so that if the mesh data changes, the hash code wouldn't change.
Overrides:
hashCode in class Object

equals

public boolean equals(Object o)
True if the name of this mesh is equal to the name of the other mesh. Required to facilitate placement of the mesh in a hashtable, so that when the mesh data changes, the hash code wouldn't change.
Overrides:
equals in class Object
Returns:
getname().equals(o.getName())

setPolygons

public void setPolygons(Mesh.Polygon[] poly)
Sets the polygon arrays to the mesh

setCoorSys

public void setCoorSys(CoorSys cs)
Sets the coordinate system.
Parameters:
cs - the new coordinate system.

setSameSurface

public void setSameSurface(Mesh.SameSurface[] ss)

getCoorSys

public CoorSys getCoorSys()
Returns the coordinate system associated with the mesh.

getVertices

public Point3D[] getVertices()
Returns the array of points that makes up the mesh.

getPolygons

public Mesh.Polygon[] getPolygons()
returns the array of polygons in the mesh.

getName

public String getName()
Returns the name of the polygon mesh.

toString

public String toString()
Returns the name of the polygon mesh.
Overrides:
toString in class Object

clone

public Object clone()
Overrides:
clone in class Object