|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.dolben.anim.Body
public class Body
Body moves a solid around in 3D space; rotating it, translating it, and bouncing it off of other bodies and the walls of its enclosure.
Constructor Summary | |
---|---|
Body(Solid s)
Creates a new Body for a given solid. |
Method Summary | |
---|---|
void |
collide(Body other)
Bounces this body off of another when they collide. |
int |
compareTo(java.lang.Object object)
Orders Bodies from farthest to nearest to an observer, presumed to be at a large z coordinate, making the class Comparable. |
double |
getCollisionRadius()
Gets the solid's collision radius (a hack) |
void |
paint(Projector projector,
java.awt.Graphics graphics)
Draws the solid. |
void |
setRotation(double[][] r)
Sets the rotation to be done with each step of motion. |
void |
setVelocity(double[] v,
double[] limit)
Sets the velocity and limit of translation. |
void |
step()
Moves the polyhedron one step. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Body(Solid s)
s
- the solid to be movedMethod Detail |
---|
public void paint(Projector projector, java.awt.Graphics graphics)
projector
- the projector that maps 3D to Graphics coordinatesgraphics
- the drawing contextpublic double getCollisionRadius()
public int compareTo(java.lang.Object object)
compareTo
in interface java.lang.Comparable
object
- another body to compare to
public void setRotation(double[][] r)
r
- the 3D rotation matrixpublic void setVelocity(double[] v, double[] limit)
v
- the 3D velocity vectorlimit
- the limit of displacement from the origin
in each dimensionpublic void step()
public void collide(Body other)
Bounces this body off of another when they collide.
The objects are considered to be spheres of the same mass.
The threshhold distance for a collision is less than the sum of the radii of the circumspheres, since the objects often appear to miss at greater distance.
other
- the other body in a collision
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |