jdsl.geomobj.ref
Class RealRay2D

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

public class RealRay2D
extends AbstractRealLinearCurve2D
implements Ray2D

RealRay2D is a Ray2D constructed using either two distinct real points or a real point and a real direction.

Version:
$Id: RealRay2D.java,v 1.1 2000/06/27 15:46:09 lv Exp $
Author:
Luca Vismara (lv)

Inner classes inherited from class jdsl.geomobj.api.GeomObject2D
GeomObject2D.NoneGeomObject2D
 
Fields inherited from class jdsl.geomobj.ref.AbstractRealLinearCurve2D
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
RealRay2D(Point2D source, Direction2D dir)
          Creates a ray emanating from point source with direction dir.
RealRay2D(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.AbstractRealLinearCurve2D
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

RealRay2D

public RealRay2D(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 a real point
dir - the direction of the ray
Throws:
InvalidPointException - if source is not a real point
InvalidDirectionException - if dir is not a real direction

RealRay2D

public RealRay2D(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 a real point
other - another point of the ray; must be a real point distinct from source
Throws:
InvalidPointException - if source and other are not real points, or if source and other 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