IGLoop2D

IGLoop2D is subclassed from IGCurve2D, which draws a filled shape. IGLoop2D draws a filled shape. If no knot vector is specified, a floating closed loop is created. A floating closed loop uses a uniform knot vector that wraps around in a continuous fasion. If a pinned knot vector is used, then the loop behaves like an IGCurve2D that is closed with a straight line. For continuously floating closed loops, IGCurve2D functions that affect a parameter range, evaluation, and so forth, 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 loop again behaves as an IGCurve2D, closed with a straight line at render time.

For some applications, a closed loop whose start and end control points coincide may be preferable; calling the closeLoop default constructor on a loop, whether floating or pinned, will create this configuration without changing the shape. If c0 discontinuities are encountered in the curve defining the loop, they are closed separately when the loop is rendered; internal segments are closed with straight lines. The direction of each piece is used to determine whether a point is inside or outside the loop, along with the setting of the EOFill flag.

Note that IRawArray does not check whether allocation is successful. Before construction, your should check to ensure that there is enough memory and use a reasonable size.


IGLoop2D - Member Functions and Data by Group

Constructors & Destructor

Use the functions in this group to construct and destroy objects of class IGLoop2D.


[view class]
~IGLoop2D
public:
virtual ~IGLoop2D()
Destroys the 2D loop object.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


[view class]
IGLoop2D
Constructs a 2D loop of class IGLoop2D.


Overload 1
Constructs a 2D loop from the given polygon.
public:
IGLoop2D(const IGPolygon2D& polygon)
Use this constructor to create a 2D loop from the Cspecified polygon. The seam is at the bottom of the top right corner.

polygon
A constant reference to the polygon to be converted into a loop.

Exception

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.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


Overload 2
Copy constructor.
public:
IGLoop2D(const IGLoop2D&)
Use this constructor to create a 2D loop that is copied from the given one.

IGLoop2D
A constant reference to the loop to be copied.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


Overload 3
Constructs a 2D loop from the specified ellipse.
public:
IGLoop2D(const IGEllipse2D& ellipse)
Constructs a 2D loop from the given ellipse. The seam is at the rightmost edge of the ellipse.

ellipse
The ellipse to be converted into a loop.

Exception

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.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


Overload 4
Constructs a 2D loop with the specified order and control points.
public:
IGLoop2D( unsigned long order, const IGRPoint2DArray& points, bool EOFill = true )
Constructs an IGLoop2D of the given order and with the specified control points.

order
The order of the loop.
points
The number of control points.
EOFill
The even-odd rule fill flag. By default, EOFill is set to TRUE.

Exception

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.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


Overload 5
Constructs a 2D loop using the specified order, control points and knot vector.
public:
IGLoop2D( unsigned long order, const IGRPoint2DArray& points, const IRawArray < GParametric >& knots, bool EOFill = true )
Constructs a 2D loop of the given order, with the specified control points and the knot vector.

order
The order of the loop.
points
The number of control points.
knots
The knot vector.
EOFill = true
The even-odd rule fill flag.

Exception

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.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


Overload 6
Constructs a 2D loop of the specified order and number of control points.
public:
IGLoop2D( unsigned long order, unsigned long numberPoints, bool EOFill = true )
Use this constructor to create a 2D loop of the specified order and number of control points.

order
The order of the loop.
numberPoints
The number of control points.
EOFill
The even-odd rule fill flag. The default value is TRUE.

Exception

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.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


Overload 7
Constructs a 2D loop of the given order with the specified number of control points and the knot vector.
public:
IGLoop2D( unsigned long order, unsigned long numberPoints, const IRawArray < GParametric >& knots, bool EOFill = true )
Use this constructor to create a 2D loop of the given order with the specified number of control points and the knot vector.

order
The order of the loop.
numberPoints
The number of control points.
knots
The knot vector.
EOFill
The even-odd rule fill flag. The default value is TRUE.

Exception

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.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


Overload 8
Constructs a 2D loop from the given rectangle.
public:
IGLoop2D(const IGRect2D& rect)
Use this constructor to create a 2D loop from the given rectangle. The seam is at the top left corner.

rect
A constant reference to the rectangle to be converted into a loop.

Exception

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.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


Overload 9
Constructs an IGLoop2D from the specified rectangle.
public:
IGLoop2D( const IGRect2D& roundRect, const IGPoint2D& aspect )
Use this constructor to create a 2D loop from the given rectangle. The resulting loop is a rounded rectangle whose seam is at the bottom of the top right corner. The rounded rectangle 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.

roundRect
A constant reference to the rectangle to be converted into a rounded rectangle loop.
aspect
A constant reference to the pair of coordinates that control how rounded the rectangle is.

Exception

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.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


Overload 10
Constructs a 2D loop from the given 2D curve.
public:
IGLoop2D(const IGCurve2D&, bool EOFill = true)
Use this constructor to create a 2D loop from the given 2D curve.

IGCurve2D
A constant reference to the curve to be converted into a loop.
EOFill
The even-odd rule fill flag. By default, this parameter is set to TRUE.

Exception

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.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


Overload 11
The default constructor, which creates an empty loop.
public:
IGLoop2D()
Use the default copy constructor to create an empty loop, with 0 points and 0 order, that performs no rendering.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


Approximating Values

Use the functions in this group to approximate the current 2D loop with a lower-order one and to approximate the parameter, given a particular arc length along the loop.


[view class]
approximateLowerOrder
public:
void approximateLowerOrder( unsigned long newOrder, GCoordinate tolerance = 0.2 )
Approximates this IGLoop2D with a lower-order one.

newOrder
The order of the new loop; must be greater than 2, but not greater than the current order.
tolerance
The tolerance, specified in absolute coordinates, not relative to the size of the loop. Default value is 0.2.

Exception

A parameter assertion fails if the new order is less than or equal to the loop's current order, or greater than 2

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


[view class]
approximateParameterFromArcLength
public:
GParametric approximateParameterFromArcLength( GCoordinate length, GCoordinate tolerance = 0.02 ) const
Approximates the parameter, given a particular arc length along the loop.

length
Arc length along curve.
tolerance
Accuracy tolerance is used for the accuracy of the root finder. By default, tolerance is set to 0.02.

Return
Parameter.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


Assignment Operator

Use this operator to replace the existing object with the given, assigned one.


[view class]
operator =
public:
IGLoop2D& operator =(const IGLoop2D& Src)
Assignment operator.

Src
The object to be copied.

Return
A non-const reference to the left-hand side object.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


Closing the Loop

Use the functions in this group to close the loop by making its starting and ending control points coincide or to add a discontinuity at a parametric location after closing the loop.


[view class]
closeLoop
Refines the loop so that the starting and ending control points are coincident.
public:
void closeLoop()
CloseLoop refines the loop so that the start and ending control points are coincident. Forces a loop to be closed, so the endpoints of the control polygon actually meet. If the loop was defined with a floating knot vector, then points are added to retain the original (continous) shape. If a loop is aready closed (last point equals first, pinned knot vector) nothing changes. If a loop has a pinned (or other) knot vector, a straight line segment is added to close it.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


[view class]
makeDiscontinuity
public:
void makeDiscontinuity(GParametric u, EDiscontinuity cont)
Adds a discontinuity at a parametric location u after closing the loop.

u
Parameter specified where to put break in loop.
cont
Discontinuity.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


Equality and Inequality Operators

Use the operators in this group to test a given 2D loop with the current one for equality or inequality.


[view class]
operator !=
public:
bool operator !=(const IGLoop2D& Src) const
Tests two IGLoop2D objects for inequality, by seeing whether the geometries are identical.

Src
The loop to be compared with this one.

Return
True if this IGLoop2D and the argument have different geometries.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


[view class]
operator ==
public:
bool operator ==(const IGLoop2D& Src) const
Tests two IGLoop2D objects for equality, by seeing whether the geometries are identical.

Src
The loop to be compared with this one.

Return
True if this IGLoop2D and the argument have identical geometries.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


Modifying One or Two Loops

Use the functions in this group to modify a loop by changing its shape or making its starting and ending control points coincident, or to modify two loops to have the same order, the same number of points, and the same knot vector, without changing the shape of either of them.


[view class]
dragPosition
public:
void dragPosition( GParametric u, const IGPoint2D& toPoint, GParametric segmentMinimum = 0.2, GParametric segmentMaximum = 0.8 )
Changes the loop shape so that at the parametric value given by u, it goes through the control point specified by toPoint after closing the loop.

u
The parametric position on the loop.
toPoint
The point to match.
segmentMinimum
The parametric value below which a point on the loop will not be moved. The default value is 0.2.
segmentMaximum
The parametric value above which a point on the loop will not be moved. The default values is 0.8.

Exception

An assertion fails if the curve is empty (uninitialized).

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


[view class]
dragTangent
public:
void dragTangent( GParametric u, const IGPoint2D& toTangent, GParametric segmentMinimum = 0.2, GParametric segmentMaximum = 0.8 )
Changes loop shape so that at parameter u, it has the specified tangent.

u
The parametric position on the loop.
toTangent
The new tangent at the specified parametric position.
segmentMinimum
The parametric value below which a point on the loop will not be moved. By default, segmentMinimum is set to 0.2.
segmentMaximum
The parametric value above which a point on the loop will not be moved. By default, segmentMaximum is set to 0.8.

Exception

An assertion fails if the curve is empty (uninitialized).

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


[view class]
insertKnot
public:
void insertKnot(GParametric u)
Inserts a single new knot or control point at given parametric location after closing the loop.

u
Parameter to insert knot at.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


[view class]
makeCompatible
public:
static void makeCompatible( IGLoop2D& curve1, IGLoop2D& curve2 )
Modifies both loops to have the same order, the same number of points, and the same knot vector, without changing the shape of either loop.

curve1
The first loop to be made compatible.
curve2
The second loop to be made compatible.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


[view class]
raiseOrder
public:
void raiseOrder(unsigned long newOrder)
Raises the degree of this IGLoop2D to the specified order.

newOrder
The degree to which the loop should be raised.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


[view class]
refineToBeziers
public:
void refineToBeziers()
Turns the curve into a collection of piecewise Bezier segments after closing the loop.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


[view class]
refineToPinned
public:
void refineToPinned()
Creates a pinned curve and knot vector after closing the loop.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


Obtaining and Modifying a Loop's Control Points

Use the functions in this group to obtain a control point at a specific location, compute the tangent at the point, compute the tangent and second derivative at the point, determine whether the loop contains a specific control point, and reverse the order of a curve's points so the parameterization runs the opposite direction.


[view class]
evaluate


Overload 1
Returns the point on the 2D loop at the specified parametric value. Computes the tangent, second derivative, and curvature at this point.
public:
IGPoint2D evaluate( GParametric u, IGPoint2D& tangent, IGPoint2D& deriv2, GCoordinate& curvature ) const

u
The parametric value at which to evaluate the loop. GetMinParameter<= u <=GetMaxParameter.
tangent
A vector representing the tangent of the loop at this point; computed by this function.
derive2
The second derivative of the loop at this point; computed by this function.
curvature
The curvature at this point; computed by this function.

Return
The point on the loop that corresponds to the specified parametric value.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


Overload 2
Returns the point on the 2D loop at the specified parametric value.
public:
IGPoint2D evaluate(GParametric u) const

u
The parametric value at which to evaluate the loop. GetMinParameter<= u <=GetMaxParameter.

Return
The point on the loop that corresponds to the specified parametric value.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


Overload 3
Returns the point on the 2D loop at the specified parametric value. Computes the tangent at this point.
public:
IGPoint2D evaluate(GParametric u, IGPoint2D& tangent) const

u
The parametric value at which to evaluate the loop. GetMinParameter<= u <=GetMaxParameter.
tangent
A vector representing the tangent of the loop at this point; computed by this function.

Return
The point on the loop that corresponds to the specified parametric value.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


Overload 4
Returns the point on the2D loop at the specified parametric value. Computes the tangent and second derivative at this point.
public:
IGPoint2D evaluate( GParametric u, IGPoint2D& tangent, IGPoint2D& deriv2 ) const

u
The parametric value at which to evaluate the loop. GetMinParameter<= u <=GetMaxParameter.
tangent
A vector representing the tangent of the loop at this point; computed by this function.
derive2
The second derivative of the loop at this point; computed by this function.

Return
The point on the loop that corresponds to the specified parametric value.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


[view class]
evaluateW
public:
IGRPoint2D evaluateW(GParametric u) const
Returns the point as an IGRPoint2 on the 2D loop at the specified parametric value.

u
The parametric value at which to evaluate the loop. GetMinParameter<= u <=GetMaxParameter.

Return
The IGRPoint2D on the loop at the parametric location.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


[view class]
reverseDirection
public:
void reverseDirection()
Reverses the order of a curve's points so the parameterization runs the opposite direction. The geometric shape is unchanged.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


Obtaining Information About the Loop

Use these functions to obtain information about the loop, such as the length of its arc, the extended curve representing the loop, the length of a specific section of its arc, a section of the loop, whether the loop contains a specific control point, parametric range of a section of a loop, and whether the loop intersects a given triangle.


[view class]
arcLength


Overload 1
Returns the arc length of the loop.
public:
GCoordinate arcLength() const

Return
Arc length along curve.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


Overload 2
Returns the arc length of an optionally specified section of the loop.
public:
GCoordinate arcLength( GParametric uFrom, GParametric uTo ) const

uFrom
Start of section.
uTo
End of section.

Return
Arc length along curve.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


[view class]
bounds
public:
virtual IGRect2D bounds() const
Returns the bounds of the loop's control points.

Return
The rectangle that bounds the loop.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


[view class]
contains
public:
bool contains(const IGPoint2D& p) const
Determines whether this 2D loop contains the specified point.

p
The point which may or may not be contained in this loop.

Return
True if the loop contains the point.

Exception

An assertion fails if the loop is empty (that is, both the order and the number of control points are equal to zero).

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


[view class]
intersects
public:
bool intersects(const IGRect2D& g) const
Determines whether this IGLoop2D intersects the specified rectangle.

g
The rectangle.

Return
True if this loop intersects the rectangle.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


[view class]
maxParameter
public:
GParametric maxParameter() const
Returns the value of the extended curve representing the Loop.

Point
near the curve.

Return
Extended parameter range.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


[view class]
nearestParametric
public:
GParametric nearestParametric(const IGPoint2D& test) const
Returns the parametric value of the closest point on the extended loop to the center of the rectangle.

test
Point near the curve.

Return
Parameter value of loop of point nearest test.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


[view class]
sectionOfCurve
public:
void sectionOfCurve( GParametric from, GParametric to, IGCurve2D& section ) const
Returns a section of a loop, in the parametric range specified by from and to after closing the loop.

from
Start parameter of section.
to
End parameter of section.
section
Returned section.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


Setting and Getting the Fill Value

Use the functions in this group to set the rule fill flag and to determine which of two filling rules to use.


[view class]
eOFill
public:
bool eOFill() const
Determines which of the two filling rules is to be used.

Return
True if an even-odd rule is being used and false if a nonzero winding rule is being used.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


[view class]
setEOFill
public:
void setEOFill(bool EOFill)
Sets the even-odd rule fill flag to the specified value.

EOFill
The value to set the flag to. True - even-odd rule; False - nonzero winding rule.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


Streaming the Object In and Out

Use the functions and operators in this group to stream objects in an out using the specified streams.


[view class]
operator <<=
public:
IDataStream& operator <<=(IDataStream&)
Operator that streams the loop object into the given polymorphic stream.

IDataStream
The stream used to stream in the loop object.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


[view class]
operator >>=
public:
IDataStream& operator >>=(IDataStream&) const
Operator that streams the loop object out to the given polymorphic stream.

IDataStream
The stream used to stream out the loop object.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


[view class]
readFromStream
public:
void readFromStream(IDataStream& toWhere)
Streams the loop object in from the polymorphic streaming specified by fromWhere.

fromWhere
The stream used to stream in the loop object.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


[view class]
writeToStream
public:
void writeToStream(IDataStream& toWhere) const
Streams the loop object out to the polymorphic streaming specified by toWhere.

toWhere
The stream used to stream out the loop object.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


IGLoop2D - Inherited Member Functions and Data

Inherited Public Functions

IBaseCurve
IGCurve2D

Inherited Public Data

Inherited Protected Functions

IBaseCurve
IGCurve2D

Inherited Protected Data