# Polar array based on distance between objects

I would like to create a polar array of circles where the distance between the circles allways is 12,7 mms. I want to be able to change that distance and the amount of circles. It should automatically adjust the diameter of the array.
I tried polar array but there i can only input the number of circles and the sweep angle
A polygon would be even better because i want the straight distance to be 12,7 mm. Then the circles should be linked to the corners of the polygon. As you might have guessed i want to make a bicycle chainwheel.
I tried polygon but allso here i cannot define the length of the edges (which i can in rhino) and link that to the amount of edges.

Kind regards, rene

This exact question was asked years ago, but I can’t find it. It is possible to do this with circles because they are fully symmetrical shapes. So given a circle radius and a separation and a copy count, you can compute the radius for the polar array using standard trig functions.

The circles must be placed d = 2r+s apart, with r being the circle radius and s being the separation. So we end up with a polygon whose edge count is N (given) and whose edge length is d (computed).

Thus a single wedge of this polygon is an isosceles triangle, or two right triangles glued together along one of their right edges.

The angle at the polygon centre of these right triangles is a=\frac{\pi}{N}, the length if the outside edge is \frac{1}{2}d, meaning the diagonal edge (and the radius of the polar array) should be \frac{\frac{1}{2}d}{\text{tan(a)}}.

Doing this dry on an iPad, I may have made a mistake.

Hi David

that is some serious math! Does this mean that i have to define a isosceles triangle in grasshopper and array that?
I searched for the subject but i guess it is no longer there.

I can draw the thing in rhino offcourse but it seemed like a nice thing to train my grasshopper abilities. Not as easy as i thought.

1 Like

I see now that it should be different then your assumption. You assume that the edge count is given and the edge length is computed. Both are given and the polygon should be computed.

Sort of stuff we got at maths classes at age 15 or so, but maybe the Dutch curriculum focuses more on trig than schools elsewhere? I do know I’m useless at solving polynomials…

This does the trick. I do not fully understand how it works so i will dive into this even if algebra is not really my thing but i allways like to learn.
I guess that you define these expressions yourself in grasshopper.

Thanks a lot!

Would not it be much easier do have a polygon definition where you can define edgelength and grasshopper computes the polygon. Just like you do it in rhino.
Then you still ave to connect circles to the cornerpoints of the polygon.

On my wishlist…

I added a component which takes three points and an integer. The first and second point set the start and end of a polygon edge, the third point sets the plane in which the polygon is created, and the integer is for the number of sides.

Logged under RH-48894.

It is just few lines of code…
Polygon_LC.gh (5.5 KB)

Wow! Nice solution. Unfortunately i am not into coding. Where can you learn this? Online?

Hi David

what is the name of this component?

Polygon Edge, but I only just wrote it yesterday so it’ll be a while until it’s made its way into the released Rhino6 product.