Drawing a semi-circle?

Oct 2014
46
0
Mars
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 :)
 
Oct 2018
129
96
USA
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.
 
Oct 2018
129
96
USA
$\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.
 
  • Like
Reactions: Apple30

skipjack

Forum Staff
Dec 2006
21,481
2,470
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)}$
 
  • Like
Reactions: Apple30
Oct 2014
46
0
Mars
Thanks everyone! That's very helpful :)
 
Oct 2014
46
0
Mars
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)