# Join two circles to make perfect rounded rectangle

In Inkscape, how to make two circle to be a rounded rectangle?

Lets say, I have blue circle and red circle. Both of them position like below image:

How to join that two circle so I have perfect rounded rectangle based on the blue and red circle position? So the output something like this:

• A trick from graphics programmers, and math classes, is that you can always transform to a case that you can trivially solve. In this case rotate to horisontal vertical connect and counter rotate has been suggested. It works, and in fact half of all you see on a monitor relies on a trick like this. I do however wonder why everybody has to copy how adobe has neglected tangent snapping. Most cad apps implement this elegantly without needong super complicated stuff. Nov 26, 2019 at 15:57

I think I'd use the InkTan extension to generate the outline. Still needs a bit of path joining afterwards, but it will be exact by default.

https://github.com/Rhysun/inkTan

To turn these three objects into a single one, connect the ends of the tangents with new segments, so they form a rectangle, then do Path > Union with all three objects.

• Can you show me additional steps how to make that to be a perfect rounded rectangle? Nov 27, 2019 at 14:14
• Still can't got it. I'm very new to inkscape. Nov 28, 2019 at 3:09
• Updated gif, @EngkusKusnadi . Nov 29, 2019 at 2:55
• Got it! Thanks @Moini, that answer and the GIF is very awesome! Nov 29, 2019 at 5:40

Make sure the circles are aligned either vertically or horizontally, then draw a rectangle between them, ensuring that the size matches and that it ends at the centers of both circles. Then merge with the pathfinder tool and rotate/recolor as needed.

• So, if the position of both circle is verticaly or horizontaly, Instead I'll directly create a rounded rectangle. And its look you are using Illustrator instead Inkscape that I'm ask. Nov 26, 2019 at 2:14
• Oh, I misread what application you're using. This method would work with both Inkscape and illustrator, but you obviously the interface and vocabulary are different. In inkscape, instead of pathfinder, you'd use "Path > Combine" Nov 26, 2019 at 16:27
• You could simply delete the right anchor on the left circle, and the left anchor on the right circle, then simply join the top and bottom anchors. No need for a rectangle. Nov 27, 2019 at 20:39
• Yes, but I also have an unnusual love for the addition/subtraction tools, soooooooo Nov 27, 2019 at 20:46

The case is already solved with a tangent drawing extension. Actually in this special case the tangents can be drawn also without that extension. They are as long as the line between the circle midpoints and they can be made by duplicating that connection line. Placing them properly with snapping happens when one draws a 90 degrees rotated copy of the line. Its midpoint snaps to the circle midpoint. In inkscape snap to crossing works well.

The tangents are joined, the resulted rectangle and the circles are combined with Path > Union.

BTW in Inkscape closed areas like circles often cause false snaps if they have a stroke. For that reason it's useful keep them strokeless during the construction.

If it is acceptable to place the two circles either vertically or horizontally to perform the creation, then rotate the creation, the process is straightforward.

Use the align feature for placement. Convert the circles to paths (Path, Object to Path) and break the nodes for both circles at the diameter. Delete the semi-circles that are no longer needed. Add lines between the remaining semi-circles. Join the nodes and fill with desired color.

Rotate to desired angle.

• Maybe create rounded rectangle is a good idea. But, can you show me how to create rounded rectangle, and rotate that so the both sides position 'exact' in both blue circle and red circle position? Nov 26, 2019 at 2:17