|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.dolben.poly.Polyhedron
public abstract class Polyhedron
Representation of a polyhedron, its vertices and faces in 3D, that can be scaled, translated and rotated. Override create() to set the vertices and faces for a particular geometric form.
Field Summary | |
---|---|
protected int[][] |
face
Each element of the 'face' array is an array of indices into the 'vertex' array for the (co-planar) points of a face of the polyhedron, ordered such that an adjacent pair (and the first and last) are (the indices of) the end-points of an edge, and the direction of a cycle produces by the right-hand rule an outward pointing normal to the face. |
protected double[][] |
vertex
Each vertex is a 3D vector from the origin of the coordinate system. |
Constructor Summary | |
---|---|
Polyhedron()
Constructs a Polyhedron centered on the origin. |
Method Summary | |
---|---|
protected abstract void |
create()
Sets the vertex and face elements. |
double[][] |
getFace(int index)
Gets an indexed face of the polyhedron, where each element of the array is a vertex of the face's polygon. |
int[] |
getFaceIndices(int index)
Gets the vertex indices of an indexed face of the polyhedron. |
int |
getFaces()
Gets the number of faces of the polyhedron. |
double[] |
getPosition()
Gets the position of the polyhedron, a 3D vector to its center. |
double |
getRadius()
Gets the radius of the polyhedron's circumsphere. |
double[] |
getVertex(int index)
Gets an indexed vertex of the polyhedron. |
int |
getVertexCount()
Gets the number of vertices of the polyhedron. |
double[][] |
getVertices()
Gets the array of vertices of the polyhedron. |
void |
rotate(double[][] rotation)
Rotates the polyhedron by the given 3D rotation matrix. |
void |
scale(double factor)
Scales the polyhedron, multiplying the distance between the center and each vertex by the given argument. |
void |
setRadius(double radius)
Scales the polydron, setting the radius of its circumsphere to the given argument. |
java.lang.String |
toString()
Makes a String representation of the polyhedron. |
void |
translate(double[] displacement)
Translates the polyhedron by the given 3D vector. |
void |
turnInsideOut()
Turns the polyhedron inside-out, e.g., viewed from the inside when was viewed from the outside. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected double[][] vertex
protected int[][] face
Constructor Detail |
---|
public Polyhedron()
Method Detail |
---|
protected abstract void create()
public void setRadius(double radius)
radius
- the new radiuspublic double getRadius()
public double[] getPosition()
public void scale(double factor)
factor
- the scale factorpublic void translate(double[] displacement)
displacement
- the translation vectorpublic void rotate(double[][] rotation)
rotation
- the rotation matrixpublic int getVertexCount()
public double[][] getVertices()
public double[] getVertex(int index)
index
- the index of the face to get
public int getFaces()
public int[] getFaceIndices(int index)
index
- the index of the face to get
public double[][] getFace(int index)
index
- the index of the face to getpublic void turnInsideOut()
public java.lang.String toString()
toString
in class java.lang.Object
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |