Find X given Y on a circle

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

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?

x=sqrt(r^2-y^2)
y=sqrt(r^2-x^2)

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))


For every X there are 2 Y's and vica-versa.

snapping to the nearest. happy?

Overjoyed ;)