jdsl.geomobj.ref
Class IntRay2D

java.lang.Object
  |
  +--jdsl.geomobj.ref.AbstractGeomObject2D
        |
        +--jdsl.geomobj.ref.AbstractLinearCurve2D
              |
              +--jdsl.geomobj.ref.AbstractIntLinearCurve2D
                    |
                    +--jdsl.geomobj.ref.IntRay2D
All Implemented Interfaces:
Curve2D, GeomObject, GeomObject2D, LinearCurve2D, OpenCurve2D, Ray2D

public class IntRay2D
extends AbstractIntLinearCurve2D
implements Ray2D

IntRay2D is a Ray2D constructed using either two distinct integer points or an integer point and an integer direction.

Version:
$Id: IntRay2D.java,v 1.5 2001/05/16 13:44:58 lv Exp $
Author:
Masi Oka (mao), Luca Vismara (lv)

Inner classes inherited from class jdsl.geomobj.api.GeomObject2D
GeomObject2D.NoneGeomObject2D
 
Fields inherited from class jdsl.geomobj.ref.AbstractIntLinearCurve2D
dir_, p1_, p2_
 
Fields inherited from class jdsl.geomobj.ref.AbstractLinearCurve2D
bottom_, INFINITE, left_, NEGATIVE, POSITIVE, right_, slope_, top_, ZERO
 
Fields inherited from class jdsl.geomobj.ref.AbstractGeomObject2D
gt, jn
 
Fields inherited from interface jdsl.geomobj.api.GeomObject2D
NONE
 
Constructor Summary
IntRay2D(Point2D source, Direction2D dir)
          Creates a ray emanating from point source with direction dir.
IntRay2D(Point2D source, Point2D other)
          Creates a ray emanating from point source and passing through point other; the underlying direction is from source to other.
 
Method Summary
 boolean equals(java.lang.Object obj)
           
 boolean isDownward()
           
 boolean isLeftward()
           
 boolean isRightward()
           
 boolean isUpward()
           
 Point2D other()
           
 Point2D source()
           
 Line2D supportingLine()
           
 
Methods inherited from class jdsl.geomobj.ref.AbstractIntLinearCurve2D
arithmeticType, direction, points
 
Methods inherited from class jdsl.geomobj.ref.AbstractLinearCurve2D
isDecreasing, isHorizontal, isIncreasing, isVertical, toString
 
Methods inherited from class jdsl.geomobj.ref.AbstractGeomObject2D
dim
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface jdsl.geomobj.api.LinearCurve2D
direction, isDecreasing, isHorizontal, isIncreasing, isVertical
 
Methods inherited from interface jdsl.geomobj.api.OpenCurve2D
points
 
Methods inherited from interface jdsl.geomobj.api.GeomObject
arithmeticType, dim
 

Constructor Detail

IntRay2D

public IntRay2D(Point2D source,
                Direction2D dir)
         throws InvalidDirectionException,
                InvalidPointException
Creates a ray emanating from point source with direction dir.
Parameters:
source - the source of the ray; must be an integer point
dir - the direction of the ray
Throws:
InvalidPointException - if source is not an integer point
InvalidDirectionException - if dir is not an integer direction

IntRay2D

public IntRay2D(Point2D source,
                Point2D other)
         throws InvalidPointException
Creates a ray emanating from point source and passing through point other; the underlying direction is from source to other.
Parameters:
source - the source of the ray; must be an integer point
other - another point of the ray; must be an integer point distinct from source
Throws:
InvalidPointException - if source and other are not integer points, or if they are coincident
Method Detail

equals

public boolean equals(java.lang.Object obj)
Overrides:
equals in class java.lang.Object

source

public Point2D source()
Specified by:
source in interface Ray2D
Following copied from interface: jdsl.geomobj.api.Ray2D
Returns:
the source point of this

other

public Point2D other()
Specified by:
other in interface Ray2D
Following copied from interface: jdsl.geomobj.api.Ray2D
Returns:
the non-source point of this

isDownward

public boolean isDownward()
Specified by:
isDownward in interface Ray2D
Following copied from interface: jdsl.geomobj.api.Ray2D
Returns:
whether this is directed downward, i.e., whether the source point is the topmost point of this

isUpward

public boolean isUpward()
Specified by:
isUpward in interface Ray2D
Following copied from interface: jdsl.geomobj.api.Ray2D
Returns:
whether this is directed upward, i.e., whether the source point is the bottommost point of this

isLeftward

public boolean isLeftward()
Specified by:
isLeftward in interface Ray2D
Following copied from interface: jdsl.geomobj.api.Ray2D
Returns:
whether this is directed leftward, i.e., whether the source point is the rightmost point of this

isRightward

public boolean isRightward()
Specified by:
isRightward in interface Ray2D
Following copied from interface: jdsl.geomobj.api.Ray2D
Returns:
whether this is directed rightward, i.e., whether the source point is the leftmost point of this

supportingLine

public Line2D supportingLine()
Specified by:
supportingLine in interface Ray2D
Following copied from interface: jdsl.geomobj.api.Ray2D
Returns:
the line passing through the source point and with the same direction of this