Class Mesh.Polygon

java.lang.Object
  |
  +--Mesh.Polygon
Enclosing class:
Mesh

public static class Mesh.Polygon
extends Object
implements Cloneable

Represents one polygon in the mesh.


Field Summary
protected  Color color
          The color of this polygon.
protected  PlaneEquation equation
          The plane equation for this polygon.
protected  RGBTriplet KAmbient
           
protected  RGBTriplet KDiffuse
           
protected  RGBTriplet KSpecular
          The object reflectance
protected  float N
          The specular-reflection parameter
protected  Mesh owner
          The owner mesh which this polygon belongs to.
protected  int[] verticesIndex
          The array of indices to the points in the owner mesh.
protected  double xMax
          the maximum x value.
protected  double xMin
          the minimum x value.
protected  double yMax
          the maximum y value.
protected  double yMin
          the minimum y value
protected  double zMax
          the maximum Z value.
protected  double zMin
          the minimum Z value
 
Constructor Summary
Mesh.Polygon(Mesh owner, int[] vi)
          Polygon
Mesh.Polygon(Mesh owner, int[] vi, Color col)
           
Mesh.Polygon(Mesh owner, int[] vi, Color col, RGBTriplet KAmbient, RGBTriplet KDiffuse, RGBTriplet KSpecular, float N)
           
 
Method Summary
protected  void calcBoundaries()
          Calculates minZ and maxZ
 Object clone()
           
 Color getColor()
          Returns the color of the polygon surface.
 PlaneEquation getEquation()
          Returns the plane equation for this polygon.
 RGBTriplet getKAmbient()
           
 RGBTriplet getKDiffuse()
           
 RGBTriplet getKSpecular()
           
 float getN()
          Returns the normal vector of this polygon.
 Mesh getOwner()
          Returns the owning mesh object of this polygon.
 int[] getVerticesIndex()
          Returns the indexes to the vertices in the owner Mesh object.
 double getXMax()
          Returns the maximum x value.
 double getXMin()
          Returns the minimum x value.
 double getYMax()
          Returns the maximum y value.
 double getYMin()
          Returns the minimum y value.
 double getZMax()
          Returns the maximum z value.
 double getZMin()
          Returns the minimum z value.
 void setN(float n)
          Sets the normal vector of this polygon.
 String toString()
          Returns the string representation of this polygon.
 
Methods inherited from class java.lang.Object
, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, wait, wait, wait
 

Field Detail

KSpecular

protected RGBTriplet KSpecular
The object reflectance

KAmbient

protected RGBTriplet KAmbient

KDiffuse

protected RGBTriplet KDiffuse

N

protected float N
The specular-reflection parameter

verticesIndex

protected int[] verticesIndex
The array of indices to the points in the owner mesh.

owner

protected Mesh owner
The owner mesh which this polygon belongs to. The verticesIndex property indexes the vertices array of this owner.
See Also:
verticesIndex, Mesh.vertices

color

protected Color color
The color of this polygon.

equation

protected PlaneEquation equation
The plane equation for this polygon.

xMax

protected double xMax
the maximum x value.

yMax

protected double yMax
the maximum y value.

zMax

protected double zMax
the maximum Z value.

xMin

protected double xMin
the minimum x value.

yMin

protected double yMin
the minimum y value

zMin

protected double zMin
the minimum Z value
Constructor Detail

Mesh.Polygon

public Mesh.Polygon(Mesh owner,
                    int[] vi)
Polygon

Mesh.Polygon

public Mesh.Polygon(Mesh owner,
                    int[] vi,
                    Color col)

Mesh.Polygon

public Mesh.Polygon(Mesh owner,
                    int[] vi,
                    Color col,
                    RGBTriplet KAmbient,
                    RGBTriplet KDiffuse,
                    RGBTriplet KSpecular,
                    float N)
Method Detail

toString

public String toString()
Returns the string representation of this polygon. Format: owner[ { xMin,xMax; yMin,yMax; zMin,zMax } (x1,y1,z1) (x1,y1,z1) ... ]
Overrides:
toString in class Object

getKAmbient

public RGBTriplet getKAmbient()

getKDiffuse

public RGBTriplet getKDiffuse()

getKSpecular

public RGBTriplet getKSpecular()

getN

public float getN()
Returns the normal vector of this polygon.

setN

public void setN(float n)
Sets the normal vector of this polygon.

getOwner

public Mesh getOwner()
Returns the owning mesh object of this polygon.

getVerticesIndex

public int[] getVerticesIndex()
Returns the indexes to the vertices in the owner Mesh object.

getColor

public Color getColor()
Returns the color of the polygon surface.

clone

public Object clone()
Overrides:
clone in class Object

getXMax

public double getXMax()
Returns the maximum x value.

getYMax

public double getYMax()
Returns the maximum y value.

getZMax

public double getZMax()
Returns the maximum z value.

getXMin

public double getXMin()
Returns the minimum x value.

getYMin

public double getYMin()
Returns the minimum y value.

getZMin

public double getZMin()
Returns the minimum z value.

getEquation

public PlaneEquation getEquation()
Returns the plane equation for this polygon.

calcBoundaries

protected void calcBoundaries()
Calculates minZ and maxZ