algorithmic modeling for Rhino
Hi,
I am starting out with a parabola (or any planar curve), with a start and an endpoint. I am trying to divide it into N number of linear segments evenly, such that the points are at equal absolute distances from each other. That is, I would like the length of the chords (shown in the image in red) to be equal, not the lengths along the curve. I don't care what the length of the segments are, as long as they are all the same, and the curve is divided evenly (that is, there is not a segment at the end which is shorter or longer than the rest). Is there a way to do this?
Tags:
With Divide Distance (DivDist) component, and setting for the distance the curve length/number of segments.
Thank you for your reply, but that distance would be longer than the required one, because the length of the curve is slightly longer than the sum of the lengths of the linear segments, since the linear segments are shorter than the arcs. Any other ideas?
Nope, there's Divide Length which measures the distance along the curve and there's Divide Distance which measures the distance in XYZ space.
Yes, that would be very useful if I knew beforehand what the distance in XYZ space was. However, I don't, and I was wondering if there was a way to do it with Grasshopper, but I think it turns into an optimization problem more than a geometrical one, which might be outside the scope of what the program can do.
If I were to use Divide Distance, and I set the distance to the curve length/number of segments, that number would be too large, even though the curve is then divided by that length in absolute distance and not distance along the curve.
It might not be mathematically possible to divide an entire curve into equal distance segments. Dividing a curve this way can be a discontinuous process depending on the exact shape and division count. You can probably get quite close using Galapagos, provided it's logically possible to get close at all.
Hello Pancho,
I think you will never find a solution where all your segments are exactly the same length, however you can get real close by using Galapagos...
In this example, I found that I could have the last segment differ from the others by only 0,005 mm. Not bad !
Up to you to define the best threshold according to your needs and precision.
Good luck !
Here is a brute force approach that may be of interest. An iterative solution like galapagos, or something based on scripting / hoopsnake / anemone will certainly get you something more accurate, but I wanted to share this approach since it relies on native components only and can be used "in-line" (you don't have to press any special buttons or trigger any solvers to update it if its inputs change).
The idea is to START with the length of the actual curve divided by N, and then subtract incrementally increasing small numbers from that value, and run "Divide Distance" on all the possible distances you generate. The first result with the right number of points will be the closest to "exact." You can adjust how big the increment should be and how far into it to search to increase accuracy.
Thank you!
Thanks Daniel! Really useful!
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 2 Likes
© 2019 Created by Scott Davidson. Powered by