# Finding circle center from two points and an arc length

1. Sep 29, 2011

### MegatronX

I'm trying to find the equation for a circle given two points in x, y and the starting angle, arc length, and two points along the circle. I need to find the equation because I need to translate a sprite along the curved path from one point to another.

The situation ends up looking like this:

A
|\
|a\
|--\
|---\
----c C
|---/
|--/
|b/
|/
B
A = point 1
B = point 2
C = center of the circle
the arc travels from a to b
c = arc angle

Now, I can clearly determine the length of all sides as well as the angles. thats not problem. I can use that to make a system of equations and solve them together. This works, but the problem is that I need to be able to do this programmatically, and attempting to solve systems of equations in C++ is proving to be pretty difficult. I was hoping there was a more straight forward/easy way to find the center when two points are know and all the angles/lengths are known.

Thanks in advance for any help

2. Sep 29, 2011

### LCKurtz

If I understand you, you are given the coordinates of two points on the circle and the length of the arc between them. But what do you mean by the "starting angle"?

3. Sep 29, 2011

### MegatronX

by starting angle I'm referring to the the angle the starting point makes relative to the center. That is where the arc angle starts (its just simply the angle the starting point makes)

4. Sep 29, 2011

### LCKurtz

Angles require two sides. Are you talking about angle c in your picture? If not, what two sides make up that angle?

5. Sep 29, 2011

### MegatronX

In thi case the positive x-axis (angle 0) (originating from the center) and the radius from C to A form the starting angle. Now that I think about it, the starting angle doesnt need to be given, it can be derived by which point A or B forms the lesser starting angle.

6. Sep 29, 2011

### MegatronX

No, C is the unknown and it can be anywhere. Its directly dependent on A and B. I know point A, point B and the angle of the arc that needs to be drawn between them. I assumed I'd need to provide a starting angle for the arc but now I don't think that's necessary.

In the drawing, C is the center of the circle that describes the arc between A and B. If it's possible, i want to be able to find C (the center of the circle) without solving a system of linear equations as that is proving to be difficult when solving. programmatically.

I'm sorry, i guess I'm not making this clear enough heh. Thansk for the help so far though :)

7. Sep 29, 2011

### LCKurtz

Let d be the distance from A to B. If you know A and B you can find its mid-point M. Lets say the vector AB is <s,t>. Then a vector perpendicular to it is <-t,s>. Divide that vector by its length and call the resulting vector V. If you know the radius r you can calculate the height h of your triangle with the Pythagorean theorem using hypotenuse r and leg d/2.

Then if O is the origin, the coordinates of the center are OA+ (1/2)AB± hV, with the sign chosen depending on which side of AB the center is on.

8. Sep 30, 2011

### MegatronX

That works great

Thank you