IGRPoint2D

IGRPoint2D provides a homogeneous (rational) point or vector on the 2-D coordinate plane. The IGRPoint2D class defines basic two-dimensional points with rational(homogeneous) coordinates. IGRPoint2D objects are used primarily by IGCurve2D to provide an exact representation of conic curves with splines and for matrix operations requiring a homogeneous coordinate. You can directly convert an IGPoint2D to an IGRPoint2D via the constructor that takes an IGPoint2D parameter; in this case, a w value of 1.0 is assumed. However, to convert an IGRPoint2D object to an IGPoint2D one, you must perform an explicit divW or dropW operation. Note that arithmetic operations are deliberatly not provided for IGRPoint2D instances because their correct interpretation is highly application specific.

Do not derive your own classes from this class.


IGRPoint2D - Member Functions and Data by Group

Constructors & Destructor

Use the functions in this group to construct and destroy objects of class IGPoint2D.


[view class]
~IGRPoint2D
public:
~IGRPoint2D()
Destroys the two-dimensional points object of class IGRPoint2D.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


[view class]
IGRPoint2D
Constructs an object of class IGRPoint2D that defines a homogeneous point or vector on the 2-D coordinate plane.


Overload 1
Copy constructor.
public:
IGRPoint2D(const IGRPoint2D&)
Use this constructor to create an IGRPoint2D object that is copied from the given one.

IGRPoint2D
A constant reference to the IGRPoint2D to be copied.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


Overload 2
public:
IGRPoint2D( GCoordinate x, GCoordinate y, GCoordinate w = 1.0 )
Use this constructor to create an IGRPoint2D object that uses the given coordinates, with fW=1.0 as the default.

x
The new x-coordinate
y
The new y-coordinate
w
The new w-coordinate

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


Overload 3
Creates an IGRPoint2D whose x and y coordinates equal those of thegiven IGPoint, and whose w coordinate is 1.0.
public:
IGRPoint2D(const IGPoint2D& p)
Use this constructor to create an IGRPoint2D whose x and y coordinates equal to those of the given IGPoint object , and whose w coordinate is 1.0.

IGPoint2D
A constant reference to the IGPoint2D point whose x and y coordinates are copied to the current IGPoint2D.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


Overload 4
Default constructor.
public:
IGRPoint2D()
Use the default constructor to create an IGRPoint2D object with default values of fX=0.0 and fY=0.0 and fW=0.0

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


Assignment Operator

Use the function in this group to perform assigment operations.


[view class]
operator =
public:
IGRPoint2D& operator =(const IGRPoint2D& Src)
Assignment operator.

Src
The point to be copied.

Return
A mutable (non-constant) reference to the left-hand object.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


Creating Two-Dimensional Point Objects

Use the functions in this group to create objects of class IGPoint2D based on the manipulated coordinate values.


[view class]
divW
public:
IGPoint2D divW() const
Divides the coordinates by w to create an IGPoint2D object.

Return
The new IGPoint2D, whose x- and y-coordinates are those of this IGRPoint2D, divided by w.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


[view class]
dropW
public:
IGPoint2D dropW() const
Creates an IGPoint2D by ignoring the w coordinate.

Return
The new IGPoint2D, whose x- and y-coordinates are equal to those of this IGRPoint2D.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


Data Types

These data types are define for coordinate values.


[view class]
fW
w-,coordinates
public:
GCoordinate fW
The W coordinate value.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


[view class]
fX
x-,coordinates
public:
GCoordinate fX
The X coordinate value.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


[view class]
fY
y-,coordinates
public:
GCoordinate fY
The Y coordinate value.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


Obtaining Information About Two-Dimensional Points

Use the functions in this group to obtain the x, y, or w coordinates of a point defined by an object of class IGRPoint2D.


[view class]
operator []


Overload 1
Returns the x, y, or w coordinate of a const IGRPoint2D.
public:
const GCoordinate& operator [](unsigned long index) const

index
0 for the x-coordinate, 1 for the y-coordinate, 2 for the w-coordinate.

Return
The specified coordinate.

Exception

Calls a parameter assert if the index is not 0, 1, or 2.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


Overload 2
Returns the x, y, or w coordinate, depending on the index.
public:
GCoordinate& operator [](unsigned long index)

index
0 for the x-coordinate, 1 for the y-coordinate, 2 for the w-coordinate.

Return
The specified coordinate.

Exception

Calls a parameter assert if the index is not 0, 1, or 2.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


Streaming the Object In and Out

Use the functions and operators in this group to stream objects in and out.


[view class]
operator <<=
public:
IDataStream& operator <<=(IDataStream&)
Operator that streams in the homogeneous (rational) point or vector object using the given polymorphic stream.

IDataStream
The stream used to stream in the object.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


[view class]
operator >>=
public:
IDataStream& operator >>=(IDataStream&) const
Operator that streams out the homogeneous (rational) point or vector object using the given polymorphic stream.

IDataStream
The stream used to stream out the object.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


[view class]
readFromStream
public:
void readFromStream(IDataStream& toWhere)
Streams in the homogeneous (rational) point or vector object using the polymorphic stream specified by fromWhere.

fromWhere
The stream used to stream in the object.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


[view class]
writeToStream
public:
void writeToStream(IDataStream& toWhere) const
Streams out the homogeneous (rational) point or vector object using the polymorphic stream specified by toWhere.

toWhere
The stream used to stream out the object.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


Testing for Equality and Inequality

Use the functions in this group to test two IGRPoint2D objects for equality or inequality.


[view class]
operator !=
public:
bool operator !=(const IGRPoint2D& Src) const
Tests whether the point's coordinates differ from those of the argument.

Src
The point to be compared with.

Return
TRUE, if any of Src's coordinates do not match the corresponding coordinate of this one.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


[view class]
operator ==
public:
bool operator ==(const IGRPoint2D& Src) const
Tests whether the point's coordinates equal those of the argument.

Src
The point to be compared with.

Return
TRUE, if fX, fY, and fW are identical to Src's x-, y-, and w-coordinates, respectively.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


IGRPoint2D - Inherited Member Functions and Data

Inherited Public Functions

Inherited Public Data

Inherited Protected Functions

Inherited Protected Data