# Calculating circle radius from two points on circumference (for game movement)

I'm designing a game where objects have to move along a series of waypoints. The object has a speed and a maximum turn rate. When moving between points p1 and p2 it will move in a circular curve like so:

Angle a is the angle the object must rotate through. Therefore we can calculate the time it will take to rotate through this angle as t = a / turn rate.

However, if the object's current speed means it will cover distance d in quicker than this time, it must slow down on this corner or it will miss p2. I need to calculate the maximum speed it can take this corner at, which means calculating the distance of the curve d (so I can calculate the maximum corner speed as d / t).

I think I've figured out b = 2a, but to determine d I need to know the radius of the circle. How can I determine it from this information?

-
Do we know the distance between $p_1$ and $p_2$? – awllower Jan 24 '13 at 14:28
Yes, they're both known. – AshleysBrain Jan 24 '13 at 14:28
Since we know $b$, we could find the radius by noting that $p_1 p_2 b$ forms an equilateral triangle. Thus, denoting the distance between $p_1$ and $p_2$ by $\Pi$, we find the radius to be $\rho = \Pi *arcsin(a)/2$. – awllower Jan 24 '13 at 14:31
Note that looking at your diagram carefully, (and the arrows showing the direction of movement at the start and end of the arc) the angle you have marked as $a$ is only one half of the total angle the object has to turn through. – Shard Jan 24 '13 at 20:52
@awllower: I think you mean $1/\sin a$ where you say $\arcsin a$. It doesn't make sense to take the arcsine of an angle. – Rahul Jan 25 '13 at 8:16

The angle between the line $P_1 P_2$ and the radius is $\frac{\pi}{2} - \alpha$, where $\alpha$ is the angle you seem to call $a$. By symmetry, the angle at $P_2$ is the same, so the angle $\beta$ at the center is just $2 \alpha$. By the law of cosines, if $d$ is the linear distance between $P_1$ and $P_2$: $$d^2 = 2 r^2 (1 - \cos (2 \alpha))$$ I'm sure this can be simplified further...
I think it would be polite to use the same variable names that the asker used. $d$ is already the length of the arc, so let's call the straight-line length of the chord $c$. Then we have $c^2=2r^2(1-\cos2a)=4r^2\sin^2a$, so $r=c/(2\sin a)$. – Rahul Jan 25 '13 at 8:14