![](../../Home/Icons/Home.gif)
![](../icons/UpCNM.gif)
![](../icons/CNMContext.gif)
![](../../Home/Icons/Search.gif)
Declaration: Loop.h
Taxonomy Categories:
Member Functions:
Interface Category:
API.
Inherits From:
TGCurve
Inherited By:
None.
Purpose:
TGLoop draws a filled shape. If no knot vector is given, a floating closed loop is created. This uses a uniform knot vector that wraps around in a continuous fashion. If a pinned knot vector is used, then the loop behaves like a TGCurve that is closed with a straight line.
For continuously floating closed loops, TGCurve member functions that deal with the parameter range, evaluation, etc. are modified to take into account the continuously closed nature of the loop. If the loop is modified so that it has a pinned knot vector (or the ends of the knot vector range don't match) then the spell is broken, and the loop again behaves as a TGCurve, closed with a straight line at render time.
For some applications, a closed loop where the start and end control points are coincident may be preferable; calling CloseLoop on a loop (floating or pinned) will create this configuration without changing the shape.
Like TGPolygon, TGLoop has a flag, EOFill, that sets the filling algorithm. true means an even-odd rule is used for determining what area is filled, and false means a nonzero winding rule is used.
If the curve contains C0 discontinuities (that is, actual gaps rather than just kinks ), these gaps are closed when the loop is rendered. The direction of each section is used (along with the EOFill flag) in determining whether a point is inside or outside the loop. For example, to create the letter O using two concentric circles, the inner circle should run in the opposite parametric direction from the outer circle. This causes the region between the circles to be considered as the inside of the loop, while the region inside the inner circle is considered to lie outside the loop. As a result, the letter gets filled correctly.
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.
Other Considerations:
See TGCurve for more information.
Member Function: TGLoop::GetEOFill
bool GetEOFill () const
Interface Category:
API.
Purpose:
Determines which of the two filling rules is to be used.
Calling Context:
Call this function directly.
Parameters:
Return Value:
Returns true if an even-odd rule is being used for determining what area is filled and false if a non-zero winding rule is being used.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Not multithread safe.
Other Considerations:
None.
Member Function: TGLoop::SetEOFill
void SetEOFill (bool EOFill)
Interface Category:
API.
Purpose:
Sets the even-odd rule fill flag to the specified value.
Calling Context:
Call this function directly.
Parameters:
- bool EOFill -The value to set the flag to. It is true if an even-odd rule is being used for determining what area is filled and false if a non-zero winding rule is being used.
Return Value:
None.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Not multithread safe.
Other Considerations:
None.
Member Function: TGLoop::Intersects
bool Intersects (const TGRect & g) const
Interface Category:
API.
Purpose:
Determines whether this TGLoop intersects the specified rectangle.
Calling Context:
Call this function directly.
Parameters:
- const TGRect & g -The rectangle.
Return Value:
Returns true if this loop intersects the rectangle.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Not multithread safe.
Other Considerations:
None.
Member Function: TGLoop::Contains
bool Contains (const TGPoint & p) const
Interface Category:
API.
Purpose:
Determines whether this TGLoop contains the specified point. This operation is affected by the even-odd rule fill flag.
Calling Context:
Call this function directly.
Parameters:
- const TGPoint & p -The point which may or may not be contained in this loop.
Return Value:
Returns true if the loop contains the point.
Exceptions:
An assertion fails if the loop is empty (that is, both the order and the number of control points are equal to zero).
Concurrency:
Not multithread safe.
Other Considerations:
This must be solved numerically and may be computationally expensive for complex curves.
Member Function: TGLoop::ApproximateLowerOrder
void ApproximateLowerOrder (unsigned long newOrder, GCoordinate tolerance =0.2)
Interface Category:
API.
Purpose:
This is the same as the TGCurve member function, except that for continuous floating curves, the loop is first closed to preserve the shape.
Calling Context:
Call directly
Parameters:
- unsigned long newOrder -New order of the curve.
- GCoordinate tolerance =0.2 -See TGCurve doc.
Return Value:
None.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Not multithread safe.
Other Considerations:
Member Function: TGLoop::RaiseOrder
void RaiseOrder (unsigned long newOrder)
Interface Category:
API.
Purpose:
Same as TGCurve::RaiseOrder, except closes the loop first to preserve the shape.
Calling Context:
Call this function directly.
Parameters:
- unsigned long newOrder -New order of loop.
Return Value:
None.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Not multithread safe.
Other Considerations:
Member Function: TGLoop::DragTangent
void DragTangent (GParametric u, const TGPoint & toTangent, GParametric segmentMinimum =0.2, GParametric segmentMaximum =0.8)
Interface Category:
API.
Purpose:
This is the same as TGCurve::DragTangent, except that for floating continuous loops, the closed part (outside of the internal parameter range) may be dragged.
Calling Context:
Call this function directly.
Parameters:
- GParametric u -See TGCurve::DragTangent.
- const TGPoint & toTangent -See TGCurve::DragTangent.
- GParametric segmentMinimum =0.2 -See TGCurve::DragTangent.
- GParametric segmentMaximum =0.8 -See TGCurve::DragTangent.
Return Value:
None.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Not multithread safe.
Other Considerations:
Member Function: TGLoop::DragPosition
void DragPosition (GParametric u, const TGPoint & toPoint, GParametric segmentMinimum =0.2, GParametric segmentMaximum =0.8)
Interface Category:
API.
Purpose:
This is the same as TGCurve::DragTangent, except that for floating continuous loops, the closed part (outside of the internal parameter range) may be dragged.
Calling Context:
Call this function directly.
Parameters:
- GParametric u -See TGCurve::DragTangent.
- const TGPoint & toTangent -See TGCurve::DragTangent.
- GParametric segmentMinimum =0.2 -See TGCurve::DragTangent.
- GParametric segmentMaximum =0.8 -See TGCurve::DragTangent.
Return Value:
None.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Not multithread safe.
Other Considerations:
Member Function: TGLoop::GetSectionOfCurve
void GetSectionOfCurve (GParametric from, GParametric to, TGCurve & section) const
Interface Category:
API.
Purpose:
Like TGCurve::GetSectionOfCurve, but allows access to closed part of loop. Note that if the parameters cross the seam of the loop, the rest of the loop is returned.
Calling Context:
Call this function directly.
Parameters:
- GParametric from -Start parameter of section.
- GParametric to -End parameter of section.
- TGCurve & section -Returned section.
Return Value:
None.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Not multithread safe.
Other Considerations:
Member Function: TGLoop::RefineToPinned
void RefineToPinned ()
Interface Category:
API.
Purpose:
Same as TGCurve::RefineToPinned, but closes loop first
Calling Context:
Call this function directly.
Parameters:
Return Value:
None.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Not multithread safe.
Other Considerations:
Member Function: TGLoop::RefineToBeziers
void RefineToBeziers ()
Interface Category:
API.
Purpose:
Same as TGCurve, but closes loop first.
Calling Context:
Call this function directly.
Parameters:
Return Value:
None.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Not multithread safe.
Other Considerations:
Member Function: TGLoop::MakeDiscontinuity
void MakeDiscontinuity (GParametric u, EDiscontinuity cont)
Interface Category:
API.
Purpose:
Same as TGCurve, but extends loop first if u is outside the range of a floating closed loop.
Calling Context:
Call this function directly.
Parameters:
- GParametric u -Where to put break in loop.
- EDiscontinuity cont -Discontinuity.
Return Value:
None.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Not multithread safe.
Other Considerations:
Member Function: TGLoop::InsertKnot
void InsertKnot (GParametric u)
Interface Category:
API.
Purpose:
Same as TGCurve, but closes loop first if required.
Calling Context:
Call this function directly.
Parameters:
- GParametric u -Parameter to insert knot at.
Return Value:
None.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Not multithread safe.
Other Considerations:
Member Function: TGLoop::NearestParametric
GParametric NearestParametric (const TGPoint & test) const
Interface Category:
API.
Purpose:
Same as TGCurve::NearestParametric, but extends loop if necessary
Calling Context:
Call this function directly.
Parameters:
- const TGPoint & test -Point near the curve.
Return Value:
Parameter value of loop of point nearest test.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Not multithread safe.
Other Considerations:
Member Function: TGLoop::GetMaxParameter
GParametric GetMaxParameter () const
Interface Category:
API.
Purpose:
Normally, a floating continuous TGLoop is represented by a TGCurve with floating end conditions that don't meet. In order to operate on the entire loop, the loop is often extended first, so overlapping control points are generated to make a fully closed shape. Once the operation is completed, it's possible to retract the loop to minimize storage usage. GetMaxParameter returns the value of the extended curve representing the Loop. Many of the TGCurve member functions have been modified to respect this extended parameter range. If the loop is closed (i.e., first and last control points meet, pinned knot vector) then this routine behaves just like TGCurve::GetMaxParameter
Calling Context:
Call this function directly.
Parameters:
Return Value:
Extended parameter range.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Not multithread safe.
Other Considerations:
Member Function: TGLoop::ApproximateParameterFromArcLength
GParametric ApproximateParameterFromArcLength (GCoordinate length, GCoordinate tolerance =0.02) const
Interface Category:
API.
Purpose:
Same as TGCurve::ApproximateParameterFromArcLength, but works with loops.
Calling Context:
Call this function directly.
Parameters:
- GCoordinate length -Arc length along curve.
- GCoordinate tolerance =0.02 -Accuracy tolerance for computation.
Return Value:
Parameter.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Not multithread safe.
Other Considerations:
Member Function: TGLoop::ArcLength
- GCoordinate ArcLength (GParametric uFrom, GParametric uTo) const
- GCoordinate ArcLength () const
Interface Category:
API.
Purpose:
Returns arc length of (optionally specified) section of the loop.
Calling Context:
- Call this function directly.
- Call this function directly.
Parameters:
- GParametric uFrom -Start of section.
- GParametric uTo -End of section.
- Takes no parameters.
Return Value:
Arc length along curve.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Not multithread safe.
Other Considerations:
Member Function: TGLoop::EvaluateW
TGRPoint EvaluateW (GParametric u) const
Interface Category:
API.
Purpose:
Returns the point (as a TGRPoint) on the TGLoop at the specified parametric value.
Calling Context:
Call this function directly.
Parameters:
- GParametric u -The parametric value at which to evaluate the loop.
Return Value:
The TGRPoint on the loop at the parametric location.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Not multithread safe.
Other Considerations:
None.
Member Function: TGLoop::Evaluate
- TGPoint Evaluate (GParametric u) const
- TGPoint Evaluate (GParametric u, TGPoint & tangent) const
- TGPoint Evaluate (GParametric u, TGPoint & tangent, TGPoint & deriv2) const
- TGPoint Evaluate (GParametric u, TGPoint & tangent, TGPoint & deriv2, GCoordinate & curvature) const
Interface Category:
API.
Purpose:
As with GetMaxParameter, the evaluation member functions for TGLoop extend the loop with overlapping control points if necessary, call TGCurve::Evaluate, then retract the loop (if necessary). See TGCurve for more documentation.
Calling Context:
- Call this function directly.
- Call this function directly.
- Call this function directly.
- Call this function directly.
Parameters:
- GParametric u -The parametric value at which to evaluate the curve. The value passed in should not be outside the range defined by GetMinParameter and GetMaxParameter.
- GParametric u -The parametric value at which to evaluate the curve. The value passed in should not be outside the range defined by GetMinParameter and GetMaxParameter.
- TGPoint & tangent -A vector representing the tangent of the curve at this point; computed by this function.
- GParametric u -The parametric value at which to evaluate the curve. The value passed in should not be outside the range defined by GetMinParameter and GetMaxParameter.
- TGPoint & tangent -A vector representing the tangent of the curve at this point; computed by this function.
- TGPoint & deriv2 -The second derivative of the loop at this point; computed by this function.
- GParametric u -The parametric value at which to evaluate the curve. The value passed in should not be outside the range defined by GetMinParameter and GetMaxParameter.
- TGPoint & tangent -A vector representing the tangent of the curve at this point; computed by this function.
- TGPoint & deriv2 -The second derivative of the curve at this point; computed by this function.
- 5 GCoordinate & curvature -The curvature at this point, computed by this function.
Return Value:
The point on the curve that corresponds to the specific parametric value.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Not multithread safe.
Other Considerations:
See TGCurve for more information.
Member Function: TGLoop::CloseLoop
void CloseLoop ()
Interface Category:
API.
Purpose:
CloseLoop refines the loop so that the start and ending control points are coincident. If this is already the case, then nothing happens.
Calling Context:
Call this function directly.
Parameters:
Return Value:
None.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Not multithread safe.
Other Considerations:
Member Function: TGLoop::operator!=
bool operator != (const TGLoop & Src) const
Interface Category:
API.
Purpose:
Tests two TGLoops for inequality, by seeing whether their geometries are identical.
Calling Context:
Call this function directly.
Parameters:
- const TGLoop & Src -The loop to be compared with this one.
Return Value:
Returns true if this TLoop and the argument have non-identical geometries.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Not multithread safe.
Other Considerations:
None.
Member Function: TGLoop::operator==
bool operator ==(const TGLoop & Src) const
Interface Category:
API.
Purpose:
Tests two TGLoops for equality, by seeing whether the geometries are identical.
Calling Context:
Call this function directly.
Parameters:
- const TGLoop & Src -The loop to be compared with this one.
Return Value:
Returns true if this TLoop and the argument have identical geometries.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Not multithread safe.
Other Considerations:
None.
Member Function: TGLoop::operator=
TGLoop & operator =(const TGLoop & Src)
Interface Category:
API.
Purpose:
Assignment operator.
Calling Context:
Called when an object is assigned to another compatible object.
Parameters:
- const TGLoop & Src -The object to be copied.
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: TGLoop::operator<<=
TStream & operator <<= (TStream &)
Interface Category:
API.
Purpose:
Stream-in operator.
Calling Context:
Called to stream in data.
Parameters:
- TStream & -The stream 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: TGLoop::operator>>=
TStream & operator >>=(TStream &) const
Interface Category:
API.
Purpose:
Stream-out operator.
Calling Context:
Called to stream out data.
Parameters:
- TStream & -The stream 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.
virtual ~ TGLoop ()
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.
- TGLoop ()
- TGLoop (const TGLoop &)
- TGLoop (const TGCurve &, bool EOFill =true)
- TGLoop (unsigned long order, unsigned long numberPoints, bool EOFill =true)
- TGLoop (unsigned long order, unsigned long numberPoints, const TRawArray < GParametric > & knots, bool EOFill =true)
- TGLoop (unsigned long order, const TGRPointArray & points, bool EOFill =true)
- TGLoop (unsigned long order, const TGRPointArray & points, const TRawArray < GParametric > & knots, bool EOFill =true)
- TGLoop (const TGRect & rect)
- TGLoop (const TGEllipse & ellipse)
- TGLoop (const TGRect & roundRect, const TGPoint & aspect)
- TGLoop (const TGPolygon & polygon)
- TGLoop (const TGGlyphRun &)
Interface Category:
API.
Purpose:
- Default constructor.
- Copy constructor.
- Constructs a TGLoop from the specified TGCurve. The even or odd fill flag is set to the specified value. If any C0 discontinuities are encountered in the curve defining the loop, they are closed separately when the loop is rendered.
- Constructs a TGLoop of the specified order and with the specified number of control points. The even-odd rule fill flag is set.
- Constructs a TGLoop of the specified order and with the specified number of control points and with the specified knot vector. The even-odd rule fill flag is set.
- Constructs a TGLoop of the order, with the control points, and with the knot vector, all specified in the respective parameters. The even-odd rule fill flag is set.
- Constructs a TGLoop of the specified order and with the specified number of control points and with the specified knot vector. The even-odd rule fill flag is set.
- Constructs a TGLoop from the specified rectangle.
- Constructs a TGLoop from the specified ellipse.
- Constructs a TGLoop from the specified rectangle. The resulting loop is a rounded rectangle, that has sixteen control points--four at the corners, four at the midpoints of the sides, and two on either side of each corner. The aspect parameter controls how far the latter points are from each corner.
- Constructs a TGLoop from the specified polygon.
- Constructs a TGLoop from the specified TGGlyphRun.
Calling Context:
- Called by the stream-in operators. You can also call this function directly.
- Called to copy an object. You can also call this function directly.
- Call this function directly.
- Call this function directly.
- Call this function directly.
- Call this function directly.
- Call this function directly.
- Call this function directly.
- Call this function directly.
- Call this function directly.
- Call this function directly.
- Call this function directly.
Parameters:
- Takes no parameters.
- const TGLoop & -The loop to be copied.
- const TGCurve & -The curve to be converted into a loop.
- bool EOFill =true -The even-odd rule fill flag.
- unsigned long order -The order of the loop.
- unsigned long numberPoints -The number of control points.
- bool EOFill =true -The even-odd rule fill flag.
- unsigned long order -The order of the loop.
- unsigned long numberPoints -The number of control points.
- const TRawArray < GParametric > & knots -The knot vector.
- bool EOFill =true -The even-odd rule fill flag.
- unsigned long order -The order of the loop.
- const TGRPointArray & points -The array of control points.
- bool EOFill =true -The even-odd rule fill flag.
- unsigned long order -The order of the loop.
- const TGRPointArray & points -The array of control points.
- const TRawArray < GParametric > & knots -The knot vector.
- bool EOFill =true -The even-odd rule fill flag.
- const TGRect & rect -The rectangle to be converted into a loop.
- const TGEllipse & ellipse -The ellipse to be converted into a loop.
- const TGRect & roundRect -The rectangle to be converted into a rounded rectangle loop.
- const TGPoint & aspect -The pair of coordinates that control how rounded the rectangle is. The value (0,0) generates a normal, non-rounded rectangle. Larger coordinates cause more rounded corners. For each corner of the rectangle, a control point is placed on the top or bottom side of the rectangle at the distance aspect.fX away from the corner. Similarly, another control point is placed on the left or right side of the rectangle at the distance aspect.fY from the corner. You should generally use a value of aspect where fX is less than half of the rectangle's width, and fY is less than half of the height. Larger values are permitted, but are clipped, which might give unexpected results.
- const TGPolygon & polygon -The polygon to be converted into a loop.
- const TGGlyphRun & -The glyph run to be converted into a loop.
Return Value:
None.
Exceptions:
An assertion fails if the order is less than two, or if the number of control points is less than the order, or the knot vector is less than the order plus the number of control points.
Concurrency:
Not multithread safe.
Other Considerations:
None.
Member Function: TGLoop::MakeCompatible
static void MakeCompatible (TGLoop & curve1, TGLoop & curve2)
Interface Category:
API.
Purpose:
Modifies both curves to have the same order, the same number of points, and the same knot vector, without changing the shape of either curve. This is accomplished by raising the order and refining the knot vectors as necessary.
Calling Context:
Call this function directly
Parameters:
Parameters:
- TGLoop & curve1 -The first curve to be made compatible.
- TGLoop & curve2 -The second curve to be made compatible to.
Return Value:
None.
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.