Taxonomy Categories:
Member Functions:
Interface Category:
API.
Inherits From:
None.
Inherited By:
None.
Purpose:
The TGRPoint3D class represents a homogeneous (rational) point or vector in a 3-D coordinate space, just as TGRPoint represents a point in 2-D space. TGRPoint3D defines a set of four coordinate values (x, y, z, and w). TGRPoint3D is used for defining rational coordinates in TGCurve3D and TGSurface3D. Curves and surfaces use the rational coordinates to accurately represent conic sections (arcs, spheres, ellipses, and so on). Rational points are also occasionally useful for situations where you need to keep track of 3-D perspective. Usually, you donŐt need to deal directly with TGRPoint3Ds because the curve, surface, and transformation implementations take care of managing the mathematical details.
A TGPoint3D can be converted directly to a TGRPoint3D via the constructor; a w value of 1.0 is assumed. However, the conversion the other direction must be done explicitly with either a DivW or DropW operation. Unlike TGPoint3D, the only operators defined for TGRPoint3D are ==, !=, and []. As with 2-D rational points, arithmetic operators are deliberately not provided for TGRPoint3Ds because their correct interpretation would be too application specific.
Instantiation:
Allocate on the heap or the stack.
Deriving Classes:
Don't derive any classes from TGRPoint3D: All TGRPoint3D's data is public, and its destructor is not virtual.
Concurrency:
Not multithread safe.
Resource Use:
No special requirements.
- TGRPoint3D ()
- TGRPoint3D (GCoordinate x, GCoordinate y, GCoordinate z, GCoordinate w =1.0)
- TGRPoint3D (const TGPoint3D &)
- TGRPoint3D (const TGRPoint3D &)
Interface Category:
API.
Purpose:
- Default constructor.
- Creates a rational point with the four specified coordinates.
- Creates a rational point from a regular point, setting w =1.0.
- Copy constructor.
Calling Context:
- Called by the stream-in operators. You can also call this function directly. (Because the member variables are public, you can call the default constructor and later assign values to the coordinates.)
- Call this function directly.
- Call this function directly.
- Called to copy an object.
Parameters:
- Takes no parameters.
- GCoordinate x -The x-coordinate of the new point.
- GCoordinate y -The y-coordinate of the new point.
- GCoordinate z -The z-coordinate of the new point.
- GCoordinate w -The w-coordinate of the new point (1.0 by default).
- const TGPoint3D & -The point to be copied.
- const TGRPoint3D & -The rational point to be copied.
Return Value:
None.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Not multithread safe.
Other Considerations:
These are inline functions.
Member Function: TGRPoint3D::operator==
bool operator ==(const TGRPoint3D & Src) const
Interface Category:
API.
Purpose:
Tests two rational points for equality.
Calling Context:
Call this function by using the operator in an expression.
Parameters:
- const TGRPoint3D & Src -The point to be compared to this point.
Return Value:
Returns true if all four coordinates of one point are equal to the corresponding coordinates of the other point.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Not multithread safe.
Other Considerations:
This is an inline function.
Member Function: TGRPoint3D::operator!=
bool operator != (const TGRPoint3D & Src) const
Interface Category:
API.
Purpose:
Tests two rational points for inequality.
Calling Context:
Call this function by using the operator in an expression.
Parameters:
- const TGRPoint3D & Src -The point to be compared to this point.
Return Value:
Returns true if any coordinate of one point is different from the corresponding coordinate of the other point.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Not multithread safe.
Other Considerations:
This is an inline function.
Member Function: TGRPoint3D::DivW
TGPoint3D DivW () const
Interface Category:
API.
Purpose:
- Divides the coordinates by w to create a TGPoint3D.
Calling Context:
Call this function directly.
Parameters:
Return Value:
The new TGPoint3D.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Not multithread safe.
Other Considerations:
This is an inline function.
Member Function: TGRPoint3D::DropW
TGPoint3D DropW () const
Interface Category:
API.
Purpose:
Creates a TGPoint3D by ignoring the w-coordinate.
Calling Context:
Call this function directly.
Parameters:
Return Value:
The new TGPoint3D.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Not multithread safe.
Other Considerations:
This is an inline function.
Member Function: TGRPoint3D::operator[]
- GCoordinate & operator [] (unsigned long index)
- const GCoordinate & operator [] (unsigned long index) const
Interface Category:
API.
Purpose:
- Returns one of the coordinates of the point (fX, fY, fZ, or fW).
- Returns one of the coordinates of the point (fX, fY, fZ, or fW).
Calling Context:
- Call this function by using the operator in an expression.
- Call this function by using the operator in an expression.
Parameters:
- unsigned long index -0 for fX, 1 for fY, 2 for fZ, and 3 for fW.
- unsigned long index -0 for fX, 1 for fY, 2 for fZ, and 3 for fW.
Return Value:
Returns the x-, y-, z-, or w-coordinate.
Exceptions:
Invokes a parameter assert if the parameter is not 0, 1, 2, or 3.
Concurrency:
Not multithread safe.
Other Considerations:
None.
Member Function: TGRPoint3D::operator<<=
TStream & operator <<= (TStream & fromwhere)
Interface Category:
API.
Purpose:
Stream-in operator.
Calling Context:
Called to stream in data.
Parameters:
- TStream & fromwhere -The stream from which the object's data is streamed in.
Return Value:
Returns a reference to the stream the object streams itself in from.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Not multithread safe.
Other Considerations:
None.
Member Function: TGRPoint3D::operator>>=
TStream & operator >>=(TStream & towhere) const
Interface Category:
API.
Purpose:
Stream-out operator.
Calling Context:
Called to stream out data.
Parameters:
- TStream & towhere -The stream to which the object's data is streamed out.
Return Value:
Returns a reference to the stream the object streams itself out to.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Not multithread safe.
Other Considerations:
None.
Click the icon to mail questions or corrections about this material to Taligent personnel.
Copyright©1995 Taligent,Inc. All rights reserved.