The error of approximating a circle by s1356
Closed this issue · 5 comments
I have some points want to approximate a circle by s1356 .
but when I debug , program crash with the error : Error status : -101 Call from routine : s1912 Position : 0 ,Scene radius must be positive - Ignoring value.
When I approximate a circle with 100 points that x = i , y= i * i , z=0 (i=1,2,3...100), I can get the result.
But if I change the points to x=i/100,y= i * i / 10000,z=0.,the program crash.
My real data is 3D point such as (0.0580612 0.494216 -0.163759) and the distance with next point is less than 0.0001.
I don't know the reason of the error.
Hi, The error situation you have described is strange. s1356 is a much used function that have been stable since the end of the 1980s. The error from s1912 indicates that either the order is zero or the number of points is zero. So there is some problem in the input. So if you stop in the debugger in s1912 just before the check giving err101 and look at the knpt and ik I expect that both are zero. This is possibly due to s1905 after the check has reduce the number of interpolation points. So also check inpt. The reason for the error is inside s1905. When you state that you use data: x=i/100,y= i * i / 10000,z=0., are you sure that you actually provide doubles? Tor From: luzhengda notifications@github.com Sent: torsdag 29. november 2018 03.16 To: SINTEF-Geometry/SISL SISL@noreply.github.com Cc: Subscribed subscribed@noreply.github.com Subject: Re: [SINTEF-Geometry/SISL] The error of approximating a circle by s1356 (#19) Reopened #19<#19>. — You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub<#19 (comment)>, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AEJws8nqEMt9ZLyTu388sUm-IBODEd18ks5uz0NjgaJpZM4Y3FVa.
Dear Tor
Many thanks for your explain. I have already got the reason of this question. My data have some problem. So I am checking my data to solve this error now.
Dear Tor
When I test my data with dynamic array ,s1356 can't work. And it can do well in static array. I find the
parameter of inbpnt should be the size of epoint, else it will have error.
double epoint[15] = { 0.425113 , 0.498064, - 0.0295828, 0.425076, 0.498204, - 0.0317901, 0.424925, 0.498237, - 0.0419417, 0.424908, 0.49827, - 0.0432069, 0.424936, 0.497978, - 0.0544421 }; int inbpnt = 15; int idim = 3; int nptyp[5]; int icnsta = 0; int icnend = 0; int iopen = 1; int ik = 4; double astpar = 0.0; double cendpar = 0.0; SISLCurve *rc = NULL; double *gpar = NULL; int jnbpar = 0; int jstat; s1356(epoint, inbpnt, idim, nptyp, icnsta, icnend, iopen, ik, astpar, &cendpar, &rc, &gpar, &jnbpar, &jstat);
I don't know what you mean about dynamic or static array, but letting inbpnt be equal to the size of epoint is definitely wrong. In your example, the function will read outside the array. inbpnt*idim should be equal to the size of epoint.
Vibeke