I have a query related to my project i am working on. I have plenty of circles of different sizes and i want them to touch their tangents. Right now there is a gap in all of the circles. Any help?
I think you can try your luck with grasshopper:
It seems grasshopper add-on Kangaroo has the added functionality you need.
Thanks for your help. I have tried the circle packing script for grasshopper and i have also installed kangaroo for rhino. But seems like they are generating their own circles and packing them. But i have a different situation here. I already have circles with gaps in them. But i want to kill this gap any how to make the circles touch each other.
This is not my expertise, but I’ll change the category of this topic to
Grasshopper for more support/visibility to the Grasshopper community.
Also try to post your issue at http://www.grasshopper3d.com/ it’s the main community for grasshopper.
Can you post your file or an example of what you are trying to do? I can’t understand if you have your circles of a fixed radii and want to pack them, or is the center of these circles that is fixed and you want to offset the circles so that they are tangent to each other.
Thanks for your interest in post. I am trying to pack circles without disturbing their radius and position.
If you have some thing to share please help.
Radius and position are the only things you can change about circles. If you lock down those two properties, there’s nothing left to do.
The only circle packing algorithms that I know rely on changing either the radius or the position of the circle. Like @DavidRutten said, if you can’t change that there is nothing left change. The only thing I can think off is that what you are trying to do is adding new circles that fill the voids between your existing circles. I haven’t tried this before.
I think you need an iterative algorithm that seeks to reduce a bit more the error in each iteration. The error is the distance between a circle and their neighbors.And of course, you need to change or position or radius. And in both cases, you will not have a perfect packaging, because it is only allowed for certain configurations, and surely your circles do not meet these conditions unless you want to change also the radius.
But for this you need the topology of the packaging. You know it? If not, you need to create a new topology by connecting the centers of the circles by proximity. Maybe be easier to create a mesh to that.
Then, the algorithm would be something like (at first glance):
Each vertex of the mesh representing a circle. Then for each vertex, you have a radius, and for each edge, the sum two radius ± error. The idea is that in each iteration, move the vertex for that the edge length approaches the sum of the two radii, moving each vertex towards/opposite its neighbors (and making an average or something). Doing the average of the same point moved towards its neighbors, returns to break the ideal edge distance of each pt-neighbor, but it will be more acceptable than the previous iteration.Then iteration by iteration, you relocate the vertex (and circles) by a method of approximation, reducing the error in each iteration.
There may be better ways, but it is an idea. And with Kangaroo you can solve your problem too.