Class: TGCurve

Declaration: Curve.h

Taxonomy Categories:

Member Functions:


Interface Category:

API.

Inherits From:

TBaseCurve

Inherited By:

TGLoop TGArcThrough3Points TGCardinalSpline TGConicEndCenterEnd TGHermiteSpline TGTensionSpline

Purpose:

TGCurve is a general 2-D curve primitive that can implement free-form curves, arcs, and path geometry containing discontinuities (breaks or kinks in the smoothness of the curve). TGCurves can represent the geometry of all other 2-D primitives (lines, polygons, ellipses, and so on); the TGCurve class provides constructors that accept these other types. A TGCurve can be used to collect other 2-D geometries into a single path object. A TGCurve is implemented with a Non-Uniform Rational B-Spline (NURB) of arbitrary degree. NURBs are a generalization of Bezier curves; they allow an arbitrary number of control points, exact representation of conic sections, full control over continuity, and arbitrary order. NURBs are based on control points, the order of the curve, and a knot vector. Control points guide the shape of the geometry by specifying the location of the points of the curve. The curve's order defines the minimum number of control points that define the curve. A knot vector is a sequence of parameter values for determining the continuity along a curve's length. A knot is where two curve segments join to form a spline. It is represented by a parametric value.

Instantiation:

Allocate on the heap or the stack.

Deriving Classes:

Do not derive from this class. Provided classes include TGConicEndCenterEnd, TGArcThrough3Points, TGCardinalSpline, TGHermiteSpline, TGTensionSpline, and TGLoop.

Concurrency:

Not multithread safe.

Resource Use:

No special requirements.

Member Function: TGCurve::TGCurve

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

Interface Category:

API.

Purpose:

  1. Default constructor. Creates an empty Curve. The only operators allowed on empty curves are assignment and stream in.
  2. Constructor for a three-point quadratic Bezier curve.
  3. Constructor for a simple four-point cubic Bezier curve.
  4. Constructor for a general NURB (Non-Uniform Rational B-Spline) of the specified order, with the specified number of control points. The number of control points is set to the specified number. All the points are set to the origin (w=1). The knot vector created is kPinned.
  5. Constructor for a general NURB (Non-Uniform Rational B-Spline) of the specified order, with the specified number of control points and the knot vector defined by the specified array of parametric values. All the control points are set to the origin (w=1).
  6. Constructor for a general NURB (Non-Uniform Rational B-Spline) with the control polygon set to the second argument.
  7. Constructor for a general NURB (Non-Uniform Rational B-Spline) of the specified order, with the specified array of control points and the knot vector defined by the specified array of parametric values.
  8. Copy constructor.
  9. Constructor for an elliptical arc inscribed within the specified ellipse, moving clockwise from the first specified angle to the second one.
  10. Constructor for a curve from the specified TGLine.
  11. Constructor for a curve from the specified TGPolyline.

Calling Context:

  1. Called by the stream-in operators. You can also call this function directly.
  2. 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. Called to copy an object. You can also call this function directly.
  9. Call this function directly.
  10. Call this function directly.
  11. Call this function directly.

Parameters:

Return Value:

None.

Exceptions:

A parameter assertion fails if the order is less than 2.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TGCurve::~TGCurve

virtual ~ TGCurve ()

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: TGCurve::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 TGCurve at the specified parametric value.
  2. Returns the point on the TGCurve at the specified parametric value; also computes the tangent at this point.
  3. Returns the point on the TGCurve at the specified parametric value; also computes the tangent and second derivative at this point.
  4. Returns the point on the TGCurve 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:

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: TGCurve::EvaluateW

TGRPoint EvaluateW (GParametric u) const

Interface Category:

API.

Purpose:

Returns the point (as a TGRPoint) on the TGCurve at the specified parametric value.

Calling Context:

Call this function directly.

Parameters:

Return Value:

The TGRPoint on the curve at the parametric location.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TGCurve::GetControlPolyline

void GetControlPolyline (TGPolyline & polyline) 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:

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

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TGCurve::GetBounds

TGRect GetBounds () const

Interface Category:

API.

Purpose:

Returns the rectangle that bounds the TGCurve's control points. The curve is always contained within its control points.

Calling Context:

Call this function directly.

Parameters:

Return Value:

The rectangle that bounds the curve.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TGCurve::Intersects

bool Intersects (const TGRect & g) const

Interface Category:

API.

Purpose:

Determines whether the TGCurve intersects the specified rectangle.

Calling Context:

Call this function directly.

Parameters:

Return Value:

Returns true if the curve intersects the rectangle.

Exceptions:

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

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TGCurve::TransformBy

void TransformBy (const TGrafMatrix & mat)

Interface Category:

API.

Purpose:

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

Calling Context:

Call this function directly.

Parameters:

Return Value:

None.

Exceptions:

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

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TGCurve::MakeCompatible

  1. static void MakeCompatible (TGCurve & curve1, TGCurve & curve2)
  2. static void MakeCompatible (TCurveList & curveList)

Interface Category:

API.

Purpose:

  1. 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.
  2. Modifies all the curves in the TGCurveList 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:

  1. Call this function directly.
  2. 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: TGCurve::MakeArc

void MakeArc (unsigned long numPoints, TGRPointArray & pts)

Interface Category:

API.

Purpose:

Makes this TGCurve into a quadratic curve (that is, the order will be 3) by setting the number of points to the specified number and using the points in the specified array.

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.
Click the icon to mail questions or corrections about this material to Taligent personnel.
Copyright©1995 Taligent,Inc. All rights reserved.