Circles in two Curve

your python code doesn’t work with closed curve :roll_eyes:

I told you that, and you need split curves for symetrie.

1 Like

TangentCirclesBetweenCurvesPYTHONBYNIKWILLMOREANDCHRISTOPHEREDGEMON.gh (8.0 KB)

Is it possible to add an offset from a circle to the code in python and do the following about it?
which is similar to the logic I did in the beginning…

You don’t need python to do offset

I know you can’t use Anemone with Human UI… (why not?)
Still, I find this interesting. The first slider in a blue group adjusts the seam, showing the resulting MidPt. The ‘Count’ slider effectively determines precision. All 2000 circles are created, then after the Data Dam (red group), they are culled in the Anemone loop (white group), observing the ‘gap’ value between circles. The gap at the end is indeterminate (leftover).

circle 2 curve_2020Sep29d.gh (DEPRECATED due to error! Use version ‘e’ below) (25.9 KB)

P.S. The gap between circles grew as the loop progressed due to an error; using the loop counter as an index value was wrong, it always wants the first circle in the list from ‘D0’. Fixed.


circle 2 curve_2020Sep29e.gh (23.7 KB)

P.P.S. Manually adjusting the gap slider can make the leftover gap nearly unnoticeable.

Oh look, with a smaller gap we get 20 circles instead of 19:

Can you get around that problem by using Data Export and Data Importto pass geometry and parameters to a separate GH file that runs the Anemone loop, then pass the results back? It doesn’t run in the background so you have to switch focus to the GH file running Anemone, then switch back when it’s done, but that’s a minor pain compared to not being able to use Anemone at all.

thanks for trying to help. but unfortunately this method is very slow.

I didn’t realize that speed was an important issue. The algorithm is not efficient but it is effective with gaps between circles measured in 3D instead of by distance along the tween curve. So in that sense it is infinitely faster than methods without a gap parameter that don’t solve the problem at all.

Here’s a Kangaroo solution. It uses the Zombie solver, so you don’t need to mess around with the reset or timer, and takes around 200ms to find evenly spaced curves.


ring_circle_spacing.gh (22.5 KB)

It equalizes the gaps between the circles, while also keeping them tangent to the top and bottom curves. The size of the resulting gap is determined by the number of circles.

5 Likes

Slick (fast!) but the circles aren’t tangent to the lines and the gaps are not even.

thanks. a very interesting way. but unfortunately it is not yet universal.

“universal”? Has another criteria slipped into this challenge besides speed? Fortunately, my slow method works fine with arbitrary curves (from one of your posts):

1 Like

Yes, finding circles between a pair of open curves is a different problem and would require adjustment of the approach.
For your second example, there are more circles than can possibly fit between those curves, so of course you won’t get gaps.

Regarding Joseph’s point about the distances - this might be just a question of adjusting some of the strengths and threshold to enforce the spacing and tangency more strictly. Otherwise it might need an extra goal for keeping a point equidistant between 2 curves.

I am trying on such a solution.
ring_circle_spacing 2.gh (20.7 KB)

You didn’t internalize your curves.

sorry. for the inconvenience . :pleading_face:ring_circle_spacing 2.gh (16.3 KB)

To be fair, I applied the same metric to my own code and the gaps aren’t even either:

circle 2 curve_2020Sep29e4

Increasing the precision from 2000 to 4000 helps a little:

circle 2 curve_2020Sep29e5

I’m using CircleTT though so my circles are tangent.

1 Like

Yes - generating the final circles with CircleTT makes them tangent.


ring_circle_spacing2.gh (16.8 KB)

I would also note that the given input curves are not exactly above each other in plan, so I think it’s quite likely no solution exists with all circles exactly tangent to both top and bottom curves and shortest distances between all adjacent circles exactly equal.
Also, the solution I posted is making the chordal distances and gaps equal, so effectively distance between spheres, while the final circles are in tangent planes, so this will give a slight difference. At the scale of a ring though, we are talking around 0.01mm variation in the gaps, so presumably negligible. If you want something with tighter tolerances you could enforce that the radius lines remain tangent, but that seems like overkill to me.

2 Likes

Interesting (and fast!), though your algorithm is obscure to me so far.

In this image below, your circles are red and mine are black. Larger circles at start, small at end.

This next image shows how I’m measuring gaps using CrvProx (Curve Proximity), which may not be the best choice when the circle planes are skewed as they are with this pair of curves.

Yes, how the gaps are measured is what I am alluding to as well.

P.S. At some point I introduced an error in my Anemone loop so the last circle was repeated. Oops! For the record, this version is fixed: circle 2 curve_2020Sep30a.gh (27.3 KB)

1 Like