Hi, I have the problem that I do not know what “flip curve toward a point” of Begehst Components is doing. Can someone show what would be the equivalent with native grasshopper components. Inputs and outputs should be the same.
This is actually a perfect example of the limitations of grasshopper and when it starts to become better to code. So to simulate a conditional, (I think, but please correct me if I’m wrong), we need to use a stream filter. The problem is that we actually use calculation time to calculate the flipped curve, even if we don’t intend to use it, as well as the graph being needlessly complicated.
if crv.PointAtEnd.DistanceToSquared(pt) > crv.PointAtStart.DistanceToSquared(pt):
crv.Reverse()
Why use DistanceToSquared() instead of DistanceTo() you might ask. Well, square root calculations are expensive and the distance calculation between two points includes one. Using DistanceToSquared() thus gives you a performance boost!
I tried to put it in a python component but was not able to bring it two work. Can you show me what would be the entire code for your example? Is there some more variable defining before that?