Class: TGRPoint3D

Declaration: Geometry3D.h

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.

Member Function: TGRPoint3D::TGRPoint3D

  1. TGRPoint3D ()
  2. TGRPoint3D (GCoordinate x, GCoordinate y, GCoordinate z, GCoordinate w =1.0)
  3. TGRPoint3D (const TGPoint3D &)
  4. TGRPoint3D (const TGRPoint3D &)

Interface Category:

API.

Purpose:

  1. Default constructor.
  2. Creates a rational point with the four specified coordinates.
  3. Creates a rational point from a regular point, setting w =1.0.
  4. Copy constructor.

Calling Context:

  1. 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.)
  2. Call this function directly.
  3. Call this function directly.
  4. Called to copy an object.

Parameters:

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:

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:

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:

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[]

  1. GCoordinate & operator [] (unsigned long index)
  2. const GCoordinate & operator [] (unsigned long index) const

Interface Category:

API.

Purpose:

  1. Returns one of the coordinates of the point (fX, fY, fZ, or fW).
  2. Returns one of the coordinates of the point (fX, fY, fZ, or fW).

Calling Context:

  1. Call this function by using the operator in an expression.
  2. Call this function by using the operator in an expression.

Parameters:

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:

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:

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.