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.
- TGCurve ()
- TGCurve (const TGPoint & p0, const TGPoint & p1, const TGPoint & p2)
- TGCurve (const TGPoint & p0, const TGPoint & p1, const TGPoint & p2, const TGPoint & p3)
- TGCurve (unsigned long order, unsigned long numberPoints)
- TGCurve (unsigned long order, unsigned long numberPoints, const TRawArray < GParametric > & knots)
- TGCurve (unsigned long order, const TGRPointArray & points)
- TGCurve (unsigned long order, const TGRPointArray & points, const TRawArray < GParametric > & knots)
- TGCurve (const TGCurve & curve)
- TGCurve (const TGEllipse & e, GDegrees angle1, GDegrees angle2)
- TGCurve (const TGLine & line)
- TGCurve (const TGPolyline & polyline)
Interface Category:
API.
Purpose:
- Default constructor. Creates an empty Curve. The only operators allowed on empty curves are assignment and stream in.
- Constructor for a three-point quadratic Bezier curve.
- Constructor for a simple four-point cubic Bezier curve.
- 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.
- 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).
- Constructor for a general NURB (Non-Uniform Rational B-Spline) with the control polygon set to the second argument.
- 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.
- Copy constructor.
- Constructor for an elliptical arc inscribed within the specified ellipse, moving clockwise from the first specified angle to the second one.
- Constructor for a curve from the specified TGLine.
- Constructor for a curve from the specified TGPolyline.
Calling Context:
- Called by the stream-in operators. 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.
- Called to copy an object. You can also call this function directly.
- Call this function directly.
- Call this function directly.
- Call this function directly.
Parameters:
- Takes no parameters.
- const TGPoint & p0 -The first control point.
- const TGPoint & p1 -The second control point.
- const TGPoint & p2 -The third control point.
- const TGPoint & p0 -The first control point.
- const TGPoint & p1 -The second control point.
- const TGPoint & p2 -The third control point.
- const TGPoint & p3 -The fourth control point.
- unsigned long order -The order of the new curve.
- unsigned long numberPoints -The number of control points.
- unsigned long order -The order of the new curve.
- unsigned long numberPoints -The number of control points.
- const TRawArray < GParametric > & knots -The knot vector.
- unsigned long order -The order of the new curve.
- const TGRPointArray & points -The control points.
- unsigned long order -The order of the new curve.
- const TGRPointArray & points -The control points.
- const TRawArray < GParametric > & knots -The knot vector.
- const TGCurve & curve -The curve to be copied.
- const TGEllipse & e -The ellipse that the arc is to be inscribed within.
- GDegrees angle1 -The first angle.
- GDegrees angle2 -The second angle.
- const TGLine & line -The line to be converted into a curve.
- const TGPolyline & polyline -The polyline to be converted into a curve.
Return Value:
None.
Exceptions:
A parameter assertion fails if the order is less than 2.
Concurrency:
Not multithread safe.
Other Considerations:
None.
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
- 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:
- Returns the point on the TGCurve at the specified parametric value.
- Returns the point on the TGCurve at the specified parametric value; also computes the tangent at this point.
- Returns the point on the TGCurve at the specified parametric value; also computes the tangent and second derivative at this point.
- Returns the point on the TGCurve at the specified parametric value; also computes the tangent, second derivative, and curvature at this point.
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 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 curve at this point; computed by this function.
- GCoordinate & curvature -The curvature at this point; computed by this function.
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:
- 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.
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:
- TGPolyline & polyline -The curve's control points, returned by reference.
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:
- const TGRect & g -The rectangle.
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:
- const TGrafMatrix & mat -The transformation matrix by which the curve's points are multiplied.
Return Value:
None.
Exceptions:
An assertion fails if the curve is empty (uninitialized).
Concurrency:
Not multithread safe.
Other Considerations:
None.
Member Function: TGCurve::MakeCompatible
- static void MakeCompatible (TGCurve & curve1, TGCurve & curve2)
- static void MakeCompatible (TCurveList & curveList)
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.
- 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:
- Call this function directly.
- Call this function directly.
Parameters:
- TGCurve & curve1 -The first curve to be made compatible.
- TGCurve & curve2 -The second curve to be made compatible.
- TCurveList & curveList -The list of curves to be made compatible.
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:
- unsigned long numPoints -The number of control points.
- TGRPointArray & pts -The array of control points.
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.