gotcha

Author Topic: circles inside circles  (Read 1920 times)

March 09, 2019, 05:07:52 AM
Read 1920 times

brynn

  • Administrator

  • Offline
  • ******

  • 3,941
  • Gender
    Female

    Female
    • Inkscape Community
Hi Friends,
I have a geometry problem that I can't solve.  I had a 600 px circle, and I want to put smaller circles inside, so that the inside circles touch each other and the outer circle.  I started with 4 smaller circles, for simplicity.

By trial and error, I noticed that smaller circles 250 px came very, very close to the right size, but not quite.  I couldn't solve the problem, so instead, I approached it by starting with the smaller circles, and making the outer larger circle fit.

First, I added 4 new nodes (all at once) using Add Nodes button, to the small circles.  Then I snapped the northeast (NE), NW, SE, and SW nodes together.  Resulting in this:  Edit - Hmm, just realized I didn't need to add nodes, but just rotate the circles -duh!

4c.png
*4c.png
(9.39 kB . 333x322)
(viewed 487 times)


Then I snapped the top node of the larger circle to the top node of the top smaller circle.  Then I moved the rotation center to the top node.  Then using Ctrl + Shift, I dragged the bottom arrow and snapped the bottom node of the large circle to the bottom node of the bottom small circle.

But if I wanted 5 small circles inside, or some number of circles that's not a multiple of 4, that technique won't work.

Is there a simple geometric formula that can calculate the right size for the smaller circles, given a certain number of smaller circles, and a certain size of the outer circle?  (I'm too old.  I remember pi - r - squared, but I don't remember if that's the formula for area or circumference  :b1:

Ooorrr, is there some procedural way to figure it out, using Guides or spacer objects, together with geometric principles?  Or some other technique? 

After I had the 4 circles inside a larger circle finished, I played around with guides.  I came up with a fairly involved process to orient the circles.  But I'm still stuck with figuring out the right size for the circles.

I can divide the number of desired circles into 360 to get the angles.  Then set up guides at the right angles to make rays or spokes.  Then I can rotate each of the smaller circles by the same angles so that the top node of each circle can snap to the intersection of the ray guide with the larger circle. 

But I still don't know what size the circles need to be.  There must be some way to figure that out with guides or spacer objects, and certain geometric principles?  But I'm stuck. 

Here I have it set up for 6 circles, and SVG is attached in case someone wants to play with it.

6c.png
*6c.png
(38.29 kB . 571x527)
(viewed 585 times)


If there were some way to figure out how large the implied middle circle would be, you could maybe scale and snap the other circles to it.  But the size of that one is a mystery as well.  I tried rotating the circles (the ring of circles) by half the angle, so that they are between the guides. (like below)  But scaling the circles larger won't snap to the guides, because there's not a node in the right place on the circle.

6c2.png
*6c2.png
(41.4 kB . 609x528)
(viewed 476 times)


Oohh, I wonder if that snap tangential would work?  Aren't those guides exactly tangential to the circles (when they're rotated by half the angle to be between the guides)?  Hhm, I enabled the snap tangential option, but it doesn't seem to work.  At least not while scaling the circle.  (Doesn't seem to work when dragging the whole circle either.  Maybe it's not supposed to work that way?

Edit - Yes, dragging a guide over to the circle snaps tangentially.  But not the circle to the guide, or scaling the circle towards the guide.  I wonder if that would be a worthwhile feature request?  Because if scaling towards the guide would snap, that would solve this problem!

Thanks for any more or less simple ideas :)

6c.svg
*6c.svg
(6.74 kB . 601x601)
(viewed 475 times)
  • Inkscape version 0.92.3
  • Windows 7 Pro, 64-bit
Inkscape Tutorials (and manuals)                      Inkscape Community Gallery                        Inkscape for Cutting Design                     



"Be ashamed to die until you have won some victory for humanity" - Horace Mann                       

March 09, 2019, 07:58:15 AM
Reply #1

GANGUS

  • Jr. Member

  • Offline
  • ***

  • 15
  • Gender
    Male

    Male
I opened your “6c.svg” file (bottom one of your post) in 0.9.2.2 and just used Control-drag on each of the 6 circles, on the appropriate arrows, until they just touched the guides.

I don’t know how precise you need this to be, perhaps a CAD App. would help, but I can’t see any other way in Inkscape to do this sort of thing although there may & should be, if anyone else chimes in.
There should be some way to snap to guides tangentially, although perhaps there is !?

The final diameters (the W values) ended up to be about 166px-167px where originals were about 151px. if that is useful or not.

BTW, how did you originally get the 6 circles positioned in that Hexagonal layout?
Just manually, or some Inkscape function?

Fun project, for sure.

ps; does this board support email notifications for following threads? , seemingly not.
6cGAngus.svg
*6cGAngus.svg
(7.11 kB . 601x601)
(viewed 467 times)

  • Inkscape 0.92.2, 0.91, 0.48.2
  • iMac, MacOS 10.12.6 (Sierra)

March 09, 2019, 04:17:50 PM
Reply #2

Lazur

  • IC Mentor

  • Offline
  • ******
  • Inkscape Filters Wizard

  • 1,154
  • Gender
    Male

    Male
You are drawing this the wrong way around.

Like, having the big circle and one of its diameters you want to construct somekind of circle which is tangent to both of those.
Well, let me just say that the origos of such circles -all of which is tangent to the big circle and the line- describe a parabola. So theoretically you'd need to construct a parabola to construct the origo of the small circle.
It's possible and a bit of unnecessary even from that approach, but let's just take the other road.

Draw the small circles first tangent to eachother.
Construct a large circle concentric to the layout and tangent to the small circles.
Scale the objects to the desired output size.

Now, you need to draw a small circle tangent to two intersecting diametres of a given angle. The intersection point is the origo of the large circle, and the bisectrix of the two lines and the small circle describes the radii of the large circle. Easy as a pie.

Would use the * tool so the nodes are placed precisely at the tangent points. For that six fold symmetry, 6 sided polygons would be a good start.

March 09, 2019, 04:23:02 PM
Reply #3

Lazur

  • IC Mentor

  • Offline
  • ******
  • Inkscape Filters Wizard

  • 1,154
  • Gender
    Male

    Male

March 09, 2019, 04:39:51 PM
Reply #4

Lazur

  • IC Mentor

  • Offline
  • ******
  • Inkscape Filters Wizard

  • 1,154
  • Gender
    Male

    Male
This didn't come as clean&fast because that's my first attempt in the video recorded on the fly.
Five fold symmetry.



As seen preferably use 20gons for a convenient structure instead of 10.

March 10, 2019, 06:37:55 AM
Reply #5

GANGUS

  • Jr. Member

  • Offline
  • ***

  • 15
  • Gender
    Male

    Male
Ahhh,
So you started with hexagonal shapes to utilize the snapping features and in the end, changed them to circles . . .  ingenious method.
So many ways to ‘skin a cat’.

I was sort of expecting a way to utilize tangent snapping along a guide some how. So, as Brynn suggested, perhaps that could be a future feature request.

btw, I don’t see how/where/when you used the * key anywhere. I guess you mean the ‘Path/ Ctrl + * intersection CMD?. (Would I need the SHIFT key also to get the * key), if so ? How does that work?

I see you have a whole series of Inscape tutorials on the tube.
I should have to go through them soon.
Thank You much for the insights..
  • Inkscape 0.92.2, 0.91, 0.48.2
  • iMac, MacOS 10.12.6 (Sierra)

March 10, 2019, 12:04:26 PM
Reply #6

Lazur

  • IC Mentor

  • Offline
  • ******
  • Inkscape Filters Wizard

  • 1,154
  • Gender
    Male

    Male
Not really tutorials just random video responses without a concept or any additional cutting/soundtrack.

There is a way for tangential snapping although I never got around it nor it is precise as per se.
Like, the nodes can be positioned exactly on a circle but the Bézier path -even if cubic as in inkscape- can never represent a perfect circle by definition.

Thus for such constructions involving Bézier "circles" I use the * tool -> :star:

In the end, all of them were selected and combined (Ctrl+K) which converts them to paths, and then
the nodes were set to be smooth ones.

(On a side note svg has an option to draw circular arcs as path segments yet inkscape doesn't have a gui for that. Can only render such images but to edit them you need converting to paths -and then the precision is lost. Same goes with the intersections.)

March 10, 2019, 01:43:25 PM
Reply #7

brynn

  • Administrator

  • Offline
  • ******

  • 3,941
  • Gender
    Female

    Female
    • Inkscape Community
Lazur, thanks for the video.  I got lost in your text description when you mentioned parabolas, which (from 1967) I only remember to be, well, not circular, but elliptical. 

I had no idea that changing the node type on hexagons would make a perfect circle!  I would have thought it would make rounded hexagons.  No wait -- it doesn't make a perfect circle!  Look on your control bar on the first video, at the end.  It shows W = ~801 and H = ~ 808.  Even in the 2nd video with 10 sides, it wasn't a perfect circle.  It is very close though.

GANGUS, I explained how I arranged the circles.  Yes, Inkscape does have tangential snapping.  As I said, I could snap the guides tangentially to the circles, but not the other way around.

Yes, there is a way to be notified about new messages, and I can see that you've set it up some notifications.   But there's a problem with your email.  I noticed it shortly after you registered.  You may remember that I had to manually activate your account because you weren't getting the activation emails.  It seems to be a problem with your email domain, as I found a few complaints when I searched the internet for the error message.  The forum is trying to send you the emails, but they aren't being delivered.

In case you want to investigate on your own, the error message says "Unacceptable greeting" meaning that your mail server doesn't like the greeting which the forum mail is using.  I assume by "greeting" it means the header, but I don't know that for sure.  (All the complaints I found had the same problem with "unacceptable greeting".)

You could change your email address, if the notifications are important to you.  But hopefully, within a few months, this forum will be....not technically closed, but when the new forum opens, I'll send all our forum traffic there.  It will be Inkscape's first official forum!  (I haven't decided exactly what I'll do here, or how soon.  But eventually this site will become very small, and possibly more like my personal site, and all the forum traffic will be on the Inkscape website.)

But let me know if there's anything I can do to help.
« Last Edit: March 10, 2019, 02:46:57 PM by brynn »
  • Inkscape version 0.92.3
  • Windows 7 Pro, 64-bit
Inkscape Tutorials (and manuals)                      Inkscape Community Gallery                        Inkscape for Cutting Design                     



"Be ashamed to die until you have won some victory for humanity" - Horace Mann                       

March 10, 2019, 02:26:55 PM
Reply #8

Lazur

  • IC Mentor

  • Offline
  • ******
  • Inkscape Filters Wizard

  • 1,154
  • Gender
    Male

    Male
which (from 1967) I only remember to be, well, not circular, but elliptical. 

They are similar in nature yet entirely different.
The cut lines of a cone and a plane can describe both ellipses, hyperbolas, parabolas, circles and lines so there is an universal function to draw those parametrically.
Although from a drawing perspective it is easier to understand the description of those shapes in 2D.
Ellipse is described by points that are having the sum of their distances equal from two focal points.
Parabolas on the other hand are points that are in the equal distance from a given line and a focal point.



-more info here-

Look on your control bar on the first video, at the end.  It shows W = ~801 and H = ~ 808.  Even in the 2nd video with 10 sides, it wasn't a perfect circle.  It is very close though.

Didn't look at it because the same problem applies -path segments are imprecise. If I wanted the width/height of the object to be exact, would have added nodes there as well.
Like, 12gons in the first video and 20gons in the second video would/should have produce the exact height/width.

March 10, 2019, 03:32:34 PM
Reply #9

brynn

  • Administrator

  • Offline
  • ******

  • 3,941
  • Gender
    Female

    Female
    • Inkscape Community
Oohh, I knew you had strong math skills, but didn't realize exactly how strong!

If I wanted the width/height of the object to be exact, would have added nodes there as well.

Added nodes where?  I want all the circles to be exact....say within 0.5 px

Now I'm trying to follow this:

Draw the small circles first tangent to eachother.
Construct a large circle concentric to the layout and tangent to the small circles.
Scale the objects to the desired output size.

Now, you need to draw a small circle tangent to two intersecting diametres of a given angle. The intersection point is the origo of the large circle, and the bisectrix of the two lines and the small circle describes the radii of the large circle. Easy as a pie.

Hhmm, either I'm lost, or you misunderstood my question.  I want to know how to figure out the size of the small circles, given the desired size of the large outer circle and the number of small circles.  Or how to draw it so that the small circles are all touching (tangent) each other and touching the outer circle (also tangent).

For the first paragraph, I can only do that for 4 small circles, because I can snap the nodes together to make them tangent.  For any other number of small circles, it would be a pain to get the nodes in the right place, to be able to snap them together at the right angles.

So for the example in my first message, with 6 circles.  I can put them in the right place, but I don't know how to make them the right size.  I don't mind calculating the right size, if I knew how.  Or I'm happy to draw them that way, but I can't find a snapping arrangement to do it (without having nodes in the right place).
  • Inkscape version 0.92.3
  • Windows 7 Pro, 64-bit
Inkscape Tutorials (and manuals)                      Inkscape Community Gallery                        Inkscape for Cutting Design                     



"Be ashamed to die until you have won some victory for humanity" - Horace Mann                       

March 10, 2019, 04:57:12 PM
Reply #10

Lazur

  • IC Mentor

  • Offline
  • ******
  • Inkscape Filters Wizard

  • 1,154
  • Gender
    Male

    Male
Added nodes where?  I want all the circles to be exact....say within 0.5 px

They are "exact". But will record the process with those extra nodes.
Nodes at the horizontal/vertical extremities. Then it's not the inprecise path segment that the height/width is measured from.


The general approach would be drawing the touching circles first, draw the larger one around them, and scale the result to the desired size.
With 4 circles, octogons would be the best to start. or 16gons if you want to rotate the layout 45° at any point.


For any other number of small circles, it would be a pain to get the nodes in the right place, to be able to snap them together at the right angles.

No?
For 4 small circles 8 or 16gons.
For 6 small circles, 12 or 24gons.

For 5 small circles, 20 gons.

So multiply the number of the small circles four times and use that many polygon nodes to start so they can be snapped at the exact angles easily.


Also, the small circles radii can be calculated upon the large circle's radii and the number of small circles. Yet, it'd be a merely calculated value. 3 digits limited by the input fields. Constructing the real thing is "relatively" more precise. The rounding error at least comforms with the whole drawing -theoretically.

Another note that constructing by geometric terms is not how you construct in inkscape.
In geometry to draw a circle first you construct the origo of the circle, then draw the circle around it with a set radii.
With inkscape you rely more on the bounding box, scaling and snapping etc.

March 10, 2019, 05:53:54 PM
Reply #11

brynn

  • Administrator

  • Offline
  • ******

  • 3,941
  • Gender
    Female

    Female
    • Inkscape Community
No?
For 4 small circles 8 or 16gons.
For 6 small circles, 12 or 24gons.

I meant it's hard to place the nodes using only circles.  I understand what you mean about using the best process or technique for Inkscape, and it seems like using polygons is the best way.  But....  Oohhh!!  I just thought of a way to do it!

Also, the small circles radii can be calculated upon the large circle's radii and the number of small circles.

How is that done?  Is it a very complicated formula?


  • Inkscape version 0.92.3
  • Windows 7 Pro, 64-bit
Inkscape Tutorials (and manuals)                      Inkscape Community Gallery                        Inkscape for Cutting Design                     



"Be ashamed to die until you have won some victory for humanity" - Horace Mann                       

March 10, 2019, 06:09:56 PM
Reply #12

brynn

  • Administrator

  • Offline
  • ******

  • 3,941
  • Gender
    Female

    Female
    • Inkscape Community
Ta-Daaa!!

The small circles aren't perfectly symmetrical, but they're within 0.10 px  Most within 0.05.

6c4.png
*6c4.png
(34.27 kB . 580x524)
(viewed 446 times)
  • Inkscape version 0.92.3
  • Windows 7 Pro, 64-bit
Inkscape Tutorials (and manuals)                      Inkscape Community Gallery                        Inkscape for Cutting Design                     



"Be ashamed to die until you have won some victory for humanity" - Horace Mann                       

March 11, 2019, 12:39:24 AM
Reply #13

Lazur

  • IC Mentor

  • Offline
  • ******
  • Inkscape Filters Wizard

  • 1,154
  • Gender
    Male

    Male
How is that done?  Is it a very complicated formula?

With some basic trigonometry.
trigonometr.svg
*trigonometr.svg
(17.92 kB . 600x600)
(viewed 411 times)



r is the radii of the small circle, R is the radii of the large one.

There is a right triangle with the sides r and a, with the alpha in between two of the sides.

sin(alpha)=r/a

a=r/sin(alpha)

R=a+r=r/sin(alpha)+r=r*(1+1/sin alpha)=r*(1+csc(alpha)

or in your case, better express that as

r=R*(1/(1+1/sin alpha))


If the number of small circles is n, alpha is (360°/n)/2=180°/n.

For 4 circles:
alpha=45°
r=R*((1/(1+1/sin 45°))=R*((1/(1+2^0,5))=R*0,4142135623730950488016887242097

for 6 circles
alpha=30°

r=R*((1/(1+1/sin 30°))=R*((1/(1+2))=R*0,33333333333333333333

for 5 circles
alpha=36°

r=R*((1/(1+1/sin 36°))=R*0,37019190815875013770223764105761


Does it really work, does it?
Well if your large circle had a radii of 600 px, that would indicate
the small circles radii to be

248,52813742385702928101323452582 px for 4 small circles

222,11514489525008262134258463456 px for 5 small circles

200 px for 6 small circles.

Yet 248,528=/=248,52813742385702928101323452582 so it won't be an exact match.

March 11, 2019, 07:43:22 AM
Reply #14

GANGUS

  • Jr. Member

  • Offline
  • ***

  • 15
  • Gender
    Male

    Male
a-Daaa!!

The small circles aren't perfectly symmetrical, but they're within 0.10 px  Most within 0.05

So, Brynn, how did you finally do it ?
Did you find a way using snapping in some way?
  • Inkscape 0.92.2, 0.91, 0.48.2
  • iMac, MacOS 10.12.6 (Sierra)

March 11, 2019, 03:51:32 PM
Reply #15

Lazur

  • IC Mentor

  • Offline
  • ******
  • Inkscape Filters Wizard

  • 1,154
  • Gender
    Male

    Male
Ok no videos but the actual results from 2 to 12:























No trick here, did exactly the same thing as before with the diifference now there are nodes at the horizontal/vertical extremities too.

"Easy as a pi"
Seems accurate as in three days we will have a pi day. (3.14)

There is an Apollonian gasket drawing extension you might like. 

March 12, 2019, 04:10:23 AM
Reply #16

brynn

  • Administrator

  • Offline
  • ******

  • 3,941
  • Gender
    Female

    Female
    • Inkscape Community
Oh Lazur, you're such a treasure!  Thank you for all the info!  Whew, I would call those complicated formulas!  (Though I had such a class in both high school and college, I had totally forgotten about trigonometry  :b1:)

No trick here, did exactly the same thing as before with the diifference now there are nodes at the horizontal/vertical extremities too.

Same thing as before, meaning using polygons to start, right?  I'm just not clear exactly which horizontal and vertical extremities you mean.  Do you mean add extra nodes on the polygons?


I should say that Lazur's technique of using the polygons is probably much faster and easier (once I understand where to put the extra nodes).  But here's how I finally figured out a way to do it.  It's fairly complex. 

1 - make large circle of the size you want (optional - then Path menu > Object to Path)
2 - 360 divided by n, where n is the number of small circles that you want
3 - drag out however many guides you need and set at the angles determined by #2, and all crossing at the center of the large circle
4 - draw 1 small circle of any size, then Path menu > Object to Path, and then duplicate once
5 - snap centers of both small circles to the center of the large circle which is where all the guides are crossing (you have to temporarily give the small circles a fill color, if it doesn't have one, to make the center snapping work)
6 - set snapping for snap to intersections
7 - add a new node to the top circle, at the intersection of a guide and the bottom circle (I found it's best to zoom way, way in for this, so you can initially set the node as close as possible to the intersection - this reduces the loss of precision) (there's supposed to be a way to add a new node at an intersection but I can't get it to work - not sure if it's something about this situation, or if there's a bug with it)  then snap the node to the intersection (when I say "way, way in" I mean 7000% or more) (the more zoom, the more precision in the end)
8 - repeat for all the guides/circle intersections
9 - delete the bottom circle
10 - snap the small circle to one of the intersections of a guide and the large circle (the nodes on the small circle will snap to the intersection)
11 - duplicate the small circle as many times as needed, and snap around the large circle at intersection with guides
12 - select all the small circles and rotate by half the angle determined in #2 (this places the small circles between the guides)
13 - move the rotation center of the small circles, and snap to the large circle-guide intersection
14 - hold Shift and Ctrl, while dragging the scaling handle until you see a node snap to a guide (I found sometimes you have to try different handles, to make the right node act as the snapping target - or sometimes try snapping to the guide on the other side)
15 - repeat for all small circles
  • Inkscape version 0.92.3
  • Windows 7 Pro, 64-bit
Inkscape Tutorials (and manuals)                      Inkscape Community Gallery                        Inkscape for Cutting Design                     



"Be ashamed to die until you have won some victory for humanity" - Horace Mann                       

March 12, 2019, 12:07:14 PM
Reply #17

Lazur

  • IC Mentor

  • Offline
  • ******
  • Inkscape Filters Wizard

  • 1,154
  • Gender
    Male

    Male
Same thing as before, meaning using polygons to start, right?  I'm just not clear exactly which horizontal and vertical extremities you mean.  Do you mean add extra nodes on the polygons?

Meant to draw such polygons that have nodes at the edges of the bounding box. So then when converted to path the smooth nodes will have horizontal/vertical handles there. Making sure the precisely calculated node coordinates determine the height/width of the "circle" instead of the bounding box being tangent to path segments between nodes.

By using the add nodes button you can add new nodes at the very top/bottom/right/left part of a path and with the combination of rotating you can add new nodes at any angle you like (a feature I was looking for years ago for that calligraphy project) BUT by using that feature those new coordinates won't be precise, node positions won't be exactly where the polygon nodes would be layed down.


Oh Lazur, you're such a treasure!  Thank you for all the info!  Whew, I would call those complicated formulas!

You are welcome!

It's not that complicated, just the typing makes it look as.
rR.svg
*rR.svg
(19.39 kB . 600x300)
(viewed 409 times)

March 13, 2019, 08:00:55 AM
Reply #18

GANGUS

  • Jr. Member

  • Offline
  • ***

  • 15
  • Gender
    Male

    Male
Thanks Brynn, for that detailed description.
I am sure that it took a while to do that, but it is well appreciated.

Between yours’ and Lazurs’ methods, I have a lot to work with here, and will report any successes.

The manipulation of nodes and getting them to snap correctly is the main challenge here, and I have re-learned a lot exploring this project already.
Thanks again
  • Inkscape 0.92.2, 0.91, 0.48.2
  • iMac, MacOS 10.12.6 (Sierra)