![](../../Home/Icons/Home.gif)
![](../icons/UpCNM.gif)
![](../icons/CNMContext.gif)
![](../../Home/Icons/Search.gif)
Taxonomy Categories:
Member Functions:
Interface Category:
API.
Inherits From:
None.
Inherited By:
None.
Purpose:
The TGInfiniteLine class represents an infinitely long directional line. The line is identified by a direction vector and a base point. The direction vector is simply a TGPoint used to determine the line's angular orientation: If you imagine a line segment running from the origin (0,0) to the point defined by the TGPoint's coordinates, then the TGInfiniteLine is parallel to this line segment and points in the same direction. The base point is another TGPoint, representing a point that the infinite line runs through. The line extends to infinity in both directions, but the actual direction is determined by the direction vector.
The TGInfiniteLine class encapsulates a number of geometric calculations that involve lines, axes, and vectors. TGInfiniteLines are used in design and CAD (Computer-Assisted Design) applications where infinite construction lines relate one piece of geometry to another.
A TGInfiniteLine cannot be rendered in the GrafPort and is used as a computational element only.
Instantiation:
Allocate on the heap or the stack.
Deriving Classes:
Do not derive from this class.
Concurrency:
Not multithread safe.
Resource Use:
No special requirements.
- TGInfiniteLine ()
- TGInfiniteLine (const TGInfiniteLine & inf)
- TGInfiniteLine (const TGPoint & base, const TGPoint & direction)
- TGInfiniteLine (const TGPoint & base, GDegrees angle)
- TGInfiniteLine (const TGLine & l)
Interface Category:
API.
Purpose:
- Default constructor. The base and direction are initialized to TGPoint::kOrigin.
- Copy constructor.
- Creates a TGInfiniteLine with the specified base and direction.
- Creates a TGInfiniteLine through the given base at the given angle counterclockwise from the positive x-axis.
- Creates a TGInfiniteLine from the TGLine with the base point at the TGLine's start point and the direction as the vector from the start point to the end point.
Calling Context:
- Called by the stream-in operators. You can also call this function directly.
- Called to copy an object.
- Call this function directly.
- Call this function directly.
- Call this function directly.
Parameters:
- Takes no parameters.
- const TGInfiniteLine & inf -The infinite line which is copied.
- const TGPoint & base -The new base.
- const TGPoint & direction -The new direction.
- const TGPoint & base -The new base.
- GDegrees angle -The desired angle for the new infinite line.
- const TGLine & l -The line that is to be converted into an infinite line.
Return Value:
None.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Not multithread safe.
Other Considerations:
None.
virtual ~ TGInfiniteLine ()
Interface Category:
API.
Purpose:
Destructor.
Calling Context:
Called to destroy an object.
Parameters:
Return Value:
None.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Not multithread safe.
Other Considerations:
None.
Member Function: TGInfiniteLine::AngleBetween
GDegrees AngleBetween (const TGInfiniteLine & from =kXAxis) const
Interface Category:
API.
Purpose:
Returns the angle between this object and the specified infinite line.
Calling Context:
Call this function directly.
Parameters:
- const TGInfiniteLine & from =kXAxis -The infinite line from which the angle between it and this infinite line is to be determined.
Return Value:
The angle (in degrees) between this line and the specified line.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Not multithread safe.
Other Considerations:
None.
bool Clip (const TGRect & rect, TGLine & clipped) const
Interface Category:
API.
Purpose:
Clips the infinite line against the specified rectangle. If the infinite line is outside of the clipping rectangle, the second parameter is unmodified and false is returned; otherwise, true is returned and clipped is set to the TGLine that is clipped by the rectangle.
Calling Context:
Call this function directly.
Parameters:
- const TGRect & rect -The clipping rectangle.
- TGLine & clipped -The portion of the line that is clipped by the rectangle.
Return Value:
Returns true if the infinite line can be clipped by the rectangle; otherwise, returns false.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Not multithread safe.
Other Considerations:
None.
GCoordinate Distance (const TGPoint & point) const
Interface Category:
API.
Purpose:
Computes the perpendicular distance from the point to the infinite line. If the point is to the right of the line (in relation to its direction), the distance is positive; otherwise, it's negative.
Calling Context:
Call this function directly.
Parameters:
- const TGPoint & point -The point whose distance from the line is computed.
Return Value:
Returns the perpendicular distance from the point to the line.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Not multithread safe.
Other Considerations:
None.
Member Function: TGInfiniteLine::EvaluateAtX
TGPoint EvaluateAtX (GCoordinate x) const
Interface Category:
API.
Purpose:
Returns the point on the TGInfiniteLine that has the specified x-coordinate. If the infinite line is perpendicular to the x-axis and does not cross the x-axis at the specified x-coordinate, then a point at infinity (kInfinity, kInfinity) is returned. In the other case, if the infinite line is perpendicular to the x-axis and crosses it at the specified X-coordinate, then the point (X, kInfinity) is returned.
Calling Context:
Call this function directly.
Parameters:
- GCoordinate x -The x-coordinate.
Return Value:
The point on the line that has the x-coordinate.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Not multithread safe.
Other Considerations:
None.
Member Function: TGInfiniteLine::EvaluateAtY
TGPoint EvaluateAtY (GCoordinate y) const
Interface Category:
API.
Purpose:
Returns the point on the TGInfiniteLine that has the specified y-coordinate. If the infinite line is perpendicular to the y-axis and does not cross the y-axis at the specified y-coordinate, then a point at infinity (kInfinity, kInfinity) is returned. In the other case, if the infinite line is perpendicular to the y-axis and crosses it at the specified Y-coordinate, then the point (Y, kInfinity) is returned.
Calling Context:
Call this function directly.
Parameters:
- GCoordinate y -The y-coordinate.
Return Value:
The point on the line that has the y-coordinate.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Not multithread safe.
Other Considerations:
None.
TGPoint Evaluate (GParametric u) const
Interface Category:
API.
Purpose:
Returns the point on the infinite line at the specified parametric distance from the base point. If the parametric distance is equal to zero, Evaluate returns the base point; if parametric distance is equal to one, it returns the base point , plus the direction vector. Negative values of the parametric distance extend in the direction opposite the direction vector.
Calling Context:
Call this function directly.
Parameters:
- GParametric u -The parametric distance from the base point.
Return Value:
A TGPoint on the infinite line that is at the parametric distance from the base point.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Not multithread safe.
Other Considerations:
None.
Member Function: TGInfiniteLine::GetBasePoint
TGPoint GetBasePoint () const
Interface Category:
API.
Purpose:
Returns the base point of the TGInfiniteLine. The base point is a TGPoint on the infinite line that, along with the direction vector, defines the infinite line.
Calling Context:
Call this function directly.
Parameters:
Return Value:
A TGPoint that is the base point of this TGInfiniteLine.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Not multithread safe.
Other Considerations:
None.
Member Function: TGInfiniteLine::GetDirection
TGPoint GetDirection () const
Interface Category:
API.
Purpose:
Returns a vector in the direction of the TGInfiniteLine. The vector is not normalized.
Calling Context:
Call this function directly.
Parameters:
Return Value:
A TGPoint that is the direction vector of the TGInfiniteLine.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Not multithread safe.
Other Considerations:
None.
Member Function: TGInfiniteLine::Intersection
TGPoint Intersection (const TGInfiniteLine & line) const
Interface Category:
API.
Purpose:
Computes the intersection point of two infinite lines. Returns the intersection TGPoint. If the lines are parallel, then a point at infinity (kInfinity, kInfinity) is returned.
Calling Context:
Call this function directly.
Parameters:
- const TGInfiniteLine & line -The infinite line that intersects this object.
Return Value:
A TGPoint at which the two infinite lines intersect.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Not multithread safe.
Other Considerations:
None.
Member Function: TGInfiniteLine::Intersects
bool Intersects (const TGRect & rect) const
Interface Category:
API.
Purpose:
Tests whether the infinite line intersects the specified rectangle.
Calling Context:
Call this function directly.
Parameters:
- const TGRect & rect -The rectangle to be tested.
Return Value:
Returns true if the infinite line intersects the rectangle.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Not multithread safe.
Other Considerations:
None.
TGInfiniteLine Parallel (GCoordinate offset) const
Interface Category:
API.
Purpose:
Creates a TGInfiniteLine parallel to this one. The new line is offset perpendicularly by the amount specified. Facing the direction of the line, positive amounts are offset to the right, and negative to the left.
Calling Context:
Call this function directly.
Parameters:
- GCoordinate offset -The distance that offsets the new parallel line.
Return Value:
A new TGInfiniteLine that is parallel to the object.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Not multithread safe.
Other Considerations:
None.
Member Function: TGInfiniteLine::Projection
TGPoint Projection (const TGPoint & pt) const
Interface Category:
API.
Purpose:
Projects the specified point onto the infinite line with a perpendicular line, returning the TGPoint on the infinite line.
Calling Context:
Call this function directly.
Parameters:
- const TGPoint & pt -A TGPoint that is to be projected onto the infinite line.
Return Value:
A TGPoint on the infinite line.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Not multithread safe.
Other Considerations:
None.
Member Function: TGInfiniteLine::Perpendicular
TGInfiniteLine Perpendicular (bool negative =false) const
Interface Category:
API.
Purpose:
Returns a TGInfiniteLine that is perpendicular (+90 degrees) to this infinite line and that has the same base point. If the argument is true, then the returned infinite line has the opposite direction (-90 degrees).
Calling Context:
Call this function directly.
Parameters:
- bool negative =false -Specifies whether the perpendicular infinite line is rotated 90 degrees positively or negatively. The default (false) means a positive rotation.
Return Value:
A TGInfiniteLine perpendicular to the object.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Not multithread safe.
Other Considerations:
None.
Member Function: TGInfiniteLine::Reflection
TGInfiniteLine Reflection (const TGInfiniteLine & refAxis) const
Interface Category:
API.
Purpose:
Returns a TGInfiniteLine that is the reflection of this line about the specified line (refAxis). The argument can be any infinite line not just the x- or y-axis.
Calling Context:
Call this function directly.
Parameters:
Return Value:
A TGInfiniteLine that is the reflection of the object about the specified infinite line.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Not multithread safe.
Other Considerations:
None.
TGInfiniteLine Reverse () const
Interface Category:
API.
Purpose:
Returns a TGInfiniteLine pointing in the opposite direction to this infinite line.
Calling Context:
Call this function directly.
Parameters:
Return Value:
A TGInfiniteLine pointing in the opposite direction to this infinite line.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Not multithread safe.
Other Considerations:
None.
Member Function: TGInfiniteLine::ReverseDirection
void ReverseDirection ()
Interface Category:
API.
Purpose:
Reverses the direction of the infinite line.
Calling Context:
Call this function directly.
Parameters:
Return Value:
None.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Not multithread safe.
Other Considerations:
None.
Member Function: TGInfiniteLine::SetBasePoint
void SetBasePoint (const TGPoint & base)
Interface Category:
API.
Purpose:
Sets the base point of the TGInfiniteLine to the specified TGPoint.
Calling Context:
Call this function directly.
Parameters:
- const TGPoint & base -The new base point for the object.
Return Value:
None.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Not multithread safe.
Other Considerations:
None.
Member Function: TGInfiniteLine::SetDirection
void SetDirection (const TGPoint & direction)
Interface Category:
API.
Purpose:
Sets the direction vector of the TGInfiniteLine to the specified direction.
Calling Context:
Call this function directly.
Parameters:
- const TGPoint & direction -A vector specifying the new direction for the infinite line.
Return Value:
None.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Not multithread safe.
Other Considerations:
None.
TGInfiniteLine & operator =(const TGInfiniteLine & src)
Interface Category:
API.
Purpose:
Assignment operator.
Calling Context:
Called when an object is assigned to another compatible object.
Parameters:
Return Value:
A non-const reference to the left-hand side object.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Not multithread safe.
Other Considerations:
None.
Member Function: TGInfiniteLine::operator==
bool operator ==(const TGInfiniteLine & src) const
Interface Category:
API.
Purpose:
Tests whether the point's coordinates equal those of the argument.
Calling Context:
Called to test equivalence of two TGInfiniteLines.
Parameters:
Return Value:
Returns true if this infinite line's base and direction are identical to those of the parameter.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Not multithread safe.
Other Considerations:
None.
Member Function: TGInfiniteLine::operator!=
bool operator != (const TGInfiniteLine & src) const
Interface Category:
API.
Purpose:
Tests whether the infinite line's base and direction differ from those of the argument.
Calling Context:
Called to test non-equivalence of two infinite lines .
Parameters:
Return Value:
Returns true if this object's base does not equal the parameter's base, or this object's direction does not equal parameter's direction.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Not multithread safe.
Other Considerations:
None.
Member Function: TGInfiniteLine::operator<<=
TStream & operator <<= (TStream & fromwhere)
Interface Category:
API.
Purpose:
Stream-in operator.
Calling Context:
Called to stream in data.
Parameters:
- TStream & fromwhere -The stream that the object streams itself in from.
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: TGInfiniteLine::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 that the object streams itself out to.
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.