Bug in curve interpolation?

Dear forum members,
I tried curve interpolation with and without setting the end derivatives (vector is generated with the first/last point and its neighbor point). The blue curve without derivatives looks fine, in case of derivative prescription a self-intersection happens at the end due to the "high velocity" of the curve. Any ideas what the reasons are and how to handle this?

I used the following code:
SplineFunc::curveInterpolation(TColgp_HSequenceOfPnt * arrayIn)
int i;

TColgp_HArray1OfPnt *array = new TColgp_HArray1OfPnt(1, arrayIn->Length()); // sizing harray

for (i=1; iLength(); i++)
array->SetValue(i , arrayIn->Value(i));

GeomAPI_Interpolate anInterpolation(array, /* Periodicity */Standard_False, /* Precision */ Precision::Approximation());

gp_Vec vecStart(array->Value(1), array->Value(2));
gp_Vec vecEnd(array->Value(arrayIn->Length()-1), array->Value(arrayIn->Length()));

// Start and End derivatives
anInterpolation.Load(vecStart, vecEnd, 1);
return anInterpolation.Curve();

maschimaen's picture

Dear forum members,

is there any possibility to set tangency as well as curvature at the begin and end of an interpolating curve?

I am thinking about two applications:
- Better results with the tangency constraint by a better adjustment of the vector magnitude (the attached figure explains the problem)
- Connecting different curves with C2-continuity - is there any method available in OCC which already provides this functionality?

Thanks for any help!