Class: TCurve

Declaration: Graphics.h

Taxonomy Categories:

Member Functions:


Interface Category:

API.

Inherits From:

MGraphic

Inherited By:

None.

Purpose:

TCurve provides a wrapper for the TGCurve geometry class, to which it adds the facilities inherited from MGraphic: an attribute bundle, matrix transformations, and hit detection. TCurve has a, not is a, TGCurve. A TGCurve is a Non-Uniform Rational B-Spline (NURB) of arbitrary degree.

Instantiation:

Allocate on the heap or the stack.

Deriving Classes:

None.

Concurrency:

Not multithread safe.

Resource Use:

No special requirements.

Member Function: TCurve::TCurve

  1. TCurve ()
  2. TCurve (const TCurve &)
  3. TCurve (const TGCurve &, TGrafBundle * adoptBundle =NIL)
  4. TCurve (const TGPoint & p0, const TGPoint & p1, const TGPoint & p2, TGrafBundle * adoptBundle =NIL)
  5. TCurve (const TGPoint & p0, const TGPoint & p1, const TGPoint & p2, const TGPoint & p3, TGrafBundle * adoptBundle =NIL)
  6. TCurve (unsigned long order, unsigned long numberPoints, TGrafBundle * adoptBundle =NIL)
  7. TCurve (unsigned long order, unsigned long numberPoints, const TRawArray < GParametric > & knots, TGrafBundle * adoptBundle =NIL)
  8. TCurve (unsigned long order, const TGRPointArray & points, TGrafBundle * adoptBundle =NIL)
  9. TCurve (unsigned long order, const TGRPointArray & points, const TRawArray < GParametric > & knots, TGrafBundle * adoptBundle =NIL)
  10. TCurve (const TGEllipse & e, GDegrees angle1, GDegrees angle2, TGrafBundle * adoptBundle =NIL)
  11. TCurve (const TGLine & line, TGrafBundle * adoptBundle =NIL)
  12. TCurve (const TGPolyline & polyline, TGrafBundle * adoptBundle =NIL)

Interface Category:

API.

Purpose:

  1. Default constructor.
  2. Copy constructor.
  3. Creates a TCurve from the specified TGCurve and TGrafBundle.
  4. Creates a three-point quadratic Bezier TCurve with the specified TGrafBundle.
  5. Creates a simple four-point cubic Bezier TCurve with the specified TGrafBundle.
  6. Creates a general NURB (Non-Uniform Rational B-Spline) of the specified order and with the specified number of control points. All the points are set to the origin (w=1). The knot vector created is kPinned. The specified TGrafBundle is adopted.
  7. Creates a general NURB (Non-Uniform Rational B-Spline) of the specified order, with the specified array of control points, and with the knot vector of the specified array of parametric values. The specified TGrafBundle is adopted.
  8. Creates a general NURB (Non-Uniform Rational B-Spline) with the specified number of control points, all of which are set to the origin (w=1). The specified TGrafBundle is adopted.
  9. Creates a general NURB (Non-Uniform Rational B-Spline) of the specified order, with the specified array of control points, and with the knot vector of the specified array of parametric values. The specified TGrafBundle is adopted.
  10. Creates an elliptical arc inscribed within the specified ellipse, moving clockwise from the first specified angle to the second one. The specified TGrafBundle is adopted.
  11. Creates a TCurve from the specified TGLine with the specified TGrafBundle.
  12. Creates a TCurve from the specified TGPolyline with the specified TGrafBundle.

Calling Context:

  1. Called by the stream-in operators.
  2. Called to copy an object.
  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:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TCurve::~TCurve

virtual ~ TCurve ()

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: TCurve::Draw

virtual void Draw (TGrafPort & port) const

Interface Category:

API.

Purpose:

Draws the graphic to the specific TGrafPort. Attributes in the graphic's bundle override those already provided in the port (if any).

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: TCurve::GetLooseFitBounds

virtual TGRect GetLooseFitBounds (const TGrafPort* =NIL) const

Interface Category:

API.

Purpose:

Gets the entire graphic's bounding rectangle, taking into account the bundle information. (For example, the pen is a bundled attribute that can increase the area of the graphic by adding a border that extends beyond the bounds of the geometry.)

Calling Context:

Called during hit detection. You can also call this function directly.

Parameters:

Return Value:

Returns the bounding rectangle, which is the smallest axis-aligned rectangle that encloses the entire graphic, including any area added by the pen.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TCurve::GetGeometricBounds

virtual TGRect GetGeometricBounds () const

Interface Category:

API.

Purpose:

Gets the bounding rectangle of the geometry, without considering any area added by the bundle. (For example, the pen is a bundled attribute that can increase the area of the graphic by adding a border that extends beyond the bounds of the geometry.)

Calling Context:

Called during hit detection. You can also call this function directly.

Parameters:

Return Value:

Returns the bounding rectangle, which is the smallest axis-aligned rectangle that encloses the geometry.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TCurve::TransformBy

virtual void TransformBy (const TGrafMatrix &)

Interface Category:

API.

Purpose:

Transforms the graphic's shape and position by applying the specified transformation matrix.

Calling Context:

Called by the Graphics system. You can also call this function directly.

Parameters:

Return Value:

None.

Exceptions:

Determined by derived classes.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TCurve::ScaleBy

virtual void ScaleBy (const TGPoint &, const TGPoint & center =TGPoint :: kOrigin)

Interface Category:

API.

Purpose:

Changes the graphic's size according to the specified horizontal and vertical scalars (the coordinates of the first parameter). Because there are two independent scalars, the graphic's shape can change. The second parameter defines the center of scale. Every point is mapped to a new position by applying the scalars to the point's horizontal and vertical displacements from the center of scale. Thus, the scaled graphic does not stay centered at the same point unless the second argument is the old center of the graphic.

Calling Context:

Call this function directly.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

TCurve implements scaling by creating a temporary transformation matrix and calling MGraphic::TransformBy. Derived classes can implement more efficient schemes.

Member Function: TCurve::TranslateBy

virtual void TranslateBy (const TGPoint &)

Interface Category:

API.

Purpose:

Moves the graphic's position by the specified vector.

Calling Context:

Call this function directly.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

TCurve implements scaling by creating a temporary transformation matrix and calling MGraphic::TransformBy. Derived classes can implement more efficient schemes.

Member Function: TCurve::RotateBy

virtual void RotateBy (GDegrees, const TGPoint & center =TGPoint :: kOrigin)

Interface Category:

API.

Purpose:

Rotates the graphic by the given number of degrees, using the specified center of rotation. This does not change the size or shape of the graphic, only its orientation.

Calling Context:

Call this function directly.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

TCurve implements scaling by creating a temporary transformation matrix and calling MGraphic::TransformBy. Derived classes can implement more efficient schemes.

Member Function: TCurve::Concatenate

void Concatenate (const TGCurve & p, bool glue =true)

Interface Category:

API.

Purpose:

Appends the given curve to this curve. The beginning control point of the added curve is joined to the end control point of the original curve, and similarly for their knot vectors. If the beginning point of the added curve is at the same location as the endpoint of the original curve, you have the option of specifying whether there should be only one control point and knot there, or two.

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: TCurve::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:

  1. Returns the point on the curve at the specified parametric value.
  2. Returns the point on the curve at the specified parametric value; also computes the tangent at this point.
  3. Returns the point on the curve at the specified parametric value; also computes the tangent and second derivative at this point.
  4. Returns the point on the curve at the specified parametric value; also computes the tangent, second derivative, and curvature at this point.

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:

Returns the point on the curve that corresponds to the specified parametric value.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TCurve::GetOrder

unsigned long GetOrder () const

Interface Category:

API.

Purpose:

Gets the order of the curve (for example, 4 for cubic curves).

Calling Context:

Call this function directly.

Parameters:

Return Value:

Returns the order of the curve.

Exceptions:

Throws no exceptions, passes all exceptions through. However, an assertion fails in TGCurve if the order has not yet been set.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TCurve::ArcLength

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

Interface Category:

API.

Purpose:

  1. Returns the length along the curve between two specified parameters.
  2. Returns the length along the entire curve, from its beginning point to its endpoint.

Calling Context:

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

Parameters:

Return Value:

Returns the length of the specified portion of the curve.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

The current implementation is likely to have accuracy problems with curves whose order is greater than 5.

Member Function: TCurve::ApproximateParameterFromArcLength

GParametric ApproximateParameterFromArcLength (GCoordinate length, GCoordinate tolerance =1.0e-5) const

Interface Category:

API.

Purpose:

Approximates the parameter of the point at a particular arc length along the curve.

Calling Context:

Call this function directly.

Parameters:

Return Value:

Returns the approximate parametric value of the point.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TCurve::IsEmpty

bool IsEmpty () const

Interface Category:

API.

Purpose:

Determines whether the curve geometry is empty (which it is when the TCurve is created with the default constructor).

Calling Context:

Call this function directly.

Parameters:

Return Value:

Returns true if the order of the curve is zero.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TCurve::GetNumberOfPoints

unsigned long GetNumberOfPoints () const

Interface Category:

API.

Purpose:

Gets the number of control points in the curve.

Calling Context:

Call this function directly.

Parameters:

Return Value:

Returns the number of control points.

Exceptions:

Throws no exceptions, passes all exceptions through. However, an assertion in TGCurve fails if the curve is uninitialized.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TCurve::GetPoint

TGRPoint GetPoint (unsigned long i) const

Interface Category:

API.

Purpose:

Gets a specific control point.

Calling Context:

Call this function directly.

Parameters:

Return Value:

Returns the control point.

Exceptions:

Throws no exceptions, passes all exceptions through. However, an assertion fails in TGCurve if the curve is uninitialized.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TCurve::GetPoints

void GetPoints (TGRPointArray & pts) const

Interface Category:

API.

Purpose:

Returns, in its argument, the complete array of control points.

Calling Context:

Call this function directly.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through. However, an assertion in TGCurve fails if the curve is uninitialized.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TCurve::GetControlPolyline

void GetControlPolyline (TGPolyline &) const

Interface Category:

API.

Purpose:

Returns, in its argument, the set of control points as a polyline.

Calling Context:

Call this function directly.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through. However, an assertion fails in TGCurve if the curve is uninitialized.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TCurve::GetMinParameter

GParametric GetMinParameter () const

Interface Category:

API.

Purpose:

Gets the parametric value that has been associated with the curve's beginning point. (This is not necessarily zero; it can be any value.)

Calling Context:

Call this function directly.

Parameters:

Return Value:

Returns the minimum parametric value of the curve.

Exceptions:

Throws no exceptions, passes all exceptions through. However, an assertion fails in TGCurve if the curve is uninitialized.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TCurve::GetMaxParameter

GParametric GetMaxParameter () const

Interface Category:

API.

Purpose:

Returns the parametric value that has been associated with the curve's endpoint.

Calling Context:

Call this function directly.

Parameters:

Return Value:

Returns the maximum parametric value of the curve.

Exceptions:

Throws no exceptions, passes all exceptions through. However, an assertion fails in TGCurve if the curve is uninitialized.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TCurve::GetNumberOfKnots

unsigned long GetNumberOfKnots () const

Interface Category:

API.

Purpose:

Gets the number of knots in the knot vector. This is equal to the number of control points, plus the order of the curve.

Calling Context:

Call this function directly.

Parameters:

Return Value:

Returns the maximum parametric value of the curve.

Exceptions:

Throws no exceptions, passes all exceptions through. However, an assertion fails in TGCurve if the curve is uninitialized.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TCurve::IsPinned

bool IsPinned () const

Interface Category:

API.

Purpose:

Returns true if the knot vector is pinned, meaning that the first and last control points are on the curve.

Calling Context:

Call this function directly.

Parameters:

Return Value:

Returns true if the knot vector is pinned.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TCurve::IsBezier

bool IsBezier () const

Interface Category:

API.

Purpose:

Returns true if the curve represents a piecewise Bezier curve.

Calling Context:

Call this function directly.

Parameters:

Return Value:

Returns true if the knot vector defines a piecewise Bezier curve.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TCurve::GetNextDiscontinuity

unsigned long GetNextDiscontinuity (unsigned long startIndex, unsigned long discontinuity =0) const

Interface Category:

API.

Purpose:

Returns the knot vector index of the next discontinuity following the specified knot. The default is the next C0 discontinuity (a break in the curve), but you can specify discontinuities of a higher order. GetNextDiscontinuity returns the index of the first knot in a sequence of identical knots. (The order of the discontinuity determines how many identical knots are required.) Call GetKnot on the returned value to find the parameter of the curve at the discontinuity. Note that for a C0 break in the curve, the value returned by GetKnot(GetNextDiscontinuity()) is the start of the section of the curve after the break. Subtracting any amount from that parameter jumps to the section before the break. To find the control point associated with a C1 discontinuity, subtract 1 from the value returned by GetNextDiscontinuity. For a C0 discontinuity, GetNextDiscontinuity()-1 is the point before the break, and the following point is after the break. To skip from one discontinuity to the next, you can pass the value returned from the last call as the startIndex parameter.

Calling Context:

Call this function directly.

Parameters:

Return Value:

Returns the index (into the knot vector) of the next discontinuity. If no more discontinuities are found, the return value is the index of the last knot (in other words, GetNumberOfKnots()-1).

Exceptions:

Throws no exceptions, passes all exceptions through. However, an assertion fails in TGCurve if the curve is uninitialized or the second parameter's value is greater than the order of the curve.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TCurve::GetKnot

GParametric GetKnot (unsigned long i) const

Interface Category:

API.

Purpose:

Gets the parametric value corresponding to the specified knot.

Calling Context:

Call this function directly.

Parameters:

Return Value:

Returns the parametric value corresponding to the specified knot.

Exceptions:

Throws no exceptions, passes all exceptions through. However, an assertion fails in TGCurve if the curve is uninitialized.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TCurve::GetKnots

void GetKnots (TRawArray < GParametric > & knots) const

Interface Category:

API.

Purpose:

Returns, by reference in its parameter, the knot vector.

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: TCurve::NearestParametric

GParametric NearestParametric (const TGPoint & test) const

Interface Category:

API.

Purpose:

Gets the parametric value of the point on the curve that is nearest to the specified point.

Calling Context:

Call this function directly.

Parameters:

Return Value:

Returns the parametric value closest to the specified point.

Exceptions:

Throws no exceptions in TCurve. The order must be initialized or an initialized assert fails in TGCurve.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TCurve::GetSectionOfCurve

void GetSectionOfCurve (GParametric from, GParametric to, TGCurve & section) const

Interface Category:

API.

Purpose:

Returns the section of the curve between the two specified parametric values.

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: TCurve::DragPosition

void DragPosition (GParametric u, const TGPoint & toPoint, GParametric segmentMinimum =0.2, GParametric segmentMaximum =0.8)

Interface Category:

API.

Purpose:

Changes the curve shape so that at the specified parameter, it passes through the given point. Parts of the curve that lie outside the parametric range from segmentMinimum to segmentMaximum are not affected.

Calling Context:

Call this function directly.

Parameters:

Return Value:

None.

Exceptions:

An initialized assertion occurs in TGCurve if the order is uninitialized.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TCurve::DragTangent

void DragTangent (GParametric u, const TGPoint & toTangent, GParametric segmentMinimum =0.2, GParametric segmentMaximum =0.8)

Interface Category:

API.

Purpose:

Changes the curve shape so that at the specified parameter, the curve has the specified tangent. This function can simulate the rocker arm curve adjuster used in a well-known illustration application, with the added advantage that the adjustment can be made anywhere along the curve.

Calling Context:

Call this function directly.

Parameters:

Return Value:

None.

Exceptions:

In TGCurve, an initialized assertion occurs if the order is uninitialized, and a parameter assertion occurs if the order is less than 2.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TCurve::ReverseDirection

void ReverseDirection ()

Interface Category:

API.

Purpose:

Flips the orientation of the curve's parameterization, by reversing the numbering of the control points and the intervals in the knot vector. In other words, the minimum parameter becomes the maximum parameter and vice versa.

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: TCurve::SetOrder

void SetOrder (unsigned long order)

Interface Category:

API.

Purpose:

Sets the order of the curve (for example, 4 for cubic curves). This changes the shape, but leaves the number of points intact.

Calling Context:

Call this function directly.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through. The order must be initialized to be between 2 and the number of points, inclusive, or an assertion occurs in TGCurve.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TCurve::RaiseOrder

void RaiseOrder (unsigned long newOrder)

Interface Category:

API.

Purpose:

Raises the degree of the curve to the specified order. This does not change the shape, but increases the number of control points and knots.

Calling Context:

Call this function directly.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

This procedure generates spurious control points for splines that do not have closed end conditions (k-fold knots at each end).

Member Function: TCurve::ApproximateLowerOrder

void ApproximateLowerOrder (unsigned long newOrder, GCoordinate tolerance =0.2)

Interface Category:

API.

Purpose:

Approximates the curve with a lower-order one. Control points are added to the lower-order curve until the approximation falls within the specified tolerance. The curve in question is first made a Bezier curve.

Calling Context:

Call this function directly. It is also called by TModelDeformer::Deform.

Parameters:

Return Value:

None.

Exceptions:

A parameter assertion in TGCurve ensures that newOrder is within range.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TCurve::SetPoint

void SetPoint (unsigned long i, const TGRPoint & p)

Interface Category:

API.

Purpose:

Replaces control point number i with the specified point.

Calling Context:

Call this function directly.

Parameters:

Return Value:

None.

Exceptions:

An initialized assertion in TGCurve checks whether the curve's order is initialized.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TCurve::SetPoints

void SetPoints (const TGRPointArray & controlPoints)

Interface Category:

API.

Purpose:

Replaces the control points with the specified ones. If the passed-in array does not have the same number of points as the existing curve, the knot vector is reset. Also, if the new number of points is less than the existing order of the curve, the order is lowered to the new number of points.

Calling Context:

Call this function directly.

Parameters:

Return Value:

None.

Exceptions:

An initialized assertion in TGCurve fails if there are fewer than two control points in the passed-in array.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TCurve::SetKnotScheme

void SetKnotScheme (TGCurve :: EndConditions theType =TGCurve :: kPinned)

Interface Category:

API.

Purpose:

Set the knot vector to one of three standard schemes (pinned, floating, or Bezier), without doing any refinement. This function usually changes the shape of the curve.

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: TCurve::SetKnots

void SetKnots (const TRawArray < GParametric > & knots)

Interface Category:

API.

Purpose:

Resets the knot vector to the specified array. The data is copied into the curve, and must have the same number of knots as the curve's existing knot vector. No refinement or consistency checking is performed on this knot vector.

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: TCurve::MoveKnot

void MoveKnot (unsigned long index, GParametric u)

Interface Category:

API.

Purpose:

Moves the specified knot to the point that has the specified parametric value. If u < knot[index -1] or u >knot[index + 1], the knot vector is sorted to accommodate the new value. This changes the shape of the curve.

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: TCurve::InsertKnot

void InsertKnot (GParametric u)

Interface Category:

API.

Purpose:

Inserts a single new knot (and the corresponding control point) at the specified parametric location.

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: TCurve::RefineUniform

void RefineUniform ()

Interface Category:

API.

Purpose:

Adds a new knot at the midpoint of each nonzero interval in the knot vector. No knots are inserted between the first n or the last n knots in the vector, where n is the order of the curve. This function does not change the shape of the curve, nor does it change the multiplicity of the knots.

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: TCurve::RefineToBeziers

void RefineToBeziers ()

Interface Category:

API.

Purpose:

Inserts additional knots so that all interior knots have a multiplicity equal to the order, minus 1. ( Interior knots exclude the first n and the last n knots in the vector, where n is the order of the curve). This function turns the curve into a piecewise Bezier curve, but does not change shape of the curve.

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: TCurve::Refine

void Refine (const TRawArray < GParametric > & knots)

Interface Category:

API.

Purpose:

Insert the given knots into the curve, adding new control points without modifying the curve's shape. This increases the flexibility of a curve.

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: TCurve::RefineToPinned

void RefineToPinned ()

Interface Category:

API.

Purpose:

Adds knots to the beginning and end of the knot vector so that the control polygon is pinned to the ends of the curve (in other words, so that the curve intersects the first and last control points). This function is only applicable to curves with floating end conditions. The shape of the curve is not changed.

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: TCurve::IsConsistent

bool IsConsistent ()

Interface Category:

API.

Purpose:

Checks the curve for invalid knot vectors, nonpositive values of w, excessive values for the order of the curve, and too many or too few control points. If any offending condition is encountered, an error message is printed and the function returns false. Duplicate successive points cause a warning to be printed, but do not cause the function to return false.

Calling Context:

Call this function directly.

Parameters:

Return Value:

Returns true if no offending condition is found.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TCurve::operator=

TCurve & operator =(const TCurve & source)

Interface Category:

API.

Purpose:

Assignment operator.

Calling Context:

Called when an object is assigned to another compatible object.

Parameters:

Return Value:

Returns a 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: TCurve::operator==

bool operator ==(const TCurve & source) const

Interface Category:

API.

Purpose:

Tests two TCurves for equality, by seeing whether the geometries are equal and the bundles are equal.

Calling Context:

Call this function by using the operator in an expression.

Parameters:

Return Value:

Returns true if this TCurve and the argument have equal geometries and bundles.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TCurve::operator!=

bool operator != (const TCurve & source) const

Interface Category:

API.

Purpose:

Tests two TCurves for inequality, by seeing whether their geometries and bundles are different.

Calling Context:

Call this function by using the operator in an expression.

Parameters:

Return Value:

Returns true if the geometries or bundles of this TCurve and the argument are not equal. or bundles.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TCurve::operator>>=

virtual 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: TCurve::operator<<=

virtual 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: TCurve::Validate

void Validate ()

Interface Category:

API.

Purpose:

Makes sure that the graphic's bounds are up-to-date.

Calling Context:

Called by the Graphics system before returning bounds to the user. You should not need to call it directly.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

Derived classes should override this function if their bounds behave differently from the base class.
Click the icon to mail questions or corrections about this material to Taligent personnel.
Copyright©1995 Taligent,Inc. All rights reserved.