Wed, 10/12/2016 - 10:43
Hi All,
I'm new with Open Cascade and I am trying to use the GeomAPI_Interpolate class to get an interpolating spline from an array of points.
Unfortunately Standard_OutOfRange Error is always raising after .Perform() method. After trying with my own array of points, I also tried the following simple example to see if the problem were my points' values, but still the same problem occurs.
Can someone please help?
Thank you in advance!
Giuli
-------------------------------
Standard_Integer n = 4;
Handle(TColgp_HArray1OfPnt) myArr = new TColgp_HArray1OfPnt(0, n - 1);
myArr->SetValue(0, gp_Pnt(0, 0, 0));
myArr->SetValue(1, gp_Pnt(10, 0, 0));
myArr->SetValue(2, gp_Pnt(10, 10, 0));
myArr->SetValue(3, gp_Pnt(20, 20, 0));
Standard_Real tol = 1.0e-7;
GeomAPI_Interpolate intp(myArr, Standard_False, tol);
intp.Perform();
Handle(Geom_BSplineCurve) myCurve = intp.Curve();
Wed, 10/12/2016 - 11:51
Hi Giuli, I have successfully done that a while back but I don't have the source code in front of me right now. I will check and post it for you later on today if someone else hasn't already helped you by then.
Regards
Lincoln
Wed, 10/12/2016 - 12:02
Hi Giuli,
please change
Handle(TColgp_HArray1OfPnt) myArr = new TColgp_HArray1OfPnt(0, n - 1);
to
Handle(TColgp_HArray1OfPnt) myArr = new TColgp_HArray1OfPnt(1, n);
It seems that there is no handling of arrays starting from 0. Attached image contains resulting curve.
regards,
qa
Wed, 10/12/2016 - 12:16
That was it! Thanks a lot for the quick reply and help!
Giuli