jdsl.geomobj.ref
Class RatDirection2D
java.lang.Object
|
+--jdsl.geomobj.ref.AbstractGeomObject2D
|
+--jdsl.geomobj.ref.RatDirection2D
- All Implemented Interfaces:
- Direction2D, GeomObject, GeomObject2D
- public class RatDirection2D
- extends AbstractGeomObject2D
- implements Direction2D
A two-dimensional rational direction. It uses a homogeneous
representation of the coordinates; the third homogeneous coordinate
must be positive.
- Version:
- $Id: RatDirection2D.java,v 1.7 2001/04/28 10:52:57 lv Exp $
- Author:
- Luca Vismara (lv)
Constructor Summary |
RatDirection2D(int x,
int y)
Constructor that uses two Cartesian coordinates of type int. |
RatDirection2D(int x,
int y,
int w)
Constructor that uses three homogeneous coordinates of type int. |
RatDirection2D(long x,
long y)
Constructor that uses two Cartesian coordinates of type long. |
RatDirection2D(long x,
long y,
long w)
Constructor that uses three homogeneous coordinates of type long. |
RatDirection2D(java.lang.Number x,
java.lang.Number y)
Constructor that uses two Cartesian coordinates of type Number. |
RatDirection2D(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()
|
java.lang.Number |
numx()
|
java.lang.Number |
numy()
|
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 java.lang.Object |
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
p_
protected RatPoint2D p_
RatDirection2D
public RatDirection2D(int x,
int y,
int w)
throws InvalidCoordinateException
- Constructor that uses three homogeneous coordinates of type int.
- Parameters:
x
- x-coordinate of the point defining the directiony
- y-coordinate of the point defining the directionw
- omogenizing coordinate of the point defining the direction- Throws:
InvalidCoordinateException
- if the point defining the
direction is coincident with the origin of the plane
RatDirection2D
public RatDirection2D(long x,
long y,
long w)
throws InvalidCoordinateException
- Constructor that uses three homogeneous coordinates of type long.
- Parameters:
x
- x-coordinate of the point defining the directiony
- y-coordinate of the point defining the directionw
- omogenizing coordinate of the point defining the direction- Throws:
InvalidCoordinateException
- if the point defining the
direction is coincident with the origin of the plane
RatDirection2D
public RatDirection2D(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 defining the directiony
- y-coordinate of the point defining the directionw
- omogenizing coordinate of the point defining the direction- Throws:
InvalidCoordinateException
- if the point defining the
direction is coincident with the origin of the plane
RatDirection2D
public RatDirection2D(int x,
int y)
throws InvalidCoordinateException
- Constructor that uses two Cartesian coordinates of type int.
- Parameters:
x
- x-coordinate of the point defining the directiony
- y-coordinate of the point defining the direction- Throws:
InvalidCoordinateException
- if the point defining the
direction is coincident with the origin of the plane
RatDirection2D
public RatDirection2D(long x,
long y)
throws InvalidCoordinateException
- Constructor that uses two Cartesian coordinates of type long.
- Parameters:
x
- x-coordinate of the point defining the directiony
- y-coordinate of the point defining the direction- Throws:
InvalidCoordinateException
- if the point defining the
direction is coincident with the origin of the plane
RatDirection2D
public RatDirection2D(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 defining the directiony
- y-coordinate of the point defining the direction- Throws:
InvalidCoordinateException
- if the point defining the
direction is coincident with the origin of the plane
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
numx
public java.lang.Number numx()
numy
public java.lang.Number numy()
numw
public java.lang.Number numw()