|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.ObjectPoint
model a point in 2D Cartesian space
Field Summary | |
private double |
x
|
private double |
y
|
Constructor Summary | |
Point()
no parameters passed, create point at origin 0,0 |
|
Point(double x,
double y)
given x, y create a new point |
Method Summary | |
double |
distance(double x1,
double y1)
calculate Euclidean distance between this point and another given it's x and y coords |
double |
distance(Point p)
calculate Euclidean distance between this point and another |
boolean |
equals(double x1,
double y1)
check equality between this point and another given it's x and y coords |
boolean |
equals(Point p)
check equality between this point and another |
double |
getX()
|
double |
getY()
|
Point |
midpoint(double x1,
double y1)
calculate middle point between this point and another given it's x and y coords |
Point |
midpoint(Point p)
calculate middle point between this point and another |
void |
rotate90()
rotate point 90 degrees "clockwise" |
void |
setX(double x)
|
void |
setY(double y)
|
void |
shift(double xShift,
double yShift)
move point by xShift and yShoft amounts |
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
private double x
private double y
Constructor Detail |
public Point()
public Point(double x, double y)
Method Detail |
public double distance(double x1, double y1)
x1
- y1
-
public double distance(Point p)
p
- the point to calculate distance to
public boolean equals(double x1, double y1)
x1
- y1
-
public boolean equals(Point p)
p
-
public double getX()
public double getY()
public Point midpoint(double x1, double y1)
x1
- y1
-
public Point midpoint(Point p)
p
-
public void rotate90()
public void setX(double x)
x
- The x to set.public void setY(double y)
y
- The y to set.public void shift(double xShift, double yShift)
xShift
- amount to shift in directionyShift
- amount to shift in y directionpublic java.lang.String toString()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |