I want to calculate the X,Y coordinates of a point on a circle given only the distance and angle traveled, without calculating the radius as an intermediate step.

My starting point (0,0) is at the top of the circle. I know how far I have traveled around the circumference, and I know the angle I have subtended.

Because the angle could be very small or zero and this has to be performed in 32bit floating point arithmetic I want to avoid having to calculate the radius or location of the center of the circle (which could be infinite or very, very large)


That's simple: if $r$ is the radius and angles, measured w.r.t. the vertical axis, are in radians, the distance travelled is $d=r\theta$.

On the other hand, $x=r\cos\bigl(\frac\pi2+\theta\bigr)=-r\sin\theta\:$ and $\:y=r\sin\bigl(\frac\pi2+\theta\bigr)-r =r(\cos\theta -1) $, so that \begin{cases} x=-\dfrac{d\sin \theta}\theta,\\[1ex] y=\dfrac{d(\cos\theta-1)}\theta. \end{cases}

  • $\begingroup$ Technically correct, but it doesn't actually help :) You've used d = rθ to express the equations without mentioning the letter r, but in practice those equations still involve calculating r in all but name (ie, they both involve d/θ) which means the problem with θ=0 or θ being very small remains. It is interesting that sinθ/θ tends to 1 and (cosθ-1)/θ tends to zero though :) $\endgroup$ – Peeling Apr 13 at 13:01
  • $\begingroup$ My point was only to have a formula involving only the distance and the angle. $\endgroup$ – Bernard Apr 13 at 13:12
  • $\begingroup$ Right - which would be fine if I were answering a math problem on paper. But I'm writing a computer program, and your equations still involve "d/θ", which is inaccurate or non-computable as θ approaches zero. The equations aren't using the LETTER r, but they are using the VALUE of r (i.e. d/θ) which is the problematic part :) $\endgroup$ – Peeling Apr 25 at 14:55
  • $\begingroup$ My final formuæ involve only $d$ and $\theta$, not $r$, which is used only for their justification. Your question says these data are given. And as far as I know, there are programs which can determine a limit with a good approximation. $\endgroup$ – Bernard Apr 25 at 16:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.