|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.brackeen.javagamebook.math3D.Polygon3D
The Polygon3D class represents a polygon as a series of vertices.
Constructor Summary | |
Polygon3D()
Creates an empty polygon that can be used as a "scratch" polygon for transforms, projections, etc. |
|
Polygon3D(Vector3D[] vertices)
Creates a new Polygon3D with the specified vertices. |
|
Polygon3D(Vector3D v0,
Vector3D v1,
Vector3D v2)
Creates a new Polygon3D with the specified vertices. |
|
Polygon3D(Vector3D v0,
Vector3D v1,
Vector3D v2,
Vector3D v3)
Creates a new Polygon3D with the specified vertices. |
Method Summary | |
void |
add(Transform3D xform)
|
void |
add(Vector3D u)
|
void |
addRotation(Transform3D xform)
|
Rectangle3D |
calcBoundingRectangle()
Calculates and returns the smallest bounding rectangle for this polygon. |
Vector3D |
calcNormal()
Calculates the unit-vector normal of this polygon. |
boolean |
clip(float clipZ)
Clips this polygon so that all vertices are in front of the clip plane, clipZ (in other words, all vertices have z <= clipZ). |
Vector3D |
getNormal()
Gets the normal of this polygon. |
int |
getNumVertices()
Gets the number of vertices this polygon has. |
Vector3D |
getVertex(int index)
Gets the vertex at the specified index. |
void |
insertVertex(int index,
Vector3D vertex)
Inserts a vertex into this polygon at the specified index. |
boolean |
isFacing(Vector3D u)
Tests if this polygon is facing the specified location. |
void |
project(ViewWindow view)
Projects this polygon onto the view window. |
void |
setNormal(Vector3D n)
Sets the normal of this polygon. |
void |
setTo(Polygon3D polygon)
Sets this polygon to the same vertices as the specfied polygon. |
void |
subtract(Transform3D xform)
|
void |
subtract(Vector3D u)
|
void |
subtractRotation(Transform3D xform)
|
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public Polygon3D()
public Polygon3D(Vector3D v0, Vector3D v1, Vector3D v2)
public Polygon3D(Vector3D v0, Vector3D v1, Vector3D v2, Vector3D v3)
public Polygon3D(Vector3D[] vertices)
Method Detail |
public void setTo(Polygon3D polygon)
public int getNumVertices()
public Vector3D getVertex(int index)
public void project(ViewWindow view)
public void add(Vector3D u)
add
in interface Transformable
public void subtract(Vector3D u)
subtract
in interface Transformable
public void add(Transform3D xform)
add
in interface Transformable
public void subtract(Transform3D xform)
subtract
in interface Transformable
public void addRotation(Transform3D xform)
addRotation
in interface Transformable
public void subtractRotation(Transform3D xform)
subtractRotation
in interface Transformable
public Vector3D calcNormal()
public Vector3D getNormal()
public void setNormal(Vector3D n)
public boolean isFacing(Vector3D u)
public boolean clip(float clipZ)
public void insertVertex(int index, Vector3D vertex)
public Rectangle3D calcBoundingRectangle()
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |