why does the bspline passing through 3 poins with tangency requested look like this?

I interpolate a BsplineCurve passing through 3 points with tangency requested,but the bspline is not what I expected as in AutoCAD(I attach a picture of it), the code is as below:

Handle(TColgp_HArray1OfPnt2d) harray =
new TColgp_HArray1OfPnt2d (1,3); // sizing harray
harray->SetValue(1,gp_Pnt2d (0,0));
harray->SetValue(2,gp_Pnt2d (3,3));
harray->SetValue(3,gp_Pnt2d (6,0));

Geom2dAPI_Interpolate anInterpolation(harray,Standard_False,0.01);

gp_Vec2d initial_tangent(1.0,0.0), final_tangent(1.0,0.0);
anInterpolation.Load(initial_tangent, final_tangent);


Alexander Schneller's picture

Hi Tom,

I think the vectors have an unfavorable direction.

Try gp_Vec2d initial_tangent(-1.0,0.0), final_tangent(-1.0,0.0);

The result is that the control points of the bspline not lie in the middle (see the red line).