|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object
|
+--fi.utu.cs.physics.Particle
|
+--fi.utu.cs.physics.Boundary
|
+--fi.utu.cs.physics.BoundaryLine
A boundary line.
| Field Summary | |
static int |
HORIZONTAL
A horizontal boundary line. |
static int |
OTHER
Non-vertical and non-horizontal boundary line. |
static int |
VERTICAL
A vertical boundary line. |
| Fields inherited from class fi.utu.cs.physics.Boundary |
boundaryEpsilon |
| Constructor Summary | |
BoundaryLine(double px1,
double py1,
double px2,
double py2)
Constructs a boundary line from point ( px1,
py1) to point (px2, py2). |
|
BoundaryLine(Point2 p1,
Point2 p2)
Constructs a boundary line from point p1 to
point p2. |
|
| Method Summary | |
void |
elasticCollision(Body other)
Realizes an elastic collision for the static boundary and the body other.
|
Point2[] |
getEndPoints()
Returns a two-element array comprising the end points. |
int |
getType()
Returns the type of the boundary line. |
void |
inelasticCollision(Body other)
Realizes an inelastic collision for the static boundary and the body other.
|
protected boolean |
isCrossedByBoundingBox(double x1,
double y1,
double x2,
double y2,
double r)
Returns true, if the bounding box of the path
(x1, y1)-(x2, y2)
of a circle with a radius r crosses the boundary line;
otherwise, returns false. |
protected boolean |
isCrossedByLine(double x1,
double y1,
double x2,
double y2)
Returns true, if the line (x1,
y1)-(x2, y2)
crosses the boundary line; otherwise, returns false. |
java.lang.String |
toString()
Returns a string that contains the values of the attributes. |
| Methods inherited from class fi.utu.cs.physics.Boundary |
isCrossed |
| Methods inherited from class fi.utu.cs.physics.Particle |
addCollisionNotification, clearCollisionNotifications, getOwner, isCollisionNotified, isCollisionNotified, isCorporeal, removeCollisionNotification, setCorporeal, setEthereal, setOwner |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
public static final int OTHER
public static final int HORIZONTAL
public static final int VERTICAL
| Constructor Detail |
public BoundaryLine(double px1,
double py1,
double px2,
double py2)
px1,
py1) to point (px2, py2).
public BoundaryLine(Point2 p1,
Point2 p2)
p1 to
point p2.
| Method Detail |
public Point2[] getEndPoints()
public int getType()
HORIZONTAL,
VERTICAL,
OTHER
protected boolean isCrossedByBoundingBox(double x1,
double y1,
double x2,
double y2,
double r)
true, if the bounding box of the path
(x1, y1)-(x2, y2)
of a circle with a radius r crosses the boundary line;
otherwise, returns false.
isCrossedByBoundingBox in class Boundary
protected boolean isCrossedByLine(double x1,
double y1,
double x2,
double y2)
true, if the line (x1,
y1)-(x2, y2)
crosses the boundary line; otherwise, returns false.
isCrossedByLine in class Boundarypublic void elasticCollision(Body other)
other.
The linear momentum and kinetic energy of the body is conserved
in the collision.
elasticCollision in class ParticleParticle.inelasticCollision(Body)public void inelasticCollision(Body other)
other.
The linear momentum is conserved but kinetic energy is lost
in the collision.
inelasticCollision in class ParticleParticle.elasticCollision(Body)public java.lang.String toString()
toString in class Particle
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||