fi.utu.cs.physics
Class BoundaryCurve

java.lang.Object
  |
  +--fi.utu.cs.physics.Particle
        |
        +--fi.utu.cs.physics.Boundary
              |
              +--fi.utu.cs.physics.BoundaryCurve
Direct Known Subclasses:
Circle, CornerBoard, Goal, GoalCrease, GoalPost, Spot

public class BoundaryCurve
extends Boundary

A boundary curve.

Since:
1.1

Field Summary
 
Fields inherited from class fi.utu.cs.physics.Boundary
boundaryEpsilon
 
Constructor Summary
BoundaryCurve(double px, double py, double r)
          Constructs a boundary circle with a center in point (px, py) and a radius r
BoundaryCurve(double px, double py, double r, double a, double e)
          Constructs a boundary curve with a center in point (px, py), a radius r, a start angle a, and an angular extent e.
BoundaryCurve(Point2 p, double r)
          Constructs a boundary circle with a center in point p and a radius r
BoundaryCurve(Point2 p, double r, double a, double e)
          Constructs a boundary curve with a center in point p, a radius r, a start angle a, and an angular extent e.
 
Method Summary
 void elasticCollision(Body other)
          Realizes an elastic collision for the static boundary and the body other.
 double getAngularExtent()
          Returns the angular extent of the boundary curve.
 Point2 getCenter()
          Returns the center of the boundary curve.
 double getRadius()
          Returns the radius of the boundary curve.
 double getStartAngle()
          Returns the start angle of the boundary curve.
 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 curve; 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 curve; 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
 

Constructor Detail

BoundaryCurve

public BoundaryCurve(double px,
                     double py,
                     double r)
Constructs a boundary circle with a center in point (px, py) and a radius r


BoundaryCurve

public BoundaryCurve(Point2 p,
                     double r)
Constructs a boundary circle with a center in point p and a radius r


BoundaryCurve

public BoundaryCurve(double px,
                     double py,
                     double r,
                     double a,
                     double e)
Constructs a boundary curve with a center in point (px, py), a radius r, a start angle a, and an angular extent e. The angles are expressed in radians clockwise.


BoundaryCurve

public BoundaryCurve(Point2 p,
                     double r,
                     double a,
                     double e)
Constructs a boundary curve with a center in point p, a radius r, a start angle a, and an angular extent e. The angles are expressed in radians clockwise.

Method Detail

getCenter

public Point2 getCenter()
Returns the center of the boundary curve.


getRadius

public double getRadius()
Returns the radius of the boundary curve.


getStartAngle

public double getStartAngle()
Returns the start angle of the boundary curve.


getAngularExtent

public double getAngularExtent()
Returns the angular extent of the boundary curve.


isCrossedByBoundingBox

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 curve; otherwise, returns false.

Specified by:
isCrossedByBoundingBox in class Boundary

isCrossedByLine

protected boolean isCrossedByLine(double x1,
                                  double y1,
                                  double x2,
                                  double y2)
Returns true, if the line (x1, y1)-(x2, y2) crosses the boundary curve; otherwise, returns false.

Specified by:
isCrossedByLine in class Boundary

elasticCollision

public void elasticCollision(Body other)
Realizes an elastic collision for the static boundary and the body other. The linear momentum and kinetic energy of the body is conserved in the collision.

Specified by:
elasticCollision in class Particle
See Also:
Particle.inelasticCollision(Body)

inelasticCollision

public void inelasticCollision(Body other)
Realizes an inelastic collision for the static boundary and the body other. The linear momentum is conserved but kinetic energy is lost in the collision.

Specified by:
inelasticCollision in class Particle
See Also:
Particle.elasticCollision(Body)

toString

public java.lang.String toString()
Returns a string that contains the values of the attributes.

Overrides:
toString in class Particle