Taxonomy Categories:
Member Functions:
Interface Category:
API
Inherits From:
None.
Inherited By:
None.
Purpose:
A quadrilateral is a four-sided polygon. The TGQuadrilateral class is used by TGrafMatrix::SetToPerspectiveMap to specify perspective and affine mapping. A TGQuadrilateral can be any set of any four points. However, classes that use TGQuadrilateral, such as TGrafMatrix, can impose further restrictions to ensure that the polygon is not degenerate, requiring (for example) that no two points be identical or that no three points be colinear.
Instantiation:
Allocate on the heap or the stack.
Deriving Classes:
Do not derive classes from TGQuadrilateral.
Concurrency:
Not multithread safe.
Resource Use:
No special requirements.
- TGQuadrilateral ()
- TGQuadrilateral (const TGRect &)
- TGQuadrilateral (const TGPoint & p0, const TGPoint & p1, const TGPoint & p2, const TGPoint & p3)
- TGQuadrilateral (const TGQuadrilateral &)
Interface Category:
API.
Purpose:
- Default constructor.
- Creates a quadrilateral for a rectilinear mapping.
- Creates a quadrilateral for a general perspective mapping.
- Copy constructor.
Calling Context:
- Called by the stream-in operators. You can also call this function directly.
- Call this function directly.
- Call this function directly.
- Called to copy an object. You can also call this function directly.
Parameters:
- Takes no parameters.
- const TGRect & -A rectangle with Vertex 0 =Top-Left, Vertex 1 =Top-Right, Vertex 2 =Bottom-Right, and Vertex 3 =Bottom-Left.
- const TGPoint & p0 -Vertex 0.
- const TGPoint & p1 -Vertex 1.
- const TGPoint & p2 -Vertex 2.
- const TGPoint & p3 -Vertex 3.
- const TGQuadrilateral & -The quadrilateral to be copied.
Return Value:
None.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Not multithread safe.
Other Considerations:
None.
virtual ~ TGQuadrilateral ()
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.
void GetPoints (TGPoint & p0, TGPoint & p1, TGPoint & p2, TGPoint & p3) const
Interface Category:
API.
Purpose:
Returns, in the specified parameters, the quadrilateral's four vertices.
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.
TGPoint GetPoint (unsigned long index) const
Interface Category:
API.
Purpose:
Returns the specified vertex.
Calling Context:
Call this function directly.
Parameters:
- unsigned long index -The n for vertex n, which must be less than 4.
Return Value:
The specified vertex.
Exceptions:
Fails a parameter assertion if the index is greater than 3.
Concurrency:
Not multithread safe.
Other Considerations:
None.
void SetPoint (unsigned long index, const TGPoint & p)
Interface Category:
API.
Purpose:
Sets the specified vertex.
Calling Context:
Call this function directly.
Parameters:
- unsigned long index -The n for vertex n.
- const TGPoint & p -The new value for vertex n.
Return Value:
None.
Exceptions:
Fails a parameter assertion if the index is greater than 3.
Concurrency:
Not multithread safe.
Other Considerations:
None.
void TransformBy (const TGrafMatrix & mat)
Interface Category:
API.
Purpose:
Passes a quadrilateral through a linear transformation.
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.
TGRect GetBounds () const
Interface Category:
API.
Purpose:
Returns the geometry's bounding rectangle (the smallest axis-aligned rectangle that encloses the quadrilateral).
Calling Context:
Call this function directly.
Parameters:
Return Value:
The bounding rectangle.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Not multithread safe.
Other Considerations:
None.
TStream & operator >>=(TStream &) const
Interface Category:
API.
Purpose:
Stream-out operator.
Calling Context:
Called to stream out data.
Parameters:
- TStream & -The stream to which the object 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.
TStream & operator <<= (TStream &)
Interface Category:
API.
Purpose:
Stream-in operator.
Calling Context:
Called to stream in data.
Parameters:
- TStream & -The stream from which the object 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.
TGQuadrilateral & operator =(const TGQuadrilateral & 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.
bool operator ==(const TGQuadrilateral & Src) const
Interface Category:
API.
Purpose:
Allows you to quickly determine if this quadrilateral is equal to another quadrilateral.
Calling Context:
Call this function directly.
Parameters:
Return Value:
Returns true if this->vertex0 ==Src.vertex0 and this->vertex1 ==Src.vertex1 and this->vertex2 ==Src.vertex2 and this->vertex3 ==Src.vertex3.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Not multithread safe.
Other Considerations:
None.
bool operator != (const TGQuadrilateral & Src) const
Interface Category:
API.
Purpose:
Allows you to quickly determine if this quadrilateral is not equal to another quadrilateral.
Calling Context:
Call this function directly.
Parameters:
Return Value:
Returns true if this->vertex0 != Src.vertex0 or this->vertex1 != Src.vertex1 or this->vertex2 != Src.vertex2 or this->vertex3 != Src.vertex3.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Not multithread safe.
Other Considerations:
None.
Member Function: TGQuadrilateral::IsDegenerate
bool IsDegenerate () const
Interface Category:
API.
Purpose:
Checks to see if the TGQuadrilateral is a degenerate polygon. If the polygon that makes up the quadrilateral is either concave or colinear (no two points are identical or no three points are colinear), then it returns true, otherwise, false.
Calling Context:
Call this function directly.
Parameters:
Return Value:
Returns true if the points that make up the quadrilateral are either concave or colinear (no two points are identical or no three points are colinear).
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.