|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.ObjectPinBallDomain.PolygonObstacle
public class PolygonObstacle
Obstacle class for polygonal obstacles. This is the only type of obstacle implemented at the moment.
| Method Summary | |
|---|---|
boolean |
collision(Ball b)
Determine whether or not there has been a collision. |
double[] |
collisionEffect(Ball b)
Determine the effect of the ball's collision with the obstacle. |
static PolygonObstacle |
create(java.lang.String line)
Create a polygon obstacle from a line of configuration file text. |
Point |
getIntercept()
Get the last intercept point. |
java.util.ArrayList<Point> |
getPoints()
Get the Point variables making up the obstacle. |
boolean |
inside(Point p)
Determine whether a point lies within the polygon. |
static boolean |
matchTag(java.lang.String line)
Determine whether a given config input text line matches a polygon obstacle. |
void |
write(java.io.FileWriter f)
Write the polygon to a file. |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
|---|
public boolean collision(Ball b)
collision in interface Obstacleb - the ball
true if there was a collision, false if there wasn't.public double[] collisionEffect(Ball b)
collisionEffect in interface Obstacleb - the ball
public static boolean matchTag(java.lang.String line)
line - the input line
true if there's a match, false if not
public void write(java.io.FileWriter f)
throws java.io.IOException
write in interface Obstaclef - the file to write to
java.io.IOExceptionpublic static PolygonObstacle create(java.lang.String line)
line - the line
public java.util.ArrayList<Point> getPoints()
public Point getIntercept()
getIntercept in interface Obstaclepublic boolean inside(Point p)
inside in interface Obstaclep - the test point
true if p lies within the obstacle, false otherwise
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||