|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectedu.umd.cfar.lamp.viper.geometry.Circle
A circle, specified by the center point and the radius in integer format, supporting functions necessary for simple comparison. It does not support the functions necessary for advanced comparison (union, etc.) yet.
| Field Summary |
| Fields inherited from interface edu.umd.cfar.lamp.viper.geometry.Moveable |
EAST, NORTH, NORTHEAST, NORTHWEST, SOUTH, SOUTHEAST, SOUTHWEST, WEST |
| Constructor Summary | |
Circle()
creates circle at (0,0) with radius = 0. |
|
Circle(Circle old)
Copy constructor for the circle. |
|
Circle(int x,
int y,
int r)
Creates circle with center (x,y) and radius = r |
|
| Method Summary | |
double |
area()
Approximates the area of the circle. |
java.lang.Object |
clone()
Copies the circle. |
boolean |
contains(Pnt point)
Tests to see if the given point is within the circle. |
boolean |
equals(java.lang.Object o)
Tests to see if this circle is the same one as the specified circle. |
BoundingBox |
getBoundingBox()
Gets the closest square surrounding the circle. |
Pnt |
getCenter()
Returns the center of the circle. |
Pnt |
getCentroid()
Gets a copy of the centroid. |
int |
getRadius()
Gets the circle's radius. |
double |
intersectArea(Circle other)
Approximates the shared area of two circles. |
Moveable |
move(int direction,
int distance)
Creates a new copy of this movable item, shifted in the given direction by the given number of pixels. |
Moveable |
shift(int x,
int y)
Shifts the moveable by the given amount. |
java.lang.String |
toString()
Prints out the circle in the ViPER format. |
static Circle |
valueOf(java.lang.String S)
Creates a new Circle from the string. |
| Methods inherited from class java.lang.Object |
finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
public Circle()
public Circle(int x,
int y,
int r)
x - the x-coordinate of the circle's centery - the y-coordinate of the circle's centerr - the radius of the circlepublic Circle(Circle old)
old - the circle to copy| Method Detail |
public static Circle valueOf(java.lang.String S)
Circle from the string.
S - a string in the form x y radius
Circle from the string
BadAttributeDataException - upon a parse errorpublic boolean equals(java.lang.Object o)
o - the circle to test against
true iff the this and the specified circle
represent the same origin and radiuspublic Pnt getCenter()
public int getRadius()
public java.lang.String toString()
x y r
public java.lang.Object clone()
public boolean contains(Pnt point)
point - the point to test
true iff the point is within or onthe
circle.public BoundingBox getBoundingBox()
public double area()
Math.PI times the square of the radiuspublic double intersectArea(Circle other)
other - the circle to intersect with
public Pnt getCentroid()
HasCentroid
getCentroid in interface HasCentroidHasCentroid.getCentroid()
public Moveable move(int direction,
int distance)
Moveable
move in interface Moveabledirection - the direction to move the itemdistance - the distance to move it
Moveable.move(int, int)
public Moveable shift(int x,
int y)
Moveable
shift in interface Moveablex - y -
Moveable.shift(int, int)
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||