
Sat, 12/17/2011 - 06:01
Forums:
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);
anInterpolation.Perform();
Attachments:
Fri, 01/20/2012 - 13:01
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).
Regards
Alex