Underlying geometry classes

The 2D computational geometry classes consist of TGPoint, TGRPoint, TGRect, and TGInfiniteLine. These classes are used for 2D geometric calculations and as basic building blocks for the other geometry classes. The 2D computational geometry classes have no corresponding MGraphic derived class and, except for TGRect, cannot be passed to a TGrafPort for rendering.

The point array classes consist of TGPointArray and TGRPointArray. These are lowlevel classes that do not perform any computation, but store and manipulate linear arrays of 2-D ordered points.

Descriptions for these classes are summarized here for your convenience while reading this manual. Refer to the online Class and Member Function descriptions for detailed information on these classes and their functions.

Points

The TGPoint class defines (x, y) coordinates that represent a point or vector on the 2D coordinate plane. The TGRPoint class defines (x,y, w) coordinate values that represent a homogeneous (rational) point or vector on the 2D coordinate plane. The TGPoint and TGRPoint member functions are shown in Table 1.


Points
TGPoint CrossProduct SetVectorAngle VectorAngle
DotProduct SetVectorLength VectorLength
Interpolate SetPolarCoordinates
TGRPoint DivW DropW

Point arrays

TGPointArray handles arrays of TGPoints and is the basis for TGPolyline and TGPolygon. TGRPointArray handles arrays of TGRPoints and is the basis for TGCurve and TGLoop). The point array member functions are summarized in Table 2.

.


Point arrays
TGPointArray and GetBounds Resize
TGRPointArray GetNumberofPoints SetPoint
GetPoint Swap

Infinite line

The TGInfiniteLine class represents an infinitely long directional line with a direction vector and a base point that defines a point on the line. The line extends to infinity in both directions, but the actual direction is determined by the direction vector.

TGInfiniteLine classes define geometric calculations that involve lines, axes, and vectors. They are used in design and computeraided design (CAD) applications where infinite construction lines relate one piece of geometry to another. TGInfiniteLine member functions are summarized in Table 3.


Infinite lines
TGInfiniteLine AngleBetween GetDirection Reverse
Clip Intersects ReverseDirection
Distance Intersection SetBasePoint
Evaluate Parallel SetDirection
EvaluateAtX Perpendicular TransformBy
EvaluateAtY Projection
GetBasePoint Reflection

Rectangle

The TGRect class defines an axisaligned rectangle that is defined by the coordinate points for the topleft corner and the bottomright corner. The topleft corner consists of the minimum x and y coordinates. The bottomright corner consists of the maximum x and y coordinates. TGRect can be passed to a TGrafPort for rendering. The TGRect member functions are summarized in Table 4.


Rectangles
TGRect Contains GetRightLine Pin
EqualSize GetHeight MapRect
ExtendTo GetWidth SetCenter
GetCenter GetSize Set
GetTopLeft Inset SetSize


[Contents] [Previous] [Next]
Click the icon to mail questions or corrections about this material to Taligent personnel.
Copyright©1995 Taligent,Inc. All rights reserved.

Generated with WebMaker