edu.virginia.cs.mng.hypercast.DT
Class DT_Point
java.lang.Object
|
+--edu.virginia.cs.mng.hypercast.DT.DT_Point
- Direct Known Subclasses:
- DT_LogicalAddress
- public class DT_Point
- extends java.lang.Object
This class represents a point in two dimensions, where the coordinates
of the point are ints.
It is immutable.
|
Field Summary |
protected int |
x
|
protected int |
y
|
|
Method Summary |
static double |
angleRelative(DT_Point reference,
DT_Point pivot,
DT_Point datum)
|
static double |
angleToHorizon(DT_Point pivot,
DT_Point datum)
Returns the angle (in radians) of datum to horizontal ray going from the pivot in the
positive x direction. |
static double |
distance(DT_Point a,
DT_Point b)
Returns the euclidean distance between two points. |
boolean |
equals(java.lang.Object o)
Compares a DT_Point to another object. |
static DT_DoublePoint |
findCenterOfCircle(DT_Point a,
DT_Point b,
DT_Point c)
Find the center of the circle inscribing 3 points. |
int |
getX()
|
int |
getY()
|
static boolean |
greaterThan(DT_Point a,
DT_Point b)
Returns true if DT_Point a comes before b in
the total ordering of points. |
int |
hashCode()
Overrides Object.hashCode so that this can be used as a key in a hashtable. |
static boolean |
isInCircle(DT_Point a,
DT_Point b,
DT_Point c,
DT_Point datum)
|
static boolean |
isInOrOnCircle(DT_Point a,
DT_Point b,
DT_Point c,
DT_Point datum)
|
static boolean |
isOnCircle(DT_Point a,
DT_Point b,
DT_Point c,
DT_Point datum)
|
java.lang.String |
toString()
Creates a string following the in x-coordinate,y-coordinate fashion. |
| Methods inherited from class java.lang.Object |
,
clone,
finalize,
getClass,
notify,
notifyAll,
registerNatives,
wait,
wait,
wait |
x
protected int x
y
protected int y
DT_Point
public DT_Point(int xx,
int yy)
DT_Point
public DT_Point(DT_Point p)
DT_Point
public DT_Point(java.lang.String s)
- Reads coordinates from string in format "\d+,\d+". (e.g. "12345,67890")
toString
public java.lang.String toString()
- Creates a string following the in x-coordinate,y-coordinate fashion.
- Overrides:
- toString in class java.lang.Object
equals
public boolean equals(java.lang.Object o)
- Compares a DT_Point to another object.
Throws exception if the other object is not an instance of DT_Point.
Returns false if the other object is null.
- Overrides:
- equals in class java.lang.Object
hashCode
public int hashCode()
- Overrides Object.hashCode so that this can be used as a key in a hashtable.
- Overrides:
- hashCode in class java.lang.Object
getX
public int getX()
getY
public int getY()
greaterThan
public static final boolean greaterThan(DT_Point a,
DT_Point b)
- Returns true if DT_Point
a comes before b in
the total ordering of points. A point is greater than another point if its y-coordinate
is greater or if the y-coordinates are the same and its x-coordinate is greater.
distance
public static double distance(DT_Point a,
DT_Point b)
- Returns the euclidean distance between two points.
angleToHorizon
public static double angleToHorizon(DT_Point pivot,
DT_Point datum)
- Returns the angle (in radians) of datum to horizontal ray going from the pivot in the
positive x direction.
angleRelative
public static double angleRelative(DT_Point reference,
DT_Point pivot,
DT_Point datum)
isOnCircle
public static boolean isOnCircle(DT_Point a,
DT_Point b,
DT_Point c,
DT_Point datum)
isInCircle
public static boolean isInCircle(DT_Point a,
DT_Point b,
DT_Point c,
DT_Point datum)
isInOrOnCircle
public static boolean isInOrOnCircle(DT_Point a,
DT_Point b,
DT_Point c,
DT_Point datum)
findCenterOfCircle
public static DT_DoublePoint findCenterOfCircle(DT_Point a,
DT_Point b,
DT_Point c)
- Find the center of the circle inscribing 3 points.
If all 3 points are the same, it returns that point.
Else, if 3 points lie on a line, it returns null.