0
$\begingroup$

Given a radius (r=100) and a distance (d=10) how can I calculate the angle of a point at a given straight-line distance (on a circle with that radius)?

The end result is to take a point on a circle and find the next point on the circumference of that circle in a straight line, so to most efficiently generate a set of points on the circle which are not so close or so far as to render a circle on screen with visible lines or excess points.

I am working in code with very little mathematical notation experience.

$\endgroup$
1
$\begingroup$

If the $n$th point $P_n$ has polar angle $a_n$, the $n+1$st point $P_{n+1}$ has polar angle:

$$a_{n+1}=a_n+\alpha \ \ \ \text{where} \ \ \ \alpha=\sin^{-1}(\tfrac{d}{2r}) \iff \sin \alpha = \tfrac{d}{2r}$$

this last relationship coming from elementary trigonometry on isosceles triangle $OP_nP_{n+1}$ whose leg is $r$, and half base $d/2$ (remember : sine = opp/hyp).

$\endgroup$
  • $\begingroup$ My understanding is that the middle section in code would be: angle = sin( pow( d / (2*radius), -1 ) ). Is this correct? $\endgroup$ – Matt W May 7 '17 at 11:05
  • $\begingroup$ No: $\sin^{-1}$ is meant for arcsine, the reciprocal funtion of $\sin$, not $1/sin$. Maybe, on your system, arcsine is denoted "asin" ... this is the notation is many languages. $\endgroup$ – Jean Marie May 7 '17 at 11:10
  • $\begingroup$ How about this? angle = asin( d / (2*radius) ) $\endgroup$ – Matt W May 7 '17 at 11:16
  • $\begingroup$ Yes, that's it ! $\endgroup$ – Jean Marie May 7 '17 at 11:21
  • $\begingroup$ The angle returned is in radians, yes? $\endgroup$ – Matt W May 7 '17 at 11:34

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.