# Geometry optimization related to an library

Hey Guys,
i have a question regarding to geometry optimization related to an library. In my example I created a polyline based on 10 points. No i can subdivide the curve by length, the answer would be 10 individual curves (pipes) which are highly complex to fabricate. Now my specific question: How can i optimize the curve so, that it is always be generated out of only 3 different parts only by rotating. Please see the picture.

Hope i could explain my thoughts understandable. Thanks and best.

Hi @McFly,

If I understand you correctly, you could step-by-step approximate the â€śidealâ€ť curve by evaluating the optimal module from your curve fragments pool. For each curve segment, you would iterate your curve fragments pool, evaluate the most fitting curve, and append it to the existing, already evaluated curve fragments.

However, this would be hard, if not impossible to do with vanilla Grasshopper. In my opinion, youâ€™d have to script it (e.g. Python, C#, VB). It might also be more involved than discernible at first glance.
Would you at all be interested in a scripted solution? If so, which language would you prefer? What are your ideas for efficiently evaluating the best curve fragment for a given base curve segment?

Maybe somebody else will suggest a vanilla Grasshopper solution to this?

A greedy loop wonâ€™t even yield the best possible solution. Sometimes youâ€™d get a better overall result by inserting a less-than-optimal piece at position n which would allow a much better approximation at n+i.

This is actually very similar to the problem solved by Knuth and Plass in their famous breaking-paragraphs-into-lines paper. You need the sort of branching iteration they cane up with to find the best solution without an enormous amount of back-tracking.

1 Like

Hi, thanks for your answer and sorry for replying so late. You got my â€śproblemâ€ť correct and probably scripting possibility could be work. I did a small Python Programming Project some years ago, i think its hard to get in again. I know there are various tutorials about Rhino Python, but do you can recommand a good series? Maybe already related to the library task?
And one more question: What is vanilla grasshopper? Did not find information about it and never heard about it before. Thanks and best regards

Hey David, thanks also for your answer. I will have a look to the paper soon. Iâ€™m working on another project now, but will invest time in this kind of problem from november on. I will keep the forum updated. Thx and best.

While it will result in arcs with different radii (which are still simple to fabricate), you might also consider using `Curve.ToArcsAndLines`:

6 Likes

Nice i did a test with your script and it is working fine. I get in trouble by acute angles, but this i could manage by changing the length (See the picture). The green line is because of your script.

To achieve something what i described before, i only need optimize the radius of the circles somehow. Find the average of my green, blue, dark, blue and red circles (see picture) If I than define some length options, it could give me a good solution.

I mean than i need to see how it will affect the curve, but this could work somehow right? Related to the fabrication i have 4 parts with the same length then!? Thanks for your support.

Thanks for the script, this is really useful!

1 Like