Class Ray

java.lang.Object
  extended by Ray

public class Ray
extends java.lang.Object

Represents an immutable ray with a starting point and a direction. The direction would normally, but not necessarily, have a length of one.


Method Summary
static Ray create(double x, double y, double dx, double dy)
          Returns a ray with the given starting point and direction.
 double dot(Ray o)
          Returns the result of the dot product of this ray's direction with the parameter ray's direction.
 double getDeltaX()
          Returns the change in x for one unit along this ray's direction.
 double getDeltaY()
          Returns the change in y for one unit along this ray's direction.
 Ray getReverse()
          Returns a ray in the reverse direction of this one.
 double getX()
          Returns the x-coordinate of this ray's starting point.
 double getY()
          Returns the y-coordinate of this ray's starting point.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Method Detail

getX

public double getX()
Returns the x-coordinate of this ray's starting point.


getY

public double getY()
Returns the y-coordinate of this ray's starting point.


getDeltaX

public double getDeltaX()
Returns the change in x for one unit along this ray's direction.


getDeltaY

public double getDeltaY()
Returns the change in y for one unit along this ray's direction.


dot

public double dot(Ray o)
Returns the result of the dot product of this ray's direction with the parameter ray's direction.


getReverse

public Ray getReverse()
Returns a ray in the reverse direction of this one.


toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

create

public static Ray create(double x,
                         double y,
                         double dx,
                         double dy)
Returns a ray with the given starting point and direction.