# Curvature and tangency continous intermediate curve

I am facing the problem to generate a curve in between two existing BSpline-curves, which takes the first AND SECOND derivative as boundary condition. Is there a method in OpenCascade which provides this functionality or any ideas how to deal with this problem?

The situation is shown in the attached figure.

Thank you very much for your help!

Attachments:

I guess a proper name for the needed curve would be "blending curve"?! I was looking around in BRepBlend but could not found the needed method.

Aren't there any suggestions to connect two curves with a third curve with a curvature continuous transition?

try FairCurve_Batten or FairCurve_MinimalVariation

Hi maschimaen,

You can try this method. Firstly, get two end points and two outward tangents from the raw two curves. Then you can use similar API as follows to generate bridge curve:

bool MakeBSplineCurveByTwoPntsTans(const gp_Pnt& p1, const gp_Vec& v1, const gp_Pnt& p2, const gp_Vec&v2, Handle_Geom_BSplineCurve& hBSplineCur)
{
Handle_TColgp_HArray1OfPnt pnts;
Standard_Boolean bPeriod = Standard_False, bScale = Standard_False;
double tol= 1.0e-7;

try
{
pnts = new TColgp_HArray1OfPnt(1,2);
pnts->SetValue(1, p1);
pnts->SetValue(2, p2);

GeomAPI_Interpolate hGI(pnts, bPeriod, tol);
hGI.Load(v1, v2, bScale);
hGI.Perform();
if(!hGI.IsDone())
return false;
hBSplineCur = hGI.Curve();
}
catch(...)
{
return false;
}
return true;
}
If you want to adjust the shape, you only need to adjust the module length of the two tangents.

Ding

Thank you both for your replying!

Cauchy Ding, the curve in my figure was created with my version of the method you have posted! By properly scale the vectors it is indeed a nice looking curve, but I cannot set the 2nd derivatives! Any further ideas?

Haowei, I tried the FairCurve_Batten and was not convinced by the resulting curves. In case of FairCurve_MinimalVariation I couldn't figure out how to get the curve back - could you give me advice for that?

In my opinion, the perfect method for this task would be GeomAPI_Interpolate with the possibility to load the (start and end) curvatures in addition - vector length scaling would give to influence the result as needed. OCC developers, is this worth thinking about ( and implementing :) ) it?

maschimaen

FairCurve_MinimalVariation, derives from FairCurve_Batten. Then to get the curve you can get the
call FairCurve_Batten::Curve()

Cheers,
Mauro