|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object Point
public class Point
Final draft of the Point class for a 2D mathematical point. Created in class on Jan 26, improved on Jan 31, and finished Feb 2.
Constructor Summary | |
---|---|
Point()
Default constructor. |
|
Point(int x,
int y)
Point Constructor with initialization |
Method Summary | |
---|---|
double |
distanceBetween(Point otherPoint)
Compute 2D distance between this and otherPoint. |
double |
distanceTo()
Compute 2D distance from origin to point. |
int |
getX()
Get the X value of the point |
int |
getY()
Get the Y value of the point |
void |
setPosition(int x,
int y)
Set the position of the point |
void |
translate(int deltaX,
int deltaY)
Translate the point to a new location |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Point()
public Point(int x, int y)
x
- initial X location of pointy
- initial Y location of pointMethod Detail |
---|
public void setPosition(int x, int y)
x
- new X positiony
- new Y positionpublic void translate(int deltaX, int deltaY)
deltaX
- amount to move in XdeltaY
- amount to move in Ypublic int getX()
public int getY()
public double distanceTo()
public double distanceBetween(Point otherPoint)
otherPoint
- second point in distance calculation
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |