jdsl.geomobj.ref
Class RatPoint2D

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

public class RatPoint2D
extends AbstractGeomObject2D
implements Point2D

A finite two dimensional geometric point with rational coordinates. It uses a homogeneous representation of the coordinates; the third homogeneous coordinate must be positive.

Version:
$Id: RatPoint2D.java,v 1.6 2001/04/28 10:52:57 lv Exp $
Author:
Masi Oka (mao), Luca Vismara (lv)

Inner classes inherited from class jdsl.geomobj.api.Point2D
Point2D.InfinitePoint2D
 
Inner classes inherited from class jdsl.geomobj.api.GeomObject2D
GeomObject2D.NoneGeomObject2D
 
Field Summary
protected  java.lang.Number w_
           
protected  java.lang.Number x_
           
protected  java.lang.Number y_
           
 
Fields inherited from class jdsl.geomobj.ref.AbstractGeomObject2D
gt, jn
 
Fields inherited from interface jdsl.geomobj.api.Point2D
INFINITE
 
Fields inherited from interface jdsl.geomobj.api.GeomObject2D
NONE
 
Constructor Summary
RatPoint2D(int x, int y)
          Constructor that uses two Cartesian coordinates of type int.
RatPoint2D(int x, int y, int w)
          Constructor that uses three homogeneous coordinates of type int.
RatPoint2D(IntPoint2D p)
          Constructor that uses an integer point.
RatPoint2D(long x, long y)
          Constructor that uses two Cartesian coordinates of type long.
RatPoint2D(long x, long y, long w)
          Constructor that uses three homogeneous coordinates of type long.
RatPoint2D(java.lang.Number x, java.lang.Number y)
          Constructor that uses two Cartesian coordinates of type Number.
RatPoint2D(java.lang.Number x, java.lang.Number y, java.lang.Number w)
          Constructor that uses three homogeneous coordinates of type Number.
 
Method Summary
 int arithmeticType()
          The arithmetic type of a geometric object is encoded as an integer number.
 boolean equals(java.lang.Object obj)
           
 java.lang.Number numw()
          The direct use of this method is dicouraged; computations should be performed through methods of GeomTester2D.
 java.lang.Number numx()
          The direct use of this method is dicouraged; computations should be performed through methods of GeomTester2D.
 java.lang.Number numy()
          The direct use of this method is dicouraged; computations should be performed through methods of GeomTester2D.
 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

x_

protected java.lang.Number x_

y_

protected java.lang.Number y_

w_

protected java.lang.Number w_
Constructor Detail

RatPoint2D

public RatPoint2D(int x,
                  int y,
                  int w)
           throws InvalidCoordinateException
Constructor that uses three homogeneous coordinates of type int.
Parameters:
x - x-coordinate of the point
y - y-coordinate of the point
w - the omogenizing coordinate of the point
Throws:
InvalidCoordinateException - if w is not positive

RatPoint2D

public RatPoint2D(long x,
                  long y,
                  long w)
           throws InvalidCoordinateException
Constructor that uses three homogeneous coordinates of type long.
Parameters:
x - x-coordinate of the point
y - y-coordinate of the point
w - the omogenizing coordinate of the point
Throws:
InvalidCoordinateException - if w is not positive

RatPoint2D

public RatPoint2D(java.lang.Number x,
                  java.lang.Number y,
                  java.lang.Number w)
           throws InvalidCoordinateException
Constructor that uses three homogeneous coordinates of type Number.
Parameters:
x - x-coordinate of the point
y - y-coordinate of the point
w - the omogenizing coordinate of the point
Throws:
InvalidCoordinateException - if w is not positive

RatPoint2D

public RatPoint2D(int x,
                  int y)
Constructor that uses two Cartesian coordinates of type int.
Parameters:
x - x-coordinate of the point
y - y-coordinate of the point

RatPoint2D

public RatPoint2D(long x,
                  long y)
Constructor that uses two Cartesian coordinates of type long.
Parameters:
x - x-coordinate of the point
y - y-coordinate of the point

RatPoint2D

public RatPoint2D(java.lang.Number x,
                  java.lang.Number y)
           throws InvalidCoordinateException
Constructor that uses two Cartesian coordinates of type Number.
Parameters:
x - x-coordinate of the point
y - y-coordinate of the point

RatPoint2D

public RatPoint2D(IntPoint2D p)
Constructor that uses an integer point.
Parameters:
ip - an integer point
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: Point2D
This approximate method is provided for visualization purposes only; computations should be performed through methods of GeomTester2D.
Specified by:
x in interface Point2D
Following copied from interface: jdsl.geomobj.api.Point2D
Returns:
a double approximation of the x coordinate of this

y

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

numx

public java.lang.Number numx()
The direct use of this method is dicouraged; computations should be performed through methods of GeomTester2D.

numy

public java.lang.Number numy()
The direct use of this method is dicouraged; computations should be performed through methods of GeomTester2D.

numw

public java.lang.Number numw()
The direct use of this method is dicouraged; computations should be performed through methods of GeomTester2D.