nortikin / sverchok

Sverchok
http://nortikin.github.io/sverchok/
GNU General Public License v3.0
2.24k stars 233 forks source link

"Arbitrary frame" option for "Curve Frame" node doesn't work #3424

Closed rendetto closed 4 years ago

rendetto commented 4 years ago

Worked previously. Now it doesn't.

arbitrary_frame_fail

zeffii commented 4 years ago

some back history? https://github.com/nortikin/sverchok/issues/3307

if the node is red, you can view the error either

i don't know what that error means : )

zeffii commented 4 years ago

ZeroCurvatureException is located in utils.curve.algorithms.py (line 26-33) and is raised in utils.curve.core.py (line 239) without being imported. @portnov ?

rendetto commented 4 years ago

I've never noticed the option for viewing the error in the tree - that's cool :) Thanks for the suggestion.

zeffii commented 4 years ago

@rendetto not everyone likes it, that's why it's optional :)

@portnov , maybe ZeroCurvatureException should be moved into core.py ?

zeffii commented 4 years ago

it's not clear to me if it makes sense to pass a "Line curve" to the Curve Frame node.

rendetto commented 4 years ago

This particular case is to demonstrate the node option operation that is broken. In general the option "arbitrary frame" is one way to bypass the error that halts the calculations in case you have a part of a curve(or surface) that have zero curvature. Imagine you need to read many normals along a curve simultaneously and the curve had a flat region in the middle. If that option for skipping is not available the node will fail because of the zero curvature in just one region.

zeffii commented 4 years ago

cool, i have almost no experience with the curve/surface class, so i also await @portnov 's view :)

portnov commented 4 years ago

ZeroCurvature means that the curve, literally, has zero curvature at the given point — this is obviously the case for straight line, also it is the case for curves that change direction of their curvature (S-shaped curves, for example). It is not possible to mathematically calculate the normal of such curve at such point, so there is an exception.

("Curve frame" node returns Frenet's frame of the curve, see https://en.wikipedia.org/wiki/Frenet%E2%80%93Serret_formulas)

portnov commented 4 years ago

What I can do, is to skip the particular value of T in case there are several T's provided and only some of them give error. This can also be unexpected: for example, you've passed 5 values of T, and as a result you have only 4 frames, because one of T values results in error...

Uh, it appears this node already has such an option: go to it's N panel, there is "On error": "Raise error" (default), "Arbitrary frame". Well, it actually does not even "skip": it returns just some frame with Z pointing along curve's tangent, without any guarantees where two other axes are pointing.

portnov commented 4 years ago

Well, this node appears to work "as designed". For specific cases, for example for extrusion of one curve along another, there are several modes that are usable in some other cases. Probably I'll add some of such modes into "curve frame" too; at least "Householder" and "Tracking", and probably "track normals"... some day... :)

rendetto commented 4 years ago

Skipping values of T doesn't sound useful for me either. The problem I got now is - no matter I'm using "Raise Error" or "Arbitrary frame", the node always throws an error and the whole tree just stuck on that node. Previously it was fine, working like that:

arbitrary_frame_succsess

portnov commented 4 years ago

Ah, I see

portnov commented 4 years ago

@rendetto I've pushed a fix into master. Please check.

rendetto commented 4 years ago

It's working even better now. Thanks a lot!