-
Notifications
You must be signed in to change notification settings - Fork 233
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Deconstructed Curve Segment is half clamped #4469
Comments
@portnov can you take a look at this problem? Thanks |
Ok, will try to look at it this week. |
Checked #4633 and i works OK (for freecad implementation)! ...now using #4633 I also got the strange behavior that I was to report about Native implementation only. It's strange to see it in geomdl also. If you activate Normalize Knots in "Build NURBS Curve" node you'll see the whole curve is built OK (symmetrically) even outside its domain for both geomdl and Native: But when trying to take a segment... this odd behavior became present and even pretty bizarre with Native implementation (if we try to get an arbitrary segment): But being strict to the reported problematic setup (for trying to get smoothly closed curve) the oddity is only present at the upper domain limit (in this case "T Max" = 1.0) |
Hmm. I investigated the problem for a bit, and currently it seems to me that Sverchok implementation is more correct than Geomdl and FreeCAD :) Maybe I'm wrong. The thing is, Sverchok calculates NURBS directly by definition, as But, at least Geomdl (did not check about FreeCAD) calculates Nurbs not by definition, but by algorithm A3.1 from [1], and a "reverse triangular scheme" from there. And according to that reverse triangular scheme, non-zero coefficients would be Why such a contradiction in the same book? As far as I understood, algorithm A3.1 was designed for the special case of clamped knotvectors (ones which starts and ends with a knot with multiplicity = p+1). The book [1], after all, in many cases speaks only about curves with clamped knotvectors. I.e., as far as I understand it, Geomdl is doing not such a good thing, by applying an algorithm, which was designed for clamped knotvectors, to a non-clamped one. It may appear that for curves with non-clamped knotvectors I should look into another book; I'd be glad if you could point me into which one :) [1]: The NURBS Book, 2nd ed |
Unfortunately the whole theory is a black box for me :( |
The issue is not in 1.0 by itself, it's about 1) knotvector not being clamped and 2) T within range of first or last I tried to check with implementation from rhino3dm, it seems to work more like Geomdl or FreeCAD than like Sverchok, but that implementation has it's own peculiarities... |
@portnov I tested lots of setups I had. The changes in freecad.py solved the problem with end clamping of freecad curves but the new code in algorithms.py messed the things for me. I guess I was taking advantage of something that was not predicted by design but it worked for me kind of nicely. I guess I can revert the changes in algorithms.py locally when I need those "features" back but that seems awkward. Thanks |
@portnov sorry for the enormous delay, but had to recover from a total hard drive failure. Fortunately the lab managed to excavate most of the info and I'm slowly getting back on track and starting those reports. The first findings are concerning the strange behavior with Geomdl and Native at the end of the spline (mentioned by you above): Unfortunately I cannot understand the code behind and how it changed but it seems that in the early days this problem was not present. Thanks |
I think we can close this, as the continuation is in another issue. |
A while ago I created a test case of a Closed Periodic Spline, wrapping the control points according to the theory:
https://pages.mtu.edu/~shene/COURSES/cs3621/NOTES/spline/B-spline/bspline-curve-closed.html
So I wrapped certain number control points and then used the Curve Segment node to get a spline only at its domain - resulting in a closed continuous curve. It all went well and predictable for the FreeCAD implementation (which is the most convenient for that case so I will stick to it at first because the other two implementations have problems).
This is how the whole spline looks using a periodic knot vector, before getting the control points wrapped:
...then with control points wrapped:
...and now cut only the segment between the domain limits - resulting in a smoothly closed spline:
When I deconstruct the closed spline - the result is a B-Spline that uses clamped knot vector (a Bezier Curve):
Awesome isn't it :)
Now the problem...
At this commit e4a9d3b the Curve Segment node started throwing an error so nothing worked for a while.
Then at this one 5597869 the Curve Segment started working again, but what I got as a result after deconstructing is only half clamped spline which is not the behavior I expected:
I'm uploading my test file for examination:
Closed_Periodic_Spline_5thDegree.zip
It's clearly a bug and it's present when the "T Max" value of the Curve Segment is exactly 1.0 in my case (or at the upper domain limit in an arbitrary case)
As a temporary workaround we can use "T Max" = 0.9999999 and get near perfect results but even very close to 1.0 it's not exact and the gap between curve start and end depends on the model scale.
The text was updated successfully, but these errors were encountered: