jdsl.geomobj.ref
Class IntDirection2D

java.lang.Object
  |
  +--jdsl.geomobj.ref.AbstractGeomObject2D
        |
        +--jdsl.geomobj.ref.IntDirection2D
All Implemented Interfaces:
Direction2D, GeomObject, GeomObject2D

public class IntDirection2D
extends AbstractGeomObject2D
implements Direction2D

This is the class for a two-dimensional integer direction.

Version:
$Id: IntDirection2D.java,v 1.5 2000/03/28 17:58:56 lv Exp $
Author:
Luca Vismara (lv)

Inner classes inherited from class jdsl.geomobj.api.GeomObject2D
GeomObject2D.NoneGeomObject2D
 
Field Summary
protected  IntPoint2D p_
           
 
Fields inherited from class jdsl.geomobj.ref.AbstractGeomObject2D
gt, jn
 
Fields inherited from interface jdsl.geomobj.api.GeomObject2D
NONE
 
Constructor Summary
IntDirection2D(int x, int y)
           
IntDirection2D(long x, long y)
           
 
Method Summary
 int arithmeticType()
          The arithmetic type of a geometric object is encoded as an integer number.
 boolean equals(java.lang.Object obj)
           
 long intx()
           
 long inty()
           
 Direction2D opposite()
           
 Direction2D perpendicular()
           
 java.lang.String toString()
           
 double x()
          This approximate method is provided for visualization purposes only; computations should be performed through methods of GeomTester2D.
 double y()
          This approximate method is provided for visualization purposes only; computations should be performed through methods of GeomTester2D.
 
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.GeomObject
dim
 

Field Detail

p_

protected IntPoint2D p_
Constructor Detail

IntDirection2D

public IntDirection2D(int x,
                      int y)
               throws InvalidCoordinateException
Parameters:
x - x-coordinate of the point defining the direction
y - y-coordinate of the point defining the direction
Throws:
InvalidCoordinateException - if the point defining the direction is coincident with the origin of the plane

IntDirection2D

public IntDirection2D(long x,
                      long y)
               throws InvalidCoordinateException
Parameters:
x - x-coordinate of the point defining the direction
y - y-coordinate of the point defining the direction
Throws:
InvalidCoordinateException - if the point defining the direction is coincident with the origin of the plane
Method Detail

equals

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

toString

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

arithmeticType

public int arithmeticType()
Description copied from interface: GeomObject
The arithmetic type of a geometric object is encoded as an integer number. Current legal values are: 0 = an integer geometric object 1 = a rational geometric object
Specified by:
arithmeticType in interface GeomObject
Following copied from interface: jdsl.geomobj.api.GeomObject
Returns:
the arithmetic type of this

x

public double x()
Description copied from interface: Direction2D
This approximate method is provided for visualization purposes only; computations should be performed through methods of GeomTester2D.
Specified by:
x in interface Direction2D
Following copied from interface: jdsl.geomobj.api.Direction2D
Returns:
a double approximation of the x coordinate of the point defining the direction

y

public double y()
Description copied from interface: Direction2D
This approximate method is provided for visualization purposes only; computations should be performed through methods of GeomTester2D.
Specified by:
y in interface Direction2D
Following copied from interface: jdsl.geomobj.api.Direction2D
Returns:
a double approximation of the y coordinate of the point defining the direction

perpendicular

public Direction2D perpendicular()
Specified by:
perpendicular in interface Direction2D
Following copied from interface: jdsl.geomobj.api.Direction2D
Returns:
this direction rotated counterclockwise by 90 degrees

opposite

public Direction2D opposite()
Specified by:
opposite in interface Direction2D
Following copied from interface: jdsl.geomobj.api.Direction2D
Returns:
this direction rotated by 180 degrees

intx

public long intx()

inty

public long inty()