Rhino C++ API  9.0
Public Member Functions | List of all members
ON_TemplatedCurveRebuilder Class Reference

ON_TemplatedCurveRebuilder rebuilds a curve (the "source" curve) so that it takes on the degree, knot vector, and control point count of a "template" NURBS curve. More...

#include <opennurbs_plus_rebuild.h>

Public Member Functions

 ON_TemplatedCurveRebuilder ()=default
 
 ON_TemplatedCurveRebuilder (const ON_TemplatedCurveRebuilder &)=default
 
 ~ON_TemplatedCurveRebuilder ()=default
 
bool IsSet () const
 
ON_TemplatedCurveRebuilderoperator= (const ON_TemplatedCurveRebuilder &)=default
 
bool RebuildCurve (const ON_Curve &source_curve, bool bFlipSourceDirection, bool bPreserveEndTangents, bool bMakeSubDFriendly, ON_NurbsCurve &destination) const
 Rebuild one source curve so it matches the template curve's degree, knot vector, and control point count. More...
 
bool SetTemplateCurve (const ON_Curve &template_curve)
 Analyze the template curve. Computes and stores the template's NURBS form (clamped for open/simple-closed templates), its Greville abscissae, its closed/periodic state, and the control point range to interpolate. More...
 
const ON_NurbsCurveTemplateCurve () const
 

Detailed Description

ON_TemplatedCurveRebuilder rebuilds a curve (the "source" curve) so that it takes on the degree, knot vector, and control point count of a "template" NURBS curve.

The template curve is analyzed once with SetTemplateCurve(); the rebuilder can then be applied to many source curves with RebuildCurve().

Constructor & Destructor Documentation

◆ ON_TemplatedCurveRebuilder() [1/2]

ON_TemplatedCurveRebuilder::ON_TemplatedCurveRebuilder ( )
default

◆ ~ON_TemplatedCurveRebuilder()

ON_TemplatedCurveRebuilder::~ON_TemplatedCurveRebuilder ( )
default

◆ ON_TemplatedCurveRebuilder() [2/2]

ON_TemplatedCurveRebuilder::ON_TemplatedCurveRebuilder ( const ON_TemplatedCurveRebuilder )
default

Member Function Documentation

◆ IsSet()

bool ON_TemplatedCurveRebuilder::IsSet ( ) const
Returns
True if SetTemplateCurve() has succeeded and the rebuilder is ready to use.

◆ operator=()

ON_TemplatedCurveRebuilder& ON_TemplatedCurveRebuilder::operator= ( const ON_TemplatedCurveRebuilder )
default

◆ RebuildCurve()

bool ON_TemplatedCurveRebuilder::RebuildCurve ( const ON_Curve source_curve,
bool  bFlipSourceDirection,
bool  bPreserveEndTangents,
bool  bMakeSubDFriendly,
ON_NurbsCurve destination 
) const

Rebuild one source curve so it matches the template curve's degree, knot vector, and control point count.

Parameters
source_curveThe curve to rebuild.
bFlipSourceDirectionIf true and the source curve is open, its direction is flipped (reversed) before sampling. Set this when the source runs opposite the template.
bPreserveEndTangentsIf true and the rebuilt curve is open with at least 4 control points, the interior end control points are adjusted so the rebuilt curve's end tangents match the source's.
bMakeSubDFriendlyIf true, the rebuilt curve is converted to a SubD friendly curve.
destinationThe rebuilt curve is returned here.
Returns
True if a valid curve was created.

◆ SetTemplateCurve()

bool ON_TemplatedCurveRebuilder::SetTemplateCurve ( const ON_Curve template_curve)

Analyze the template curve. Computes and stores the template's NURBS form (clamped for open/simple-closed templates), its Greville abscissae, its closed/periodic state, and the control point range to interpolate.

Parameters
template_curveThe curve whose degree, knots, and control point count the rebuilt source curves will match.
Returns
True if the template curve is usable. If false is returned, the rebuilder is left unset.

◆ TemplateCurve()

const ON_NurbsCurve& ON_TemplatedCurveRebuilder::TemplateCurve ( ) const
Returns
The template curve's stored NURBS form, or an empty curve when the rebuilder is not set.