SINTEF-Geometry / SISL

The SINTEF Spline Library
GNU Affero General Public License v3.0
177 stars 60 forks source link

The error of approximating a circle by s1356 #19

Closed luzhengda closed 5 years ago

luzhengda commented 5 years ago

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.

tordokken commented 5 years ago

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 #19https://github.com/SINTEF-Geometry/SISL/issues/19.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHubhttps://github.com/SINTEF-Geometry/SISL/issues/19#event-1994091755, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AEJws8nqEMt9ZLyTu388sUm-IBODEd18ks5uz0NjgaJpZM4Y3FVa.

luzhengda commented 5 years ago

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.

luzhengda commented 5 years ago

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);

tordokken commented 5 years ago

Hi,

It is a long time since I programmed with SISIL so this I cannot help you with. It might be that some of mu colleagues can give an answer.

Tor

From: luzhengda notifications@github.com Sent: tirsdag 25. desember 2018 11.44 To: SINTEF-Geometry/SISL SISL@noreply.github.com Cc: Tor Dokken Tor.Dokken@sintef.no; Comment comment@noreply.github.com Subject: Re: [SINTEF-Geometry/SISL] The error of approximating a circle by s1356 (#19)

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);

— You are receiving this because you commented. Reply to this email directly, view it on GitHubhttps://github.com/SINTEF-Geometry/SISL/issues/19#issuecomment-449838885, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AEJwswX-J8-ME9gsZGNNIjOlfrzFfhYrks5u8gFhgaJpZM4Y3FVa.

VibekeSkytt commented 5 years ago

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