# Extremely precise geometry in AI (irrational numbers?)

In the context of making geometric shapes in AI, I'm wondering what are some of the most efficient ways to achieve a certain shape configuration. For the scope of this question consider a square that has a circle inscribed in it, and that circle also has a square inscribed in it. The result is pictured:

As you can see, I have got it fairly close (when eye-balled anyway). I originally thought I could just click drag and use AI's snap feature to create this type of arrangement of shapes, but that actually didn't pan out. Well, inscribing the circle in the big square worked fine with snaps, but making the smaller square in the circle didn't. There were no snap features to detect when the corners of the square were right on the circle. (Let me know if there is a snap setting for this.) So what I did was resort to the math representation: the diagonal of the square circle is equal to the diameter of the circle -- which is equal to the width of the big square. This ratio when expressed exactly is the square root of 2. With this in mind, I did the following:

``````select big square > right click > transform > scale > scale UI
``````

As far as I know scale UI only accepts percentages. So to get the percentage I just took an estimation of the square root of two: 1.414, and divided that by 1 to get 70.7%. So I'm exact to at least the tenth place.

Question: Does AI have any kind of fraction or irregular number methods built in? If not, what this the best I can hope for?

• 0.707 is only exact to the third place. "To ten places (behind the floating point)" would be 0.7071067812. (That's just a guess.) Still, it shows you do have a good use for maths in graphics design! Commented Jul 6, 2018 at 19:31
• @usr2564301 I think Arash is intending ‘tenth place’ to mean ‘decimal’ (which is called ‘tenth’ in many languages). Commented Jul 8, 2018 at 22:29

Ai's user interface does not know anything about irrational numbers and as far as I know, the computer knows nothing about them, too. Some math applications for propellerheads can have them, but I believe no practical graphics programming framework handles them.

If you want to draw those parts starting from the big square, then the circle and finally the smaller square and want to rely on snaps, draw the big square and the circle as you already have done.

The little square needs snapping points. You find them as intersect points if you draw a diagonal of the big square.

If you have smart quides and snap to points ON you can (see image 3) start and stop the dragging exactly.

It's entirely possible to do it with almost perfect accuracy.

With the Rectangle tool, draw an exact square by holding down Shift as you click and drag, to constrain it to a square. Then take note of the width/height.

With Smart Guides enabled, select the Ellipse tool, and mouse over the centre of the square, until the "Center" Smart Guide indicator shows.

Hold down Alt as you click and drag to make an ellipse - it doesn't have to be perfect at this stage, as long as the ellipse is centred on the centre of the square.

Manually type in the width and height for the circle, to make it the same as the square.

With the circle selected click Object > Path > Add Anchor Points, this adds additional anchor points in the circle.

Switch back to the rectangle tool. Mouse over the centre again, and this time begging clicking and draggging, then hold down Alt+Shift to constrain the rectangle to a square, and to the centre, and continue dragging until the corner intersects with the anchor of the circle, as indicated by the Smart Guide.

Finally check the accuracy by toggling to Outline mode Ctrl+Y

• You can also just rotate the circle by 45° instead of adding anchor points. Commented Jul 7, 2018 at 17:14
• @Orphevs - sure. There are many ways to skin a cat. Commented Jul 7, 2018 at 17:20
• Just for completeness' sake, and also because iirc, adding points will transform the circle from a live shape into a simple path. Things like the pie chart might become missing. Commented Jul 7, 2018 at 17:25

Kinda ignoring the other aspects of your question. You can make that figure, the square-circle-square one that you attached an image for, pretty easily without having to go into questions about irrational numbers.

1) Simply create the outside square.

2) Then create the inside circle, which should be easy enough.

3) Now the innermost square you just choose the rectangle tool, hold down alt, make sure your cursor is over the center of the square-circle combination you have drawn already, and then hold shift (in addition to alt) to start your square from the center point. Drag out to the circle which should snap (I believe it will say intersection to give you feedback on the snapping), and you're done.

You've just created exactly what you've shown us in the attached image.

Here is a short video demonstrating this: https://streamable.com/1i3zl