PinBallDomain
Interface Obstacle

All Known Implementing Classes:
PolygonObstacle, Target

public interface Obstacle

An interface to represent obstacles.

Author:
George Konidaris (gdk at cs dot umass dot edu)

Method Summary
 boolean collision(Ball b)
          Determine whether a collision with the ball has occurred.
 double[] collisionEffect(Ball b)
          Return the effect of a collision with the ball.
 Point getIntercept()
          Get the intercept position with the ball.
 boolean inside(Point p)
          Determine whether a point is inside an obstacle.
 void write(java.io.FileWriter f)
          Write this object to a file.
 

Method Detail

collisionEffect

double[] collisionEffect(Ball b)
Return the effect of a collision with the ball.

Parameters:
b - the ball
Returns:
changes to the ball's X and Y velocities

collision

boolean collision(Ball b)
Determine whether a collision with the ball has occurred.

Parameters:
b - the ball
Returns:
true if there is a collision, false otherwise

getIntercept

Point getIntercept()
Get the intercept position with the ball. This should be called after collision and collisionEffect.

Returns:
the point of collision

inside

boolean inside(Point p)
Determine whether a point is inside an obstacle.

Parameters:
p - the point to test
Returns:
true if p is inside the obstacle, false otherwise

write

void write(java.io.FileWriter f)
           throws java.io.IOException
Write this object to a file.

Parameters:
f - the file
Throws:
java.io.IOException