|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.speckled.specksim.imp.motion.Body
public class Body
Represents a convex body.
| Field Summary | |
|---|---|
protected float[] |
faceAreas
An array containing the areas of each face |
protected int[][] |
faces
An array of 3-element arrays, containing the indices of the vertices of each triangular face |
protected Point3d[] |
vertices
An array of the vertices of the body |
| Constructor Summary | |
|---|---|
Body(double[] vertexComponents)
Construct a new Body. |
|
| Method Summary | |
|---|---|
static Body |
buildCuboid(double xLength,
double yLength,
double zLength)
Build an axis-aligned cuboid body, centered on the origin |
boolean |
contains(Point3d point)
Determines if the supplied point lies inside the body |
Point3d[] |
getBoundingBox()
Gets the bounding box for this body |
int[][] |
getFaces()
Gets the face arrays of this body. |
float |
getSurfaceArea()
Gets the surface area of this body |
Point3d[] |
getVertices()
Gets the vertices of this body |
float |
getVolume()
Gets the volume of this body |
Point3d |
pointInVolume(java.util.Random random)
Generates a point that lies inside the volume of this body. |
Point3d |
pointOnSurface(java.util.Random random)
Generates a random point that lies on the surface of this body. |
java.lang.String |
toString()
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
protected final Point3d[] vertices
protected final int[][] faces
protected final float[] faceAreas
| Constructor Detail |
|---|
public Body(double[] vertexComponents)
vertexComponents - The vertices of this body in [ x1, y1, z1, x2, y2, z3,
... , yn, zn ] format| Method Detail |
|---|
public java.lang.String toString()
toString in class java.lang.Objectpublic float getSurfaceArea()
public float getVolume()
public boolean contains(Point3d point)
point - The point to test for inclusion
public Point3d[] getBoundingBox()
public Point3d pointOnSurface(java.util.Random random)
random - The random number generator to use
public Point3d pointInVolume(java.util.Random random)
random - The random number generator to use
public Point3d[] getVertices()
public int[][] getFaces()
public static Body buildCuboid(double xLength,
double yLength,
double zLength)
xLength - The length of the cuboid on the x-axisyLength - The length of the cuboid on the y-axiszLength - The length of the cuboid on the z-axis
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||