Hi,
I am fairly new in grasshopper. I would like to know how I can extract or cut a portion of an irregular shape by percentage? see example on image
Hi,
I am fairly new in grasshopper. I would like to know how I can extract or cut a portion of an irregular shape by percentage? see example on image
Any 25% or does it have any rules applied?
Here is the quick solution using galapagos:
I would be applying this various percentages on hundreds of different shapes. The portion would be starting from one point along the curve and the cut would somehow look arc like.
Look atbthis discussion and others links
So the variable will be the point and the circle radius.
Can you post some shapes top test?
There are probably more direct solutions to this, but here’s a Galapagos-based one:
Anders offered an excellent solution using region intersections. It should work in every case.
Thanks, it works
Trial and error iterative approach, multithreaded.
100 curves in half second.
Fails when area ratio “k” is near 1.
Far from perfect, but it can be tweaked…
Galapagos can be faster if you remove the parameter “gene”.
Only radius should be a “gene”.
Giving also the position slider (so a totally different position of the center) to galapagos will make harder to find the solution.
Edit: I try to explain better: define the random point of the circle center before going to galapagos, still random, but before. Then, give galapagos only the task to find the proper radius.
Combining the randomness of the center position with the euristic approach to find the radius is a no-go.
While it would probably be faster to solve each curve sequentially (e.g. it would be great if one could solve Galapagos statically ala the Kangaroo2 Zombie solver, or implement it via scripting), and it’s true that the parameter space can get quite large quite quickly if we solve for two parameters per curve (i.e. as @maje90 points out above), if we use the annealing solver it gets there in a few minutes for twelve curves:
This sort of 1 parameter problem is well suited to solving with root finding
It does mean writing a little bit of code to adapt it for your specific problem, but it’s typically several orders of magnitude faster than using an evolutionary solver for this
Indeed. Also, on a side note, I noticed that Galapagos appears to solve substantially slower in Rhino 8 than Rhino 7 with the file I posted above (maybe something for @DavidRutten to be made aware of):
Rhino 7:
Rhino 8:
With root finding:
circle_intersect_rootfind.gh (15.0 KB)