Find X given Y on a circle

Blitz3D Forums/Blitz3D Beginners Area/Find X given Y on a circle

chwaga(Posted 2008) [#1]
Hi, I'm working on a radar system for a space game, and I'm stumpted on something that I can't seem to find on teh internets (that was on purpose).

How to I find X on a circle's boundary given Y (or the other way around) given the diameter (or radius) of the circle?


Who was John Galt?(Posted 2008) [#2]
x=sqrt(r^2-y^2)
y=sqrt(r^2-x^2)


SebHoll(Posted 2008) [#3]
Or more generalised, for circle center (a, b) and radius r (slightly optimized, by removing powers):

x=a+sqrt((r*r)-(y-b)*(y-b))



Shambler(Posted 2008) [#4]
For every X there are 2 Y's and vica-versa.


chwaga(Posted 2008) [#5]
snapping to the nearest. happy?


Shambler(Posted 2008) [#6]
Overjoyed ;)