hypercast.DT
Class DT_Point

java.lang.Object
  |
  +--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.


Constructor Summary
DT_Point(hypercast.DT.DT_Point p)
           
DT_Point(int xx, int yy)
           
DT_Point(java.lang.String s)
          Reads coordinates from string in format "\d+,\d+".
 
Method Summary
static double angleRelative(hypercast.DT.DT_Point reference, hypercast.DT.DT_Point pivot, hypercast.DT.DT_Point datum)
           
static double angleToHorizon(hypercast.DT.DT_Point pivot, hypercast.DT.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(hypercast.DT.DT_Point a, hypercast.DT.DT_Point b)
          Returns the euclidean distance between two points.
 boolean equals(java.lang.Object o)
          Compares a DT_Point to another object.
static hypercast.DT.DT_DoublePoint findCenterOfCircle(hypercast.DT.DT_Point a, hypercast.DT.DT_Point b, hypercast.DT.DT_Point c)
          Find the center of the circle inscribing 3 points.
 int getX()
           
 int getY()
           
static boolean greaterThan(hypercast.DT.DT_Point a, hypercast.DT.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(hypercast.DT.DT_Point a, hypercast.DT.DT_Point b, hypercast.DT.DT_Point c, hypercast.DT.DT_Point datum)
           
static boolean isInOrOnCircle(hypercast.DT.DT_Point a, hypercast.DT.DT_Point b, hypercast.DT.DT_Point c, hypercast.DT.DT_Point datum)
           
static boolean isOnCircle(hypercast.DT.DT_Point a, hypercast.DT.DT_Point b, hypercast.DT.DT_Point c, hypercast.DT.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
getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DT_Point

public DT_Point(int xx,
                int yy)

DT_Point

public DT_Point(hypercast.DT.DT_Point p)

DT_Point

public DT_Point(java.lang.String s)
Reads coordinates from string in format "\d+,\d+". (e.g. "12345,67890")

Method Detail

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(hypercast.DT.DT_Point a,
                                        hypercast.DT.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(hypercast.DT.DT_Point a,
                              hypercast.DT.DT_Point b)
Returns the euclidean distance between two points.


angleToHorizon

public static double angleToHorizon(hypercast.DT.DT_Point pivot,
                                    hypercast.DT.DT_Point datum)
Returns the angle (in radians) of datum to horizontal ray going from the pivot in the positive x direction.

Returns:
value in range (-Math.PI, Math.PI)

angleRelative

public static double angleRelative(hypercast.DT.DT_Point reference,
                                   hypercast.DT.DT_Point pivot,
                                   hypercast.DT.DT_Point datum)

isOnCircle

public static boolean isOnCircle(hypercast.DT.DT_Point a,
                                 hypercast.DT.DT_Point b,
                                 hypercast.DT.DT_Point c,
                                 hypercast.DT.DT_Point datum)

isInCircle

public static boolean isInCircle(hypercast.DT.DT_Point a,
                                 hypercast.DT.DT_Point b,
                                 hypercast.DT.DT_Point c,
                                 hypercast.DT.DT_Point datum)

isInOrOnCircle

public static boolean isInOrOnCircle(hypercast.DT.DT_Point a,
                                     hypercast.DT.DT_Point b,
                                     hypercast.DT.DT_Point c,
                                     hypercast.DT.DT_Point datum)

findCenterOfCircle

public static hypercast.DT.DT_DoublePoint findCenterOfCircle(hypercast.DT.DT_Point a,
                                                             hypercast.DT.DT_Point b,
                                                             hypercast.DT.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.