hypercast.DT
Class DT_DoublePoint

java.lang.Object
  |
  +--hypercast.DT.DT_DoublePoint

public class DT_DoublePoint
extends java.lang.Object

This class represents a point in two dimensions, where the coordinates of the point are doubles. It is used for increased accuracy over DT_Point. It is immutable.


Field Summary
static double EPSILON
          The error used in the function equals()
 
Constructor Summary
DT_DoublePoint(double xx, double yy)
           
DT_DoublePoint(hypercast.DT.DT_DoublePoint p)
           
DT_DoublePoint(hypercast.DT.DT_Point p)
           
 
Method Summary
static double distance(hypercast.DT.DT_DoublePoint a, hypercast.DT.DT_DoublePoint b)
          Returns the Euclidean distance between two points.
 boolean equals(java.lang.Object o)
          Compares this to either a DT_DoublePoint or a DT_Point.
static hypercast.DT.DT_DoublePoint findInterceptOfLines(double f, double s, double g, double t)
          Returns the point at the interception of two lines.
 double getX()
           
 double getY()
           
 int hashCode()
          Override to Object.hashCode() so that this object can be used as a key in a hashtable.
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

EPSILON

public static double EPSILON
The error used in the function equals()

Constructor Detail

DT_DoublePoint

public DT_DoublePoint(hypercast.DT.DT_DoublePoint p)

DT_DoublePoint

public DT_DoublePoint(hypercast.DT.DT_Point p)

DT_DoublePoint

public DT_DoublePoint(double xx,
                      double yy)
Method Detail

equals

public boolean equals(java.lang.Object o)
Compares this to either a DT_DoublePoint or a DT_Point.

Overrides:
equals in class java.lang.Object
Returns:
true if the absolute difference of both coordinates is less than EPSILON
See Also:
EPSILON

hashCode

public int hashCode()
Override to Object.hashCode() so that this object can be used as a key in a hashtable.

Overrides:
hashCode in class java.lang.Object

getX

public double getX()

getY

public double getY()

distance

public static double distance(hypercast.DT.DT_DoublePoint a,
                              hypercast.DT.DT_DoublePoint b)
Returns the Euclidean distance between two points.


findInterceptOfLines

public static hypercast.DT.DT_DoublePoint findInterceptOfLines(double f,
                                                               double s,
                                                               double g,
                                                               double t)
Returns the point at the interception of two lines. (f,s) and (g,t) are the x-intercept and slopes of two lines.

x = (g-f)/(s-t);

y = f + s*x;

Throws:
java.lang.ArithmeticException - if s == t