# Drawing a semi-circle?

#### Apple30

Hi all,

Assuming I have a semi-circle with a diameter of 100, is there a formula where I can plug in X and get the Y of the semi-circle?

For example, assuming a 'U' shaped semi-circle, where X:0 is the top-left of the semi-circle, X:100 is the top-right, and Y:0 is the bottom-center, what formula would I use to get Y at any X position?

If possible, I would appreciate if the formula was an exact representation of a circle, not an approximation.

Thanks in advance for your help #### Greens

For a circle centered at the origin $x=r \cos{\theta}$ and $y= r\sin{\theta}$ where $0 \leq \theta \leq 2 \pi$, so if we know $x$ we can solve $\theta = r \cos^{-1}{\frac{x}{r}}$.

So $y = \pm r \sin{\left( r \cos^{-1}{\frac{x}{r}} \right) }$

Plus or minus depending on the semi-circle. For a "u" shaped semi-circle, negative. Namely, if $\pi \leq \theta \leq 2 \pi$ then negative, if $0 \leq \theta \leq \pi$ then positive.

#### Greens

$\theta = r \cos^{-1}{\frac{x}{r}}$.
Goofy typo, should be

$\theta = \cos^{-1}{\frac{x}{r}}$

And so

$y = \pm r\sin{(\cos^{-1}{\frac{x}{r}})}$

Apologies for any confusion.

• Apple30

#### skipjack

Forum Staff
For example, assuming a 'U' shaped semi-circle, where X:0 is the top-left of the semi-circle, X:100 is the top-right, and Y:0 is the bottom-center, what formula would I use to get Y at any X position?
$Y = 50 - \sqrt{X(100 - X)}$

• Apple30

#### Apple30

Thanks everyone! That's very helpful #### Apple30

I'm surprised that pi wasn't used to draw the circle to be honest. I wonder if that would also work? (just out of curiosity)