Hello, I’m trying to make the mesh adhere better to the surface of this dome so that the circle-packing works better and respects the boundary of the surface. It does this relatively well with a few exceptions, such as when there are steep curves or sharp corners. This makes it so that the mesh doesn’t fully reach these areas and undershoots. Someone suggested adding anchor points to these corners so that the mesh expands to these areas, but I’m confused about how to integrate this into the circle packing.
The anchor point method doesn’t work because the Goal Object is mainly dictated by the C# script file inside.
You need to add another couple line to not only pull the points to the curve but also pull the points to the anchors.
My C# skills is unfortunately not so good that I could easily edit other people’s code.
Perhaps someone else here will have a further insight to this.
public override void Calculate(List<KangarooSolver.Particle> p)
Point3d pts = this.GetCurrentPositions(p);
for(int i = 0;i < pts.Length;i += 3)
//use semiperimeter minus this opposite edge to get radius
//pull towards this distance from the curve
double lengths = new double;
Vector3d v01 = pts[i + 1] - pts[i];
Vector3d v12 = pts[i + 2] - pts[i + 1];
lengths = v01.Length;
lengths = v12.Length;
// lengths = pts[i].DistanceTo(pts[i + 1]);
// lengths = pts[i + 1].DistanceTo(pts[i + 2]);
lengths = pts[i + 2].DistanceTo(pts[i]);
double radius = 0.5 * (lengths + lengths + lengths) - lengths;
double t = 0;
Crv.ClosestPoint(pts[i], out t);
That script included in the definition in your first post, which I previously posted and which @Wiley quotes above is not needed here.
That was an earlier variation of the goal to keep the outer circles tangent to the boundary curve, but this is integrated in the built-in TangentCircles goal itself - the only thing to watch out for is that the direction of the boundary curve must match the orientation of the surface, so sometimes needs flipping.
This is also not somewhere where anchors will be helpful, because the location depends on the radius, which is not known in advance.
What is actually needed here is a Goal to keep the corner points equidistant from 2 different boundary segments either side of the sharp corner.
The definition I included at the start of this reply uses the same custom goal for this I previously posted here:
As mentioned there though, be aware that it becomes geometrically impossible to have a perfect circle packing with given connectivity once you include more than 2 corners. (To get technical, this is due to the Koebe–Andreev–Thurston theorem, which says that the circle packing for a given graph is unique up to Moebius transformations, and stopping 2 points on the boundary from sliding by constraining them to be tangent to the corner is equivalent to setting this Moebius transformation)
What this means in practise is that when >2 corners are included, the packing might be forced away from the boundary in places.
Thanks, for the response and explanation, @Wiley and @DanielPiker, this makes sense to me. I changed the design of the corners to an arc bottom and its compact circle packs really well. Another question I have which may be repetitive, but I’m wondering if there is any way to influence the circle size. Of course each circle directly impacts the size of each valence circle which then inturn affects the sizes of their valence circles. It seems that all the sizes are very regular and have little variance. Is it possible to have some distribution of ~90-95% regular sized circles and maybe 5-10% larger sized circles or anyway to directly control this? The script seems to on chance be able to produce patterns and solutions like this with about 2-3 larger sized circles which is sort of what I’m looking for.