0
$\begingroup$

I've been trying to figure this out for several hours now and am having trouble finding the right solution.

Given two points on a circle and the radius of the circle I need to calculate the distance in degrees between the two points on the circle. Here's a picture of what I'm trying to do.

enter image description here

In this picture I have a point at (-12.2,12.7) which represents the center of the circle. I know the radius of the circle (5.344) and I have two points on the circle. One at (-12.4,7.4) and another at (-17, 13.7). I need to get the length of the arc in degrees. I know if I have the center angle I can calculate the arc length, but I can't find anything about how to determine the center angle without already knowing the arc length.

Any help much appreciated.

EDIT

Updating the image to use real values

$\endgroup$

closed as unclear what you're asking by Ian Miller, JonMark Perry, MJD, Claude Leibovici, Watson May 22 '16 at 7:54

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • $\begingroup$ Hint: unit circle. $\endgroup$ – user223391 May 22 '16 at 5:42
  • $\begingroup$ Suppose the angle is $\theta$. Looking at the $y$-coordinate, you have $\cos\theta=0.5$. So $\theta=60^o$. $\endgroup$ – almagest May 22 '16 at 5:44
  • 2
    $\begingroup$ I'm not convinced that $ \ (0.7, \ 0.5) \ $ is one unit away from the origin. Are all of your coordinates correct? $\endgroup$ – colormegone May 22 '16 at 6:24
  • 1
    $\begingroup$ @omatase Call $C$ the centre of the circle, $P$ the point $(.7,.5)$ and $Q$ the point $(0,0.5)$. Then $CPQ$ is a right-angled triangle. Do you remember basic trigonometry. The cosine of $\angle POQ$ is adjacent/hypotenuse = $OQ/OP=0.5/1$. $\endgroup$ – almagest May 22 '16 at 6:25
  • 2
    $\begingroup$ @RecklessReckoner Yes, either the point is $(0.8660,0.5)$ or $(0.7,0.7141)$ or something entirely different! $\endgroup$ – almagest May 22 '16 at 6:27
2
$\begingroup$

If the included angle is $\theta$ and the radius is $r$ then $$ s= r \theta$$

To find the included angle $\theta$ subtract the two orientation angles you get from an $\arctan(y/x)$ operation

$$ \theta = \arctan\left( \frac{y_2}{x_2} \right) -\arctan\left( \frac{y_1}{x_1} \right) $$

NOTES: You might need to use the ATAN2(dy,dx) function to resolve angles in all the quadrants

$\endgroup$
  • $\begingroup$ so given two points (0,5) and (5,0) θ would be 0. What am I missing here? $\endgroup$ – omatase May 23 '16 at 4:52
  • $\begingroup$ Since both points are in the first quadrant $\arctan \left( \frac{5}{0} \right) = \frac{\pi}{2}$ and $\arctan \left( \frac{0}{5} \right) = 0$ (see en.wikipedia.org/wiki/Atan2) $\endgroup$ – ja72 May 23 '16 at 5:40
1
$\begingroup$

Updated to take into account your change of question

(Actually - ignoring your diagram and using my own)

enter image description here

Applying dot product of the two vectors you get:

$$\cos\theta=\frac{(x_1-x_c)(x_2-x_c)+(y_1-y_c)(y_2-y_c)}{\sqrt{(x_1-x_c)^2+(y_1-y_c)^2}\times\sqrt{(x_2-x_c)^2+(y_2-y_c)^2}}$$

so that

$$\theta=\cos^{-1}\left(\frac{(x_1-x_c)(x_2-x_c)+(y_1-y_c)(y_2-y_c)}{\sqrt{(x_1-x_c)^2+(y_1-y_c)^2}\times\sqrt{(x_2-x_c)^2+(y_2-y_c)^2}}\right)$$

Note: The bottoms of these fraction is just the radius times radius of your circle. However your shapes so far have not been circles so this is a general formula that will give you the angle between any two random points compared to a center point.

$\endgroup$
  • $\begingroup$ Cosine in the fourth quadrant is the same as cosine in the first... $\endgroup$ – DJohnM May 22 '16 at 18:12
  • $\begingroup$ If I use this method plugging in some generic numbers (0,5) and (5,0) I get 90 degrees which is correct, but when I plug in the numbers in my image (-12.4, 17) and (7.4, 13.7) I get some weird results 180. - 308.728 I. See here: wolframalpha.com/input/?i=inverse+cosine+of+((-12.4*17)+%2B+(7.4*13.7)). What am I doing wrong? $\endgroup$ – omatase May 23 '16 at 5:43
  • $\begingroup$ "Whats wrong?" - you changed the question. Before you had a radius of one. I'll update my answer to match your new version of the question. $\endgroup$ – Ian Miller May 23 '16 at 12:46
  • $\begingroup$ @DJohnM Thanks. Removed unnecessary (and wrong) statement about quadrants. $\endgroup$ – Ian Miller May 23 '16 at 13:04
  • $\begingroup$ Aaaaah! Now I see why there were so many problems with my original image. It was just supposed to be an example of a possible set of numbers, it wasn't ever supposed to mean that the radius will always be 1. In the real world when I use this equation to solve the problem, although the radius will be known, it will not always be the same between circles (same with the other points). $\endgroup$ – omatase May 24 '16 at 2:19
0
$\begingroup$

The diagram showing the center at $(0,0)$ is inconsistent with the other points in the diagram, and with the stated form of the problem. So:

Edit: The edited question confirms the assumptions of this solution.

Given two points on a circle and the radius $R$, first calculate the distance $D$ between the two given points, the chord between the two points:$$D=\sqrt{(x_1-x_2)^2+(y_1-y_2)^2} $$

Half this length, $\frac D2$, along with the radius form one side and the hypotenuse of a right-angle triangle. So, the angle at the centre, $\theta$ subtended by the entire chord, is given by:$$\theta=2\times \arcsin \left(\frac{D}{2R} \right)$$

A slightly more complex method is to use the Law of Cosines. With $R$ given, and $D$ calculated:$$\cos({\theta)}=\frac{R^2+R^2-D^2}{2R^2}$$

$\endgroup$
  • $\begingroup$ It sounds like this will give me the center angle, but then how do I get the length of the arc? $\endgroup$ – omatase May 22 '16 at 23:32
  • $\begingroup$ @omatase You didn't ask for the length of the arc. You asked for the distance in degrees. $\endgroup$ – Ian Miller May 23 '16 at 13:06
  • $\begingroup$ @IanMiller Sorry, I'm struggling to use the right terms here. To me there's no difference in meaning between "distance between two points on the circle" and "length of the arc". Degrees or radians or whatever is fine but degrees is what I understand the best. $\endgroup$ – omatase May 24 '16 at 2:24

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