I know there are many threads around curve frames and I have looked at a ton of them, but could not find a satisfactory solution.
Basically I am trying to find a way to get curve frames somewhat reliably.
The frames should be:
- the x-axis should always align with the curve tangent
- the z and y axis should not suddenly change direction when the curvature flips from one side to the other
It has to work on any open or closed nurbs curve.
You would think it is fairly straight forward since we as humans have a intuitive sense of how the frames should align along any curve. If we think of a roller coaster, that is a good example of where the 2 principles absolutely have to match. Of course with a roller coaster a third principle comes into play with “leaning” into the curve so that the acceleration vector is always pointing down. This would be a nice bonus. A roller coaster might have some intentional extra twists, lets ignore those.
Well, seems like it is not so easy to actually do.
I have seen many mentions of the Frenet-Serret formula and suggestions to “just use that”. So my first question would be: Is this algorithm used in any of the curve frame components?
Playing around I have found that there are 2 difficult cases: changing curvature and circles placed directly on the X, Y or Z base planes.
Looking at the normal Curve Frame component (Method 1) it has the problem that the z-axis tends to flip where the curvature goes from one side to another side of the curve.
Now trying to fix that with flipping certain planes using dot products (Method 2) works, but usually only in one plane.
I have devised a third method, which seems to be a lot closer to what I am after, but fails with the circle in YZ plane. Here everything is more or less oriented to have Z up, similar to the roller coaster example.
Maybe there is no solution that has satisfactory results in all cases. But maybe there is, and I would like to/need to find it.
So far in all my many years of using Grasshopper this is the one problem that riddles me over and over again.
evaluate_curve.gh (64.9 KB)