Merging bspline curves

To merge joined bspline curves, you can use following methods:

void GeomConvert::ConcatG1

TColGeom_Array1OfBSplineCurve& ArrayOfCurves,

const TColStd_Array1OfReal& ArrayOfToler,

Handle(TColGeom_HArray1OfBSplineCurve) & ArrayOfConcatenated,

 const Standard_Boolean ClosedG1Flag,

 const Standard_Real ClosedTolerance)

This method concatenates according to G1 (tangency continuity along the curve) the ArrayOfCurves as far as possible:

ArrayOfCurves must have dimension bounds [0, N-1], N - number of curves to be merged.

ArrayOfToler contains the biggest tolerance of the two points shared by two consecutives curves. Its dimension is: [0, N-2].

ArrayOfConcatenated contains results of operation: one or more, when impossible to merge all curves from ArrayOfCurves into one, new bspline curves are created.

ClosedG1Flag indicates if the ArrayOfCurves is closed or not.

If ClosedG1Flag = Standard_True, ClosedTolerance contains the biggest tolerance of the two points which are at the closure, otherwise its value is 0.0.

 void GeomConvert::ConcatC1

TColGeom_Array1OfBSplineCurve& ArrayOfCurves,

const TColStd_Array1OfReal& ArrayOfToler,

Handle(TColStd_HArray1OfInteger)& ArrayOfIndices,

Handle(TColGeom_HArray1OfBSplineCurve)& ArrayOfConcatenated,

const Standard_Boolean ClosedG1Flag,

const Standard_Real ClosedTolerance,

const Standard_Real AngularTolerance)

This method concatenates according to C1 (first derivative continuity along the curve) the ArrayOfCurves as far possible:

ArrayOfCurves must have dimension bounds [0, N-1], N - number of curves to be merged.

ArrayOfToler contains the biggest tolerance of the two points shared by two consecutives curves. Its dimension: [0,N-2].

ArrayOfConcatenated contains results of operation: one or more, when impossible to merge all curves from ArrayOfCurves in one, new bspline curves.

ArrayOfIndices contains indices that define curves from ArrayOfCurves which are beginning curves for each group of curves merged into a new curve.

ClosedG1Flag indicates if the ArrayOfCurves is closed or not.

If ClosedG1Flag = Standard_True, ClosedTolerance contains the biggest tolerance of the two points which are at the closure, otherwise its value is 0.0.

AngularTolerance is used to check the continuity of tangencies.

 

void GeomConvert::ConcatC1

TColGeom_Array1OfBSplineCurve& ArrayOfCurves,

const TColStd_Array1OfReal& ArrayOfToler,

Handle(TColStd_HArray1OfInteger)& ArrayOfIndices,

Handle(TColGeom_HArray1OfBSplineCurve)& ArrayOfConcatenated,

const Standard_Boolean ClosedG1Flag,

const Standard_Real ClosedTolerance)

The same as previously, except that AngularTolerance = Precision::Angular();

It is also possible to use class GeomConvert_CompCurveToBSplineCurve.

This class provides methods to concatenate several restricted curves to a bspline curve. Non-bspline curves are converted to bspline before concatenation.

Constructor:

GeomConvert_CompCurveToBSplineCurve::

GeomConvert_CompCurveToBSplineCurve(const Handle(Geom_BoundedCurve)& BasisCurve,

 const Convert_ParameterisationType Parameterization)

BasisCurve - beginning curve;

Parameterization defines the ways of conversion in bspline (by default Convert_TgtThetaOver2).

The method to add a new curve is:

   Standard_Boolean GeomConvert_CompCurveToBSplineCurve::

  Add(const Handle(Geom_BoundedCurve)& NewCurve,

  const Standard_Real Tolerance,

  const Standard_Boolean After,

  const Standard_Boolean WithRatio,

  const Standard_Integer MinM)

Appends a curve in the BSpline.

Returns False if the curve is not C0 with the BSplineCurve.

Tolerance is used to check the continuity and decrease the Multiplicity at the common Knot until MinM. If MinM = 0, the common Knot can be removed.

The parameter after defines the place for a new curve when it is possible to put the new curve before or after the BasisCurve (in fact, it is case when concatenated curve can be closed).

It does not change the shape of the curve, but defines its first and last points.

If WithRatio = Standard_True the algorithm tries to reach C1 continuity.

The method to get a result is:

Handle(Geom_BSplineCurve) GeomConvert_CompCurveToBSplineCurve::BSplineCurve() const