Calculating distance between two points on a circle in either radians or degrees
$begingroup$
I've asked this question a couple of times but I haven't been specific enough, I think, to get to the true answer. After spending a couple of weeks trying to get to the answer to this issue I finally have a real example of numbers I'm dealing with and the unexpected results I get using the various proposed mathematical solutions.
I'm building a game. In my game I have a character around which I am rotating a camera. The camera will rotate around the character at a fixed distance from the character. After the object has rotated around the character a variable number of degrees I want the camera to stop rotating. Here' is a visual representation of what I'm doing.
This image shows two circles. The character is at position $(x_3, y_3)$ and the camera rotates around the character along an imaginary circle. $(x_1, y_1)$ is the starting point of the camera and $(x_2, y_2)$ is the current position of the camera. I want to use this information to figure out the length of the red portion of the circle in either radians or degrees.
When I asked this question before (Calculating the distance in degrees between two points on a circle). It was suggested that I use the following process to do this:
Let the radius (distance from centre two two corrdinates) be $r$.
Let the distance from =$(x_1, y_1)$ to $(x_2, y_2)$ be represented by $c$.
$c=sqrt{(x_2-x_1)^2+(y_2-y_1)^2}$
If $x_1 < x_2$ (from Law of Cosines):
$theta=arccosfrac{2r^2-c^2}{2r^2}$
If $x1 > x2$:
$theta=360-arccosfrac{2r^2-c^2}{2r^2}$
In fact I implemented this method and it seemed to work great for a few of my tests so I marked the question as answered. However, after doing so I decided to play around with the number of degrees I wanted the camera to travel before stopping and soon realized it wasn't working fully. In fact, as the camera orbits around its center, this equation never returns a value larger than $136°$ before it starts to decrease. It certainly never reaches $180°$ - as it should.
Here is a set of real-world numbers I'm working with laid out graphically:
In this real example, the starting point for the camera is at $(-13.145792, 7.98047543)$. There are two points along the circle where I recorded the position as it rotated around the object: $point 1: (-14.6517525, 17.653318)$ and $point 2: (-8.312066, 14.7897005)$. The center point is the object around which I'm rotating. When I apply the aforementioned equation I don't get the results I am expecting. For $point 1$ I expect to get a value somewhere in between $135°$ and $180°$ but instead I get a ridiculous value of $358.600336634706$, which turns out to be $20546.2931677548°$. That's mainly because $x_1$ is $>$ $x_2$ so I'm subtracting the result I get from the $arccos$ from $360$ which is an obvious error in the equation since $arccos$ will return a result in radians and the $360$ is meant to compensate for a result in degrees. If I don't do that I at least get a value $< 360$ but still nowhere near the correct number since I end up with $80.1948322451861°$ which is way too low.
The last thing that I want to mention is that the distance between the position of the camera and the character should always stay the same if I'm rotating along a perfect circle, however, I'm not in control of this because the game engine is rotating my object for me; And one thing I have discovered is that the distance value between points on the circle and the center point is not always the same. In 3 examples I witnessed here are three different measurements I found for $r: 4.9999, 4.95677$ and $5.02961$. Again, I know that's not how circles work :) but I'm not in control of that part of the process. However, given that the difference is very small I am hoping it won't prevent me from solving my problem without having to account for or offset the changing radius.
In case it's helpful, here's some code I'm using to concept this problem out and it's results. In this code I've converted the value I get from $arccos$ to degrees before I subtract the result from 360.
var x2 = -14.6517525;
var x1 = -13.145792;
var y2 = 17.653318;
var y1 = 7.98047543;
var r = 5.37358332;
var c = Math.Sqrt(Math.Pow(x2 - x1, 2) + Math.Pow(y2 - y1, 2));
Console.WriteLine("c = {0}", c);
double theta = Math.Acos((Math.Pow(2*r, 2) - Math.Pow(c, 2))/Math.Pow(2*r, 2));
var degrees = theta * 57.2958;
if (x1 > x2)
{
degrees = 360 - degrees;
}
Console.WriteLine("θ = {0}", theta);
Console.WriteLine("° = {0}", degrees);
And here's the output of the code:
c = 9.7893718088325
θ = 1.39966336529355
° = 279.805167754814
Thank you math wizards for your help on this problem.
circles arc-length
$endgroup$
add a comment |
$begingroup$
I've asked this question a couple of times but I haven't been specific enough, I think, to get to the true answer. After spending a couple of weeks trying to get to the answer to this issue I finally have a real example of numbers I'm dealing with and the unexpected results I get using the various proposed mathematical solutions.
I'm building a game. In my game I have a character around which I am rotating a camera. The camera will rotate around the character at a fixed distance from the character. After the object has rotated around the character a variable number of degrees I want the camera to stop rotating. Here' is a visual representation of what I'm doing.
This image shows two circles. The character is at position $(x_3, y_3)$ and the camera rotates around the character along an imaginary circle. $(x_1, y_1)$ is the starting point of the camera and $(x_2, y_2)$ is the current position of the camera. I want to use this information to figure out the length of the red portion of the circle in either radians or degrees.
When I asked this question before (Calculating the distance in degrees between two points on a circle). It was suggested that I use the following process to do this:
Let the radius (distance from centre two two corrdinates) be $r$.
Let the distance from =$(x_1, y_1)$ to $(x_2, y_2)$ be represented by $c$.
$c=sqrt{(x_2-x_1)^2+(y_2-y_1)^2}$
If $x_1 < x_2$ (from Law of Cosines):
$theta=arccosfrac{2r^2-c^2}{2r^2}$
If $x1 > x2$:
$theta=360-arccosfrac{2r^2-c^2}{2r^2}$
In fact I implemented this method and it seemed to work great for a few of my tests so I marked the question as answered. However, after doing so I decided to play around with the number of degrees I wanted the camera to travel before stopping and soon realized it wasn't working fully. In fact, as the camera orbits around its center, this equation never returns a value larger than $136°$ before it starts to decrease. It certainly never reaches $180°$ - as it should.
Here is a set of real-world numbers I'm working with laid out graphically:
In this real example, the starting point for the camera is at $(-13.145792, 7.98047543)$. There are two points along the circle where I recorded the position as it rotated around the object: $point 1: (-14.6517525, 17.653318)$ and $point 2: (-8.312066, 14.7897005)$. The center point is the object around which I'm rotating. When I apply the aforementioned equation I don't get the results I am expecting. For $point 1$ I expect to get a value somewhere in between $135°$ and $180°$ but instead I get a ridiculous value of $358.600336634706$, which turns out to be $20546.2931677548°$. That's mainly because $x_1$ is $>$ $x_2$ so I'm subtracting the result I get from the $arccos$ from $360$ which is an obvious error in the equation since $arccos$ will return a result in radians and the $360$ is meant to compensate for a result in degrees. If I don't do that I at least get a value $< 360$ but still nowhere near the correct number since I end up with $80.1948322451861°$ which is way too low.
The last thing that I want to mention is that the distance between the position of the camera and the character should always stay the same if I'm rotating along a perfect circle, however, I'm not in control of this because the game engine is rotating my object for me; And one thing I have discovered is that the distance value between points on the circle and the center point is not always the same. In 3 examples I witnessed here are three different measurements I found for $r: 4.9999, 4.95677$ and $5.02961$. Again, I know that's not how circles work :) but I'm not in control of that part of the process. However, given that the difference is very small I am hoping it won't prevent me from solving my problem without having to account for or offset the changing radius.
In case it's helpful, here's some code I'm using to concept this problem out and it's results. In this code I've converted the value I get from $arccos$ to degrees before I subtract the result from 360.
var x2 = -14.6517525;
var x1 = -13.145792;
var y2 = 17.653318;
var y1 = 7.98047543;
var r = 5.37358332;
var c = Math.Sqrt(Math.Pow(x2 - x1, 2) + Math.Pow(y2 - y1, 2));
Console.WriteLine("c = {0}", c);
double theta = Math.Acos((Math.Pow(2*r, 2) - Math.Pow(c, 2))/Math.Pow(2*r, 2));
var degrees = theta * 57.2958;
if (x1 > x2)
{
degrees = 360 - degrees;
}
Console.WriteLine("θ = {0}", theta);
Console.WriteLine("° = {0}", degrees);
And here's the output of the code:
c = 9.7893718088325
θ = 1.39966336529355
° = 279.805167754814
Thank you math wizards for your help on this problem.
circles arc-length
$endgroup$
$begingroup$
Do you know that, mathematically,arccos
is in radians. So360 -arccos(something)
looks… how would I say… weird. Like mixing oil and vinegar.
$endgroup$
– Bernard
Jun 11 '16 at 18:52
$begingroup$
@Bernard, yeah, that's true, I'll note that in the post. Unfortunately removing that from the equation, or in cases when $x_1 < x_2$ the answer is still not the value I'd expect so it seems like the root of the problem is still somewhere else in the heart of the equation.
$endgroup$
– omatase
Jun 11 '16 at 19:16
$begingroup$
Your equations are missing the information given by the direction of motion, so the first thing to do is to use two equations for clockwise and counterclockwise motions. Then I suggesting to use half angle arctangent to solve the angles as it will give always full circle domain.
$endgroup$
– N74
Jun 11 '16 at 20:43
add a comment |
$begingroup$
I've asked this question a couple of times but I haven't been specific enough, I think, to get to the true answer. After spending a couple of weeks trying to get to the answer to this issue I finally have a real example of numbers I'm dealing with and the unexpected results I get using the various proposed mathematical solutions.
I'm building a game. In my game I have a character around which I am rotating a camera. The camera will rotate around the character at a fixed distance from the character. After the object has rotated around the character a variable number of degrees I want the camera to stop rotating. Here' is a visual representation of what I'm doing.
This image shows two circles. The character is at position $(x_3, y_3)$ and the camera rotates around the character along an imaginary circle. $(x_1, y_1)$ is the starting point of the camera and $(x_2, y_2)$ is the current position of the camera. I want to use this information to figure out the length of the red portion of the circle in either radians or degrees.
When I asked this question before (Calculating the distance in degrees between two points on a circle). It was suggested that I use the following process to do this:
Let the radius (distance from centre two two corrdinates) be $r$.
Let the distance from =$(x_1, y_1)$ to $(x_2, y_2)$ be represented by $c$.
$c=sqrt{(x_2-x_1)^2+(y_2-y_1)^2}$
If $x_1 < x_2$ (from Law of Cosines):
$theta=arccosfrac{2r^2-c^2}{2r^2}$
If $x1 > x2$:
$theta=360-arccosfrac{2r^2-c^2}{2r^2}$
In fact I implemented this method and it seemed to work great for a few of my tests so I marked the question as answered. However, after doing so I decided to play around with the number of degrees I wanted the camera to travel before stopping and soon realized it wasn't working fully. In fact, as the camera orbits around its center, this equation never returns a value larger than $136°$ before it starts to decrease. It certainly never reaches $180°$ - as it should.
Here is a set of real-world numbers I'm working with laid out graphically:
In this real example, the starting point for the camera is at $(-13.145792, 7.98047543)$. There are two points along the circle where I recorded the position as it rotated around the object: $point 1: (-14.6517525, 17.653318)$ and $point 2: (-8.312066, 14.7897005)$. The center point is the object around which I'm rotating. When I apply the aforementioned equation I don't get the results I am expecting. For $point 1$ I expect to get a value somewhere in between $135°$ and $180°$ but instead I get a ridiculous value of $358.600336634706$, which turns out to be $20546.2931677548°$. That's mainly because $x_1$ is $>$ $x_2$ so I'm subtracting the result I get from the $arccos$ from $360$ which is an obvious error in the equation since $arccos$ will return a result in radians and the $360$ is meant to compensate for a result in degrees. If I don't do that I at least get a value $< 360$ but still nowhere near the correct number since I end up with $80.1948322451861°$ which is way too low.
The last thing that I want to mention is that the distance between the position of the camera and the character should always stay the same if I'm rotating along a perfect circle, however, I'm not in control of this because the game engine is rotating my object for me; And one thing I have discovered is that the distance value between points on the circle and the center point is not always the same. In 3 examples I witnessed here are three different measurements I found for $r: 4.9999, 4.95677$ and $5.02961$. Again, I know that's not how circles work :) but I'm not in control of that part of the process. However, given that the difference is very small I am hoping it won't prevent me from solving my problem without having to account for or offset the changing radius.
In case it's helpful, here's some code I'm using to concept this problem out and it's results. In this code I've converted the value I get from $arccos$ to degrees before I subtract the result from 360.
var x2 = -14.6517525;
var x1 = -13.145792;
var y2 = 17.653318;
var y1 = 7.98047543;
var r = 5.37358332;
var c = Math.Sqrt(Math.Pow(x2 - x1, 2) + Math.Pow(y2 - y1, 2));
Console.WriteLine("c = {0}", c);
double theta = Math.Acos((Math.Pow(2*r, 2) - Math.Pow(c, 2))/Math.Pow(2*r, 2));
var degrees = theta * 57.2958;
if (x1 > x2)
{
degrees = 360 - degrees;
}
Console.WriteLine("θ = {0}", theta);
Console.WriteLine("° = {0}", degrees);
And here's the output of the code:
c = 9.7893718088325
θ = 1.39966336529355
° = 279.805167754814
Thank you math wizards for your help on this problem.
circles arc-length
$endgroup$
I've asked this question a couple of times but I haven't been specific enough, I think, to get to the true answer. After spending a couple of weeks trying to get to the answer to this issue I finally have a real example of numbers I'm dealing with and the unexpected results I get using the various proposed mathematical solutions.
I'm building a game. In my game I have a character around which I am rotating a camera. The camera will rotate around the character at a fixed distance from the character. After the object has rotated around the character a variable number of degrees I want the camera to stop rotating. Here' is a visual representation of what I'm doing.
This image shows two circles. The character is at position $(x_3, y_3)$ and the camera rotates around the character along an imaginary circle. $(x_1, y_1)$ is the starting point of the camera and $(x_2, y_2)$ is the current position of the camera. I want to use this information to figure out the length of the red portion of the circle in either radians or degrees.
When I asked this question before (Calculating the distance in degrees between two points on a circle). It was suggested that I use the following process to do this:
Let the radius (distance from centre two two corrdinates) be $r$.
Let the distance from =$(x_1, y_1)$ to $(x_2, y_2)$ be represented by $c$.
$c=sqrt{(x_2-x_1)^2+(y_2-y_1)^2}$
If $x_1 < x_2$ (from Law of Cosines):
$theta=arccosfrac{2r^2-c^2}{2r^2}$
If $x1 > x2$:
$theta=360-arccosfrac{2r^2-c^2}{2r^2}$
In fact I implemented this method and it seemed to work great for a few of my tests so I marked the question as answered. However, after doing so I decided to play around with the number of degrees I wanted the camera to travel before stopping and soon realized it wasn't working fully. In fact, as the camera orbits around its center, this equation never returns a value larger than $136°$ before it starts to decrease. It certainly never reaches $180°$ - as it should.
Here is a set of real-world numbers I'm working with laid out graphically:
In this real example, the starting point for the camera is at $(-13.145792, 7.98047543)$. There are two points along the circle where I recorded the position as it rotated around the object: $point 1: (-14.6517525, 17.653318)$ and $point 2: (-8.312066, 14.7897005)$. The center point is the object around which I'm rotating. When I apply the aforementioned equation I don't get the results I am expecting. For $point 1$ I expect to get a value somewhere in between $135°$ and $180°$ but instead I get a ridiculous value of $358.600336634706$, which turns out to be $20546.2931677548°$. That's mainly because $x_1$ is $>$ $x_2$ so I'm subtracting the result I get from the $arccos$ from $360$ which is an obvious error in the equation since $arccos$ will return a result in radians and the $360$ is meant to compensate for a result in degrees. If I don't do that I at least get a value $< 360$ but still nowhere near the correct number since I end up with $80.1948322451861°$ which is way too low.
The last thing that I want to mention is that the distance between the position of the camera and the character should always stay the same if I'm rotating along a perfect circle, however, I'm not in control of this because the game engine is rotating my object for me; And one thing I have discovered is that the distance value between points on the circle and the center point is not always the same. In 3 examples I witnessed here are three different measurements I found for $r: 4.9999, 4.95677$ and $5.02961$. Again, I know that's not how circles work :) but I'm not in control of that part of the process. However, given that the difference is very small I am hoping it won't prevent me from solving my problem without having to account for or offset the changing radius.
In case it's helpful, here's some code I'm using to concept this problem out and it's results. In this code I've converted the value I get from $arccos$ to degrees before I subtract the result from 360.
var x2 = -14.6517525;
var x1 = -13.145792;
var y2 = 17.653318;
var y1 = 7.98047543;
var r = 5.37358332;
var c = Math.Sqrt(Math.Pow(x2 - x1, 2) + Math.Pow(y2 - y1, 2));
Console.WriteLine("c = {0}", c);
double theta = Math.Acos((Math.Pow(2*r, 2) - Math.Pow(c, 2))/Math.Pow(2*r, 2));
var degrees = theta * 57.2958;
if (x1 > x2)
{
degrees = 360 - degrees;
}
Console.WriteLine("θ = {0}", theta);
Console.WriteLine("° = {0}", degrees);
And here's the output of the code:
c = 9.7893718088325
θ = 1.39966336529355
° = 279.805167754814
Thank you math wizards for your help on this problem.
circles arc-length
circles arc-length
edited Apr 13 '17 at 12:21
Community♦
1
1
asked Jun 11 '16 at 18:39
omataseomatase
106127
106127
$begingroup$
Do you know that, mathematically,arccos
is in radians. So360 -arccos(something)
looks… how would I say… weird. Like mixing oil and vinegar.
$endgroup$
– Bernard
Jun 11 '16 at 18:52
$begingroup$
@Bernard, yeah, that's true, I'll note that in the post. Unfortunately removing that from the equation, or in cases when $x_1 < x_2$ the answer is still not the value I'd expect so it seems like the root of the problem is still somewhere else in the heart of the equation.
$endgroup$
– omatase
Jun 11 '16 at 19:16
$begingroup$
Your equations are missing the information given by the direction of motion, so the first thing to do is to use two equations for clockwise and counterclockwise motions. Then I suggesting to use half angle arctangent to solve the angles as it will give always full circle domain.
$endgroup$
– N74
Jun 11 '16 at 20:43
add a comment |
$begingroup$
Do you know that, mathematically,arccos
is in radians. So360 -arccos(something)
looks… how would I say… weird. Like mixing oil and vinegar.
$endgroup$
– Bernard
Jun 11 '16 at 18:52
$begingroup$
@Bernard, yeah, that's true, I'll note that in the post. Unfortunately removing that from the equation, or in cases when $x_1 < x_2$ the answer is still not the value I'd expect so it seems like the root of the problem is still somewhere else in the heart of the equation.
$endgroup$
– omatase
Jun 11 '16 at 19:16
$begingroup$
Your equations are missing the information given by the direction of motion, so the first thing to do is to use two equations for clockwise and counterclockwise motions. Then I suggesting to use half angle arctangent to solve the angles as it will give always full circle domain.
$endgroup$
– N74
Jun 11 '16 at 20:43
$begingroup$
Do you know that, mathematically,
arccos
is in radians. So 360 -arccos(something)
looks… how would I say… weird. Like mixing oil and vinegar.$endgroup$
– Bernard
Jun 11 '16 at 18:52
$begingroup$
Do you know that, mathematically,
arccos
is in radians. So 360 -arccos(something)
looks… how would I say… weird. Like mixing oil and vinegar.$endgroup$
– Bernard
Jun 11 '16 at 18:52
$begingroup$
@Bernard, yeah, that's true, I'll note that in the post. Unfortunately removing that from the equation, or in cases when $x_1 < x_2$ the answer is still not the value I'd expect so it seems like the root of the problem is still somewhere else in the heart of the equation.
$endgroup$
– omatase
Jun 11 '16 at 19:16
$begingroup$
@Bernard, yeah, that's true, I'll note that in the post. Unfortunately removing that from the equation, or in cases when $x_1 < x_2$ the answer is still not the value I'd expect so it seems like the root of the problem is still somewhere else in the heart of the equation.
$endgroup$
– omatase
Jun 11 '16 at 19:16
$begingroup$
Your equations are missing the information given by the direction of motion, so the first thing to do is to use two equations for clockwise and counterclockwise motions. Then I suggesting to use half angle arctangent to solve the angles as it will give always full circle domain.
$endgroup$
– N74
Jun 11 '16 at 20:43
$begingroup$
Your equations are missing the information given by the direction of motion, so the first thing to do is to use two equations for clockwise and counterclockwise motions. Then I suggesting to use half angle arctangent to solve the angles as it will give always full circle domain.
$endgroup$
– N74
Jun 11 '16 at 20:43
add a comment |
2 Answers
2
active
oldest
votes
$begingroup$
Since you're trying to find the arclength of a circle, use radians. It will make your life easier down the road.
We can simplify the situation by recognizing the triangle is isosceles. Draw a line down the middle of it, bisecting the angle. We can write this:
$$sin(frac{theta}{2}) = frac{c}{2r}$$
Thus, rotating clockwise is given by $theta = 2arcsin(frac{c}{2r})$, and counterclockwise is $theta = 2π-2arcsin(frac{c}{2r})$
EDIT: "if (x1 > x2)" doesn't work for determining counterclockwise to clockwise movement.
Honestly, forget what the original guy said. The best way to do this is through polar coordinates. The angle that a point (x₁, y₁) makes with (x₃, y₃) is given by:
$$θ = arctan(frac{y₁ - y₃}{x₁ - x₃})$$
Where $theta = 0$ is the x-axis. You can find the angle of point 1, and the angle of point 2, and subtract one from the other.
$endgroup$
$begingroup$
Thanks for the response @Kaynex. I'm not having an issue converting between degrees and radians, but the answer I get of $θ = 1.39966336529355$ and $° = 279.805167754814$ just isn't correct. I should have a value between $135 °$ and $180 °$ given the input.
$endgroup$
– omatase
Jun 11 '16 at 19:35
$begingroup$
Thanks for your time @Kaynex. I have tried making use of your formulae but I think I may be misunderstanding how to use them. Can you give me an example with the numbers filled in to find the radians between point1 and point2 ($(-13.145792, 7.98047543)$ and $(-14.6517525, 17.653318)$) and between point1 and point3 ($(-13.145792, 7.98047543)$ and $(-8.312066, 14.7897005)$)? I ask for both because I think I have to do the counter clockwise formula for the latter if I'm not mistaken?
$endgroup$
– omatase
Jun 14 '16 at 5:08
add a comment |
$begingroup$
For point 1 from the bottom point, I find $r=5, c=8.350575, frac {2r^2-c^2}{2r^2}=-0.394642, theta = 113.2^circ$ As your figure is drawn, I believe this is correct. The original line is almost vertical and the line to point 1 is definitely below $45^circ$, so you should not expect an angle greater than $135^circ$.
If I take a new point that is $3$ to the right of center and $4$ above it, so at $(-10.0042,16.978345)$ I get $c^2=90.83116$ and $theta=144.7^circ$, comfortably over $135^circ$. The formula you have is fine.
An alternate approach, which may be easier, is to use the Atan2 function to compute the angles of the radii and subtract them. It deals with quadrants just fine.
$endgroup$
$begingroup$
I don't see how you get $c = 8.350575$. When I do $c=sqrt{(-14.6517525--13.145792)^2+(17.653318-7.98047543)^2}$ I get $c = 9.7893718$. Link here: wolframalpha.com/input/…
$endgroup$
– omatase
Jun 14 '16 at 4:25
$begingroup$
I was doing the bottom point to the rightmost point. But using your $c$ I get $arccos (frac {50-9.789^2}{50})$ as$ 156.4^circ$ per Alpha, well greater than $135^circ$ It matches your drawing well.
$endgroup$
– Ross Millikan
Jun 14 '16 at 5:08
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "69"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
noCode: true, onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmath.stackexchange.com%2fquestions%2f1822387%2fcalculating-distance-between-two-points-on-a-circle-in-either-radians-or-degrees%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
$begingroup$
Since you're trying to find the arclength of a circle, use radians. It will make your life easier down the road.
We can simplify the situation by recognizing the triangle is isosceles. Draw a line down the middle of it, bisecting the angle. We can write this:
$$sin(frac{theta}{2}) = frac{c}{2r}$$
Thus, rotating clockwise is given by $theta = 2arcsin(frac{c}{2r})$, and counterclockwise is $theta = 2π-2arcsin(frac{c}{2r})$
EDIT: "if (x1 > x2)" doesn't work for determining counterclockwise to clockwise movement.
Honestly, forget what the original guy said. The best way to do this is through polar coordinates. The angle that a point (x₁, y₁) makes with (x₃, y₃) is given by:
$$θ = arctan(frac{y₁ - y₃}{x₁ - x₃})$$
Where $theta = 0$ is the x-axis. You can find the angle of point 1, and the angle of point 2, and subtract one from the other.
$endgroup$
$begingroup$
Thanks for the response @Kaynex. I'm not having an issue converting between degrees and radians, but the answer I get of $θ = 1.39966336529355$ and $° = 279.805167754814$ just isn't correct. I should have a value between $135 °$ and $180 °$ given the input.
$endgroup$
– omatase
Jun 11 '16 at 19:35
$begingroup$
Thanks for your time @Kaynex. I have tried making use of your formulae but I think I may be misunderstanding how to use them. Can you give me an example with the numbers filled in to find the radians between point1 and point2 ($(-13.145792, 7.98047543)$ and $(-14.6517525, 17.653318)$) and between point1 and point3 ($(-13.145792, 7.98047543)$ and $(-8.312066, 14.7897005)$)? I ask for both because I think I have to do the counter clockwise formula for the latter if I'm not mistaken?
$endgroup$
– omatase
Jun 14 '16 at 5:08
add a comment |
$begingroup$
Since you're trying to find the arclength of a circle, use radians. It will make your life easier down the road.
We can simplify the situation by recognizing the triangle is isosceles. Draw a line down the middle of it, bisecting the angle. We can write this:
$$sin(frac{theta}{2}) = frac{c}{2r}$$
Thus, rotating clockwise is given by $theta = 2arcsin(frac{c}{2r})$, and counterclockwise is $theta = 2π-2arcsin(frac{c}{2r})$
EDIT: "if (x1 > x2)" doesn't work for determining counterclockwise to clockwise movement.
Honestly, forget what the original guy said. The best way to do this is through polar coordinates. The angle that a point (x₁, y₁) makes with (x₃, y₃) is given by:
$$θ = arctan(frac{y₁ - y₃}{x₁ - x₃})$$
Where $theta = 0$ is the x-axis. You can find the angle of point 1, and the angle of point 2, and subtract one from the other.
$endgroup$
$begingroup$
Thanks for the response @Kaynex. I'm not having an issue converting between degrees and radians, but the answer I get of $θ = 1.39966336529355$ and $° = 279.805167754814$ just isn't correct. I should have a value between $135 °$ and $180 °$ given the input.
$endgroup$
– omatase
Jun 11 '16 at 19:35
$begingroup$
Thanks for your time @Kaynex. I have tried making use of your formulae but I think I may be misunderstanding how to use them. Can you give me an example with the numbers filled in to find the radians between point1 and point2 ($(-13.145792, 7.98047543)$ and $(-14.6517525, 17.653318)$) and between point1 and point3 ($(-13.145792, 7.98047543)$ and $(-8.312066, 14.7897005)$)? I ask for both because I think I have to do the counter clockwise formula for the latter if I'm not mistaken?
$endgroup$
– omatase
Jun 14 '16 at 5:08
add a comment |
$begingroup$
Since you're trying to find the arclength of a circle, use radians. It will make your life easier down the road.
We can simplify the situation by recognizing the triangle is isosceles. Draw a line down the middle of it, bisecting the angle. We can write this:
$$sin(frac{theta}{2}) = frac{c}{2r}$$
Thus, rotating clockwise is given by $theta = 2arcsin(frac{c}{2r})$, and counterclockwise is $theta = 2π-2arcsin(frac{c}{2r})$
EDIT: "if (x1 > x2)" doesn't work for determining counterclockwise to clockwise movement.
Honestly, forget what the original guy said. The best way to do this is through polar coordinates. The angle that a point (x₁, y₁) makes with (x₃, y₃) is given by:
$$θ = arctan(frac{y₁ - y₃}{x₁ - x₃})$$
Where $theta = 0$ is the x-axis. You can find the angle of point 1, and the angle of point 2, and subtract one from the other.
$endgroup$
Since you're trying to find the arclength of a circle, use radians. It will make your life easier down the road.
We can simplify the situation by recognizing the triangle is isosceles. Draw a line down the middle of it, bisecting the angle. We can write this:
$$sin(frac{theta}{2}) = frac{c}{2r}$$
Thus, rotating clockwise is given by $theta = 2arcsin(frac{c}{2r})$, and counterclockwise is $theta = 2π-2arcsin(frac{c}{2r})$
EDIT: "if (x1 > x2)" doesn't work for determining counterclockwise to clockwise movement.
Honestly, forget what the original guy said. The best way to do this is through polar coordinates. The angle that a point (x₁, y₁) makes with (x₃, y₃) is given by:
$$θ = arctan(frac{y₁ - y₃}{x₁ - x₃})$$
Where $theta = 0$ is the x-axis. You can find the angle of point 1, and the angle of point 2, and subtract one from the other.
edited Jun 11 '16 at 19:51
answered Jun 11 '16 at 19:23
KaynexKaynex
2,3401814
2,3401814
$begingroup$
Thanks for the response @Kaynex. I'm not having an issue converting between degrees and radians, but the answer I get of $θ = 1.39966336529355$ and $° = 279.805167754814$ just isn't correct. I should have a value between $135 °$ and $180 °$ given the input.
$endgroup$
– omatase
Jun 11 '16 at 19:35
$begingroup$
Thanks for your time @Kaynex. I have tried making use of your formulae but I think I may be misunderstanding how to use them. Can you give me an example with the numbers filled in to find the radians between point1 and point2 ($(-13.145792, 7.98047543)$ and $(-14.6517525, 17.653318)$) and between point1 and point3 ($(-13.145792, 7.98047543)$ and $(-8.312066, 14.7897005)$)? I ask for both because I think I have to do the counter clockwise formula for the latter if I'm not mistaken?
$endgroup$
– omatase
Jun 14 '16 at 5:08
add a comment |
$begingroup$
Thanks for the response @Kaynex. I'm not having an issue converting between degrees and radians, but the answer I get of $θ = 1.39966336529355$ and $° = 279.805167754814$ just isn't correct. I should have a value between $135 °$ and $180 °$ given the input.
$endgroup$
– omatase
Jun 11 '16 at 19:35
$begingroup$
Thanks for your time @Kaynex. I have tried making use of your formulae but I think I may be misunderstanding how to use them. Can you give me an example with the numbers filled in to find the radians between point1 and point2 ($(-13.145792, 7.98047543)$ and $(-14.6517525, 17.653318)$) and between point1 and point3 ($(-13.145792, 7.98047543)$ and $(-8.312066, 14.7897005)$)? I ask for both because I think I have to do the counter clockwise formula for the latter if I'm not mistaken?
$endgroup$
– omatase
Jun 14 '16 at 5:08
$begingroup$
Thanks for the response @Kaynex. I'm not having an issue converting between degrees and radians, but the answer I get of $θ = 1.39966336529355$ and $° = 279.805167754814$ just isn't correct. I should have a value between $135 °$ and $180 °$ given the input.
$endgroup$
– omatase
Jun 11 '16 at 19:35
$begingroup$
Thanks for the response @Kaynex. I'm not having an issue converting between degrees and radians, but the answer I get of $θ = 1.39966336529355$ and $° = 279.805167754814$ just isn't correct. I should have a value between $135 °$ and $180 °$ given the input.
$endgroup$
– omatase
Jun 11 '16 at 19:35
$begingroup$
Thanks for your time @Kaynex. I have tried making use of your formulae but I think I may be misunderstanding how to use them. Can you give me an example with the numbers filled in to find the radians between point1 and point2 ($(-13.145792, 7.98047543)$ and $(-14.6517525, 17.653318)$) and between point1 and point3 ($(-13.145792, 7.98047543)$ and $(-8.312066, 14.7897005)$)? I ask for both because I think I have to do the counter clockwise formula for the latter if I'm not mistaken?
$endgroup$
– omatase
Jun 14 '16 at 5:08
$begingroup$
Thanks for your time @Kaynex. I have tried making use of your formulae but I think I may be misunderstanding how to use them. Can you give me an example with the numbers filled in to find the radians between point1 and point2 ($(-13.145792, 7.98047543)$ and $(-14.6517525, 17.653318)$) and between point1 and point3 ($(-13.145792, 7.98047543)$ and $(-8.312066, 14.7897005)$)? I ask for both because I think I have to do the counter clockwise formula for the latter if I'm not mistaken?
$endgroup$
– omatase
Jun 14 '16 at 5:08
add a comment |
$begingroup$
For point 1 from the bottom point, I find $r=5, c=8.350575, frac {2r^2-c^2}{2r^2}=-0.394642, theta = 113.2^circ$ As your figure is drawn, I believe this is correct. The original line is almost vertical and the line to point 1 is definitely below $45^circ$, so you should not expect an angle greater than $135^circ$.
If I take a new point that is $3$ to the right of center and $4$ above it, so at $(-10.0042,16.978345)$ I get $c^2=90.83116$ and $theta=144.7^circ$, comfortably over $135^circ$. The formula you have is fine.
An alternate approach, which may be easier, is to use the Atan2 function to compute the angles of the radii and subtract them. It deals with quadrants just fine.
$endgroup$
$begingroup$
I don't see how you get $c = 8.350575$. When I do $c=sqrt{(-14.6517525--13.145792)^2+(17.653318-7.98047543)^2}$ I get $c = 9.7893718$. Link here: wolframalpha.com/input/…
$endgroup$
– omatase
Jun 14 '16 at 4:25
$begingroup$
I was doing the bottom point to the rightmost point. But using your $c$ I get $arccos (frac {50-9.789^2}{50})$ as$ 156.4^circ$ per Alpha, well greater than $135^circ$ It matches your drawing well.
$endgroup$
– Ross Millikan
Jun 14 '16 at 5:08
add a comment |
$begingroup$
For point 1 from the bottom point, I find $r=5, c=8.350575, frac {2r^2-c^2}{2r^2}=-0.394642, theta = 113.2^circ$ As your figure is drawn, I believe this is correct. The original line is almost vertical and the line to point 1 is definitely below $45^circ$, so you should not expect an angle greater than $135^circ$.
If I take a new point that is $3$ to the right of center and $4$ above it, so at $(-10.0042,16.978345)$ I get $c^2=90.83116$ and $theta=144.7^circ$, comfortably over $135^circ$. The formula you have is fine.
An alternate approach, which may be easier, is to use the Atan2 function to compute the angles of the radii and subtract them. It deals with quadrants just fine.
$endgroup$
$begingroup$
I don't see how you get $c = 8.350575$. When I do $c=sqrt{(-14.6517525--13.145792)^2+(17.653318-7.98047543)^2}$ I get $c = 9.7893718$. Link here: wolframalpha.com/input/…
$endgroup$
– omatase
Jun 14 '16 at 4:25
$begingroup$
I was doing the bottom point to the rightmost point. But using your $c$ I get $arccos (frac {50-9.789^2}{50})$ as$ 156.4^circ$ per Alpha, well greater than $135^circ$ It matches your drawing well.
$endgroup$
– Ross Millikan
Jun 14 '16 at 5:08
add a comment |
$begingroup$
For point 1 from the bottom point, I find $r=5, c=8.350575, frac {2r^2-c^2}{2r^2}=-0.394642, theta = 113.2^circ$ As your figure is drawn, I believe this is correct. The original line is almost vertical and the line to point 1 is definitely below $45^circ$, so you should not expect an angle greater than $135^circ$.
If I take a new point that is $3$ to the right of center and $4$ above it, so at $(-10.0042,16.978345)$ I get $c^2=90.83116$ and $theta=144.7^circ$, comfortably over $135^circ$. The formula you have is fine.
An alternate approach, which may be easier, is to use the Atan2 function to compute the angles of the radii and subtract them. It deals with quadrants just fine.
$endgroup$
For point 1 from the bottom point, I find $r=5, c=8.350575, frac {2r^2-c^2}{2r^2}=-0.394642, theta = 113.2^circ$ As your figure is drawn, I believe this is correct. The original line is almost vertical and the line to point 1 is definitely below $45^circ$, so you should not expect an angle greater than $135^circ$.
If I take a new point that is $3$ to the right of center and $4$ above it, so at $(-10.0042,16.978345)$ I get $c^2=90.83116$ and $theta=144.7^circ$, comfortably over $135^circ$. The formula you have is fine.
An alternate approach, which may be easier, is to use the Atan2 function to compute the angles of the radii and subtract them. It deals with quadrants just fine.
answered Jun 11 '16 at 21:08
Ross MillikanRoss Millikan
301k24200375
301k24200375
$begingroup$
I don't see how you get $c = 8.350575$. When I do $c=sqrt{(-14.6517525--13.145792)^2+(17.653318-7.98047543)^2}$ I get $c = 9.7893718$. Link here: wolframalpha.com/input/…
$endgroup$
– omatase
Jun 14 '16 at 4:25
$begingroup$
I was doing the bottom point to the rightmost point. But using your $c$ I get $arccos (frac {50-9.789^2}{50})$ as$ 156.4^circ$ per Alpha, well greater than $135^circ$ It matches your drawing well.
$endgroup$
– Ross Millikan
Jun 14 '16 at 5:08
add a comment |
$begingroup$
I don't see how you get $c = 8.350575$. When I do $c=sqrt{(-14.6517525--13.145792)^2+(17.653318-7.98047543)^2}$ I get $c = 9.7893718$. Link here: wolframalpha.com/input/…
$endgroup$
– omatase
Jun 14 '16 at 4:25
$begingroup$
I was doing the bottom point to the rightmost point. But using your $c$ I get $arccos (frac {50-9.789^2}{50})$ as$ 156.4^circ$ per Alpha, well greater than $135^circ$ It matches your drawing well.
$endgroup$
– Ross Millikan
Jun 14 '16 at 5:08
$begingroup$
I don't see how you get $c = 8.350575$. When I do $c=sqrt{(-14.6517525--13.145792)^2+(17.653318-7.98047543)^2}$ I get $c = 9.7893718$. Link here: wolframalpha.com/input/…
$endgroup$
– omatase
Jun 14 '16 at 4:25
$begingroup$
I don't see how you get $c = 8.350575$. When I do $c=sqrt{(-14.6517525--13.145792)^2+(17.653318-7.98047543)^2}$ I get $c = 9.7893718$. Link here: wolframalpha.com/input/…
$endgroup$
– omatase
Jun 14 '16 at 4:25
$begingroup$
I was doing the bottom point to the rightmost point. But using your $c$ I get $arccos (frac {50-9.789^2}{50})$ as$ 156.4^circ$ per Alpha, well greater than $135^circ$ It matches your drawing well.
$endgroup$
– Ross Millikan
Jun 14 '16 at 5:08
$begingroup$
I was doing the bottom point to the rightmost point. But using your $c$ I get $arccos (frac {50-9.789^2}{50})$ as$ 156.4^circ$ per Alpha, well greater than $135^circ$ It matches your drawing well.
$endgroup$
– Ross Millikan
Jun 14 '16 at 5:08
add a comment |
Thanks for contributing an answer to Mathematics Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
Use MathJax to format equations. MathJax reference.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmath.stackexchange.com%2fquestions%2f1822387%2fcalculating-distance-between-two-points-on-a-circle-in-either-radians-or-degrees%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
$begingroup$
Do you know that, mathematically,
arccos
is in radians. So360 -arccos(something)
looks… how would I say… weird. Like mixing oil and vinegar.$endgroup$
– Bernard
Jun 11 '16 at 18:52
$begingroup$
@Bernard, yeah, that's true, I'll note that in the post. Unfortunately removing that from the equation, or in cases when $x_1 < x_2$ the answer is still not the value I'd expect so it seems like the root of the problem is still somewhere else in the heart of the equation.
$endgroup$
– omatase
Jun 11 '16 at 19:16
$begingroup$
Your equations are missing the information given by the direction of motion, so the first thing to do is to use two equations for clockwise and counterclockwise motions. Then I suggesting to use half angle arctangent to solve the angles as it will give always full circle domain.
$endgroup$
– N74
Jun 11 '16 at 20:43