jdsl.geomobj.ref
Class RatRay2D

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

public class RatRay2D
extends AbstractRatLinearCurve2D
implements Ray2D

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

Version:
$Id: RatRay2D.java,v 1.6 2001/04/28 10:54:22 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.AbstractRatLinearCurve2D
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
RatRay2D(Point2D source, Direction2D dir)
          Creates a ray emanating from point source with direction dir.
RatRay2D(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.AbstractRatLinearCurve2D
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

RatRay2D

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

RatRay2D

public RatRay2D(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 or a rational point
other - another point of the ray; must be an integer or rational point distinct from source
Throws:
InvalidPointException - if source and other are not integer or rational 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