Class: TGLoop

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:

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:

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:

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:

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:

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:

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:

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:

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:

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:

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:

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:

Return Value:

Parameter.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:


Member Function: TGLoop::ArcLength

  1. GCoordinate ArcLength (GParametric uFrom, GParametric uTo) const
  2. GCoordinate ArcLength () const

Interface Category:

API.

Purpose:

Returns arc length of (optionally specified) section of the loop.

Calling Context:

  1. Call this function directly.
  2. Call this function directly.

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:

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

  1. TGPoint Evaluate (GParametric u) const
  2. TGPoint Evaluate (GParametric u, TGPoint & tangent) const
  3. TGPoint Evaluate (GParametric u, TGPoint & tangent, TGPoint & deriv2) const
  4. 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:

  1. Call this function directly.
  2. Call this function directly.
  3. Call this function directly.
  4. Call this function directly.

Parameters:

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:

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:

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:

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:

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:

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.

Member Function: TGLoop::~TGLoop

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.

Member Function: TGLoop::TGLoop

  1. TGLoop ()
  2. TGLoop (const TGLoop &)
  3. TGLoop (const TGCurve &, bool EOFill =true)
  4. TGLoop (unsigned long order, unsigned long numberPoints, bool EOFill =true)
  5. TGLoop (unsigned long order, unsigned long numberPoints, const TRawArray < GParametric > & knots, bool EOFill =true)
  6. TGLoop (unsigned long order, const TGRPointArray & points, bool EOFill =true)
  7. TGLoop (unsigned long order, const TGRPointArray & points, const TRawArray < GParametric > & knots, bool EOFill =true)
  8. TGLoop (const TGRect & rect)
  9. TGLoop (const TGEllipse & ellipse)
  10. TGLoop (const TGRect & roundRect, const TGPoint & aspect)
  11. TGLoop (const TGPolygon & polygon)
  12. TGLoop (const TGGlyphRun &)

Interface Category:

API.

Purpose:

  1. Default constructor.
  2. Copy constructor.
  3. 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.
  4. Constructs a TGLoop of the specified order and with the specified number of control points. The even-odd rule fill flag is set.
  5. 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.
  6. 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.
  7. 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.
  8. Constructs a TGLoop from the specified rectangle.
  9. Constructs a TGLoop from the specified ellipse.
  10. 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.
  11. Constructs a TGLoop from the specified polygon.
  12. Constructs a TGLoop from the specified TGGlyphRun.

Calling Context:

  1. Called by the stream-in operators. You can also call this function directly.
  2. Called to copy an object. You can also call this function directly.
  3. Call this function directly.
  4. Call this function directly.
  5. Call this function directly.
  6. Call this function directly.
  7. Call this function directly.
  8. Call this function directly.
  9. Call this function directly.
  10. Call this function directly.
  11. Call this function directly.
  12. Call this function directly.

Parameters:

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:

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.