Shortest way to achieve target angle
Clash Royale CLAN TAG#URR8PPP
up vote
1
down vote
favorite
Suppose I am moving in a certain compass bearing (e.g. $270^circ$) and I want to be going in a different direction (e.g. $120^circ$). Is there a formula or series of math operations that I can use to determine which direction I should turn (I want the shorter direction)?
I've tried to increase my angle, i.e. turn counterclockwise, if $texttarget bearing - textcurrent bearing < 360 - (texttarget bearing - textcurrent bearing)$, and it only seems to work in some cases.
Please help! I've been having lots of trouble.
geometry
add a comment |Â
up vote
1
down vote
favorite
Suppose I am moving in a certain compass bearing (e.g. $270^circ$) and I want to be going in a different direction (e.g. $120^circ$). Is there a formula or series of math operations that I can use to determine which direction I should turn (I want the shorter direction)?
I've tried to increase my angle, i.e. turn counterclockwise, if $texttarget bearing - textcurrent bearing < 360 - (texttarget bearing - textcurrent bearing)$, and it only seems to work in some cases.
Please help! I've been having lots of trouble.
geometry
I've edited this as I understand it. If I interpreted your question incorrectly, please change it or let me know.
â davidlowrydudaâ¦
Feb 16 '12 at 18:10
That's correct, thanks. As you might guess, English isn't my mother tongue. :D
â Ruuhkis
Feb 16 '12 at 18:33
add a comment |Â
up vote
1
down vote
favorite
up vote
1
down vote
favorite
Suppose I am moving in a certain compass bearing (e.g. $270^circ$) and I want to be going in a different direction (e.g. $120^circ$). Is there a formula or series of math operations that I can use to determine which direction I should turn (I want the shorter direction)?
I've tried to increase my angle, i.e. turn counterclockwise, if $texttarget bearing - textcurrent bearing < 360 - (texttarget bearing - textcurrent bearing)$, and it only seems to work in some cases.
Please help! I've been having lots of trouble.
geometry
Suppose I am moving in a certain compass bearing (e.g. $270^circ$) and I want to be going in a different direction (e.g. $120^circ$). Is there a formula or series of math operations that I can use to determine which direction I should turn (I want the shorter direction)?
I've tried to increase my angle, i.e. turn counterclockwise, if $texttarget bearing - textcurrent bearing < 360 - (texttarget bearing - textcurrent bearing)$, and it only seems to work in some cases.
Please help! I've been having lots of trouble.
geometry
edited Feb 17 '12 at 4:20
J. M. is not a mathematician
59.9k5146283
59.9k5146283
asked Feb 16 '12 at 18:00
Ruuhkis
1084
1084
I've edited this as I understand it. If I interpreted your question incorrectly, please change it or let me know.
â davidlowrydudaâ¦
Feb 16 '12 at 18:10
That's correct, thanks. As you might guess, English isn't my mother tongue. :D
â Ruuhkis
Feb 16 '12 at 18:33
add a comment |Â
I've edited this as I understand it. If I interpreted your question incorrectly, please change it or let me know.
â davidlowrydudaâ¦
Feb 16 '12 at 18:10
That's correct, thanks. As you might guess, English isn't my mother tongue. :D
â Ruuhkis
Feb 16 '12 at 18:33
I've edited this as I understand it. If I interpreted your question incorrectly, please change it or let me know.
â davidlowrydudaâ¦
Feb 16 '12 at 18:10
I've edited this as I understand it. If I interpreted your question incorrectly, please change it or let me know.
â davidlowrydudaâ¦
Feb 16 '12 at 18:10
That's correct, thanks. As you might guess, English isn't my mother tongue. :D
â Ruuhkis
Feb 16 '12 at 18:33
That's correct, thanks. As you might guess, English isn't my mother tongue. :D
â Ruuhkis
Feb 16 '12 at 18:33
add a comment |Â
3 Answers
3
active
oldest
votes
up vote
6
down vote
accepted
Let $T$ be the target bearing and $C$ be the current bearing. Let's consider three numbers:
$$beginalignalpha&=T-C\
beta&=T-C+360ð\
gamma&=T-C-360ðendalign$$
Now, whichever of $|alpha|$, $|beta|$, and $|gamma|$ is the smallest tells us which of $alpha$, $beta$, and $gamma$ is relevant and if the one with the smallest absolute value is positive, go clockwise, and if it's negative, go counterclockwise.
edit The animation below shows the locations of the target point in red and the current point in blue, for various values of each, with the values of $|alpha|$, $|beta|$, and $|gamma|$ as well as the motion (which is indicated by an arc along the circle) shown in the lower right corner.
This is absolutely best answer one can ever get! Thanks for amazing visualizing too, I am more of visual learner. :) Couldn't thank you enough!
â Ruuhkis
Feb 17 '12 at 7:28
add a comment |Â
up vote
2
down vote
If you're looking for a "one-liner", let $T$ be the target bearing and $C$ be the current bearing:
$$beginaligndelta&=(T-C+540ð)bmod360ð-180ðendalign$$
The shortest rotation distance in degrees is given by $delta$. Positive values indicate clockwise rotation, negative values indicate counterclockwise rotation.
$180ð$ turns are always expressed as counterclockwise $-180ð$.
Awesome, thanks!
â Pasi Matalamäki
Aug 30 at 9:03
add a comment |Â
up vote
0
down vote
Say you're going at bearing $a$ and your target bearing is $b$. I'll assume that both $a$ and $b$ are between zero (inclusive) and 360 (exclusive), and I'll also assume that the direction of increasing bearing is counterclockwise (that's the usual convention in higher math, and I think it's the one you are using). Here are the cases:
If $alt b$, and $b-ale180$, turn counterclockwise.
If $alt b$, and $b-agt180$, turn clockwise.
If $agt b$, and $a-ble180$, turn clockwise.
If $agt b$, and $a-bgt180$, turn counterclockwise.
add a comment |Â
3 Answers
3
active
oldest
votes
3 Answers
3
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
6
down vote
accepted
Let $T$ be the target bearing and $C$ be the current bearing. Let's consider three numbers:
$$beginalignalpha&=T-C\
beta&=T-C+360ð\
gamma&=T-C-360ðendalign$$
Now, whichever of $|alpha|$, $|beta|$, and $|gamma|$ is the smallest tells us which of $alpha$, $beta$, and $gamma$ is relevant and if the one with the smallest absolute value is positive, go clockwise, and if it's negative, go counterclockwise.
edit The animation below shows the locations of the target point in red and the current point in blue, for various values of each, with the values of $|alpha|$, $|beta|$, and $|gamma|$ as well as the motion (which is indicated by an arc along the circle) shown in the lower right corner.
This is absolutely best answer one can ever get! Thanks for amazing visualizing too, I am more of visual learner. :) Couldn't thank you enough!
â Ruuhkis
Feb 17 '12 at 7:28
add a comment |Â
up vote
6
down vote
accepted
Let $T$ be the target bearing and $C$ be the current bearing. Let's consider three numbers:
$$beginalignalpha&=T-C\
beta&=T-C+360ð\
gamma&=T-C-360ðendalign$$
Now, whichever of $|alpha|$, $|beta|$, and $|gamma|$ is the smallest tells us which of $alpha$, $beta$, and $gamma$ is relevant and if the one with the smallest absolute value is positive, go clockwise, and if it's negative, go counterclockwise.
edit The animation below shows the locations of the target point in red and the current point in blue, for various values of each, with the values of $|alpha|$, $|beta|$, and $|gamma|$ as well as the motion (which is indicated by an arc along the circle) shown in the lower right corner.
This is absolutely best answer one can ever get! Thanks for amazing visualizing too, I am more of visual learner. :) Couldn't thank you enough!
â Ruuhkis
Feb 17 '12 at 7:28
add a comment |Â
up vote
6
down vote
accepted
up vote
6
down vote
accepted
Let $T$ be the target bearing and $C$ be the current bearing. Let's consider three numbers:
$$beginalignalpha&=T-C\
beta&=T-C+360ð\
gamma&=T-C-360ðendalign$$
Now, whichever of $|alpha|$, $|beta|$, and $|gamma|$ is the smallest tells us which of $alpha$, $beta$, and $gamma$ is relevant and if the one with the smallest absolute value is positive, go clockwise, and if it's negative, go counterclockwise.
edit The animation below shows the locations of the target point in red and the current point in blue, for various values of each, with the values of $|alpha|$, $|beta|$, and $|gamma|$ as well as the motion (which is indicated by an arc along the circle) shown in the lower right corner.
Let $T$ be the target bearing and $C$ be the current bearing. Let's consider three numbers:
$$beginalignalpha&=T-C\
beta&=T-C+360ð\
gamma&=T-C-360ðendalign$$
Now, whichever of $|alpha|$, $|beta|$, and $|gamma|$ is the smallest tells us which of $alpha$, $beta$, and $gamma$ is relevant and if the one with the smallest absolute value is positive, go clockwise, and if it's negative, go counterclockwise.
edit The animation below shows the locations of the target point in red and the current point in blue, for various values of each, with the values of $|alpha|$, $|beta|$, and $|gamma|$ as well as the motion (which is indicated by an arc along the circle) shown in the lower right corner.
edited Feb 17 '12 at 4:53
answered Feb 17 '12 at 3:30
Isaac
29.6k1185128
29.6k1185128
This is absolutely best answer one can ever get! Thanks for amazing visualizing too, I am more of visual learner. :) Couldn't thank you enough!
â Ruuhkis
Feb 17 '12 at 7:28
add a comment |Â
This is absolutely best answer one can ever get! Thanks for amazing visualizing too, I am more of visual learner. :) Couldn't thank you enough!
â Ruuhkis
Feb 17 '12 at 7:28
This is absolutely best answer one can ever get! Thanks for amazing visualizing too, I am more of visual learner. :) Couldn't thank you enough!
â Ruuhkis
Feb 17 '12 at 7:28
This is absolutely best answer one can ever get! Thanks for amazing visualizing too, I am more of visual learner. :) Couldn't thank you enough!
â Ruuhkis
Feb 17 '12 at 7:28
add a comment |Â
up vote
2
down vote
If you're looking for a "one-liner", let $T$ be the target bearing and $C$ be the current bearing:
$$beginaligndelta&=(T-C+540ð)bmod360ð-180ðendalign$$
The shortest rotation distance in degrees is given by $delta$. Positive values indicate clockwise rotation, negative values indicate counterclockwise rotation.
$180ð$ turns are always expressed as counterclockwise $-180ð$.
Awesome, thanks!
â Pasi Matalamäki
Aug 30 at 9:03
add a comment |Â
up vote
2
down vote
If you're looking for a "one-liner", let $T$ be the target bearing and $C$ be the current bearing:
$$beginaligndelta&=(T-C+540ð)bmod360ð-180ðendalign$$
The shortest rotation distance in degrees is given by $delta$. Positive values indicate clockwise rotation, negative values indicate counterclockwise rotation.
$180ð$ turns are always expressed as counterclockwise $-180ð$.
Awesome, thanks!
â Pasi Matalamäki
Aug 30 at 9:03
add a comment |Â
up vote
2
down vote
up vote
2
down vote
If you're looking for a "one-liner", let $T$ be the target bearing and $C$ be the current bearing:
$$beginaligndelta&=(T-C+540ð)bmod360ð-180ðendalign$$
The shortest rotation distance in degrees is given by $delta$. Positive values indicate clockwise rotation, negative values indicate counterclockwise rotation.
$180ð$ turns are always expressed as counterclockwise $-180ð$.
If you're looking for a "one-liner", let $T$ be the target bearing and $C$ be the current bearing:
$$beginaligndelta&=(T-C+540ð)bmod360ð-180ðendalign$$
The shortest rotation distance in degrees is given by $delta$. Positive values indicate clockwise rotation, negative values indicate counterclockwise rotation.
$180ð$ turns are always expressed as counterclockwise $-180ð$.
answered Aug 29 at 8:48
Unsigned
1213
1213
Awesome, thanks!
â Pasi Matalamäki
Aug 30 at 9:03
add a comment |Â
Awesome, thanks!
â Pasi Matalamäki
Aug 30 at 9:03
Awesome, thanks!
â Pasi Matalamäki
Aug 30 at 9:03
Awesome, thanks!
â Pasi Matalamäki
Aug 30 at 9:03
add a comment |Â
up vote
0
down vote
Say you're going at bearing $a$ and your target bearing is $b$. I'll assume that both $a$ and $b$ are between zero (inclusive) and 360 (exclusive), and I'll also assume that the direction of increasing bearing is counterclockwise (that's the usual convention in higher math, and I think it's the one you are using). Here are the cases:
If $alt b$, and $b-ale180$, turn counterclockwise.
If $alt b$, and $b-agt180$, turn clockwise.
If $agt b$, and $a-ble180$, turn clockwise.
If $agt b$, and $a-bgt180$, turn counterclockwise.
add a comment |Â
up vote
0
down vote
Say you're going at bearing $a$ and your target bearing is $b$. I'll assume that both $a$ and $b$ are between zero (inclusive) and 360 (exclusive), and I'll also assume that the direction of increasing bearing is counterclockwise (that's the usual convention in higher math, and I think it's the one you are using). Here are the cases:
If $alt b$, and $b-ale180$, turn counterclockwise.
If $alt b$, and $b-agt180$, turn clockwise.
If $agt b$, and $a-ble180$, turn clockwise.
If $agt b$, and $a-bgt180$, turn counterclockwise.
add a comment |Â
up vote
0
down vote
up vote
0
down vote
Say you're going at bearing $a$ and your target bearing is $b$. I'll assume that both $a$ and $b$ are between zero (inclusive) and 360 (exclusive), and I'll also assume that the direction of increasing bearing is counterclockwise (that's the usual convention in higher math, and I think it's the one you are using). Here are the cases:
If $alt b$, and $b-ale180$, turn counterclockwise.
If $alt b$, and $b-agt180$, turn clockwise.
If $agt b$, and $a-ble180$, turn clockwise.
If $agt b$, and $a-bgt180$, turn counterclockwise.
Say you're going at bearing $a$ and your target bearing is $b$. I'll assume that both $a$ and $b$ are between zero (inclusive) and 360 (exclusive), and I'll also assume that the direction of increasing bearing is counterclockwise (that's the usual convention in higher math, and I think it's the one you are using). Here are the cases:
If $alt b$, and $b-ale180$, turn counterclockwise.
If $alt b$, and $b-agt180$, turn clockwise.
If $agt b$, and $a-ble180$, turn clockwise.
If $agt b$, and $a-bgt180$, turn counterclockwise.
answered Feb 17 '12 at 3:30
Gerry Myerson
144k8145295
144k8145295
add a comment |Â
add a comment |Â
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
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmath.stackexchange.com%2fquestions%2f110080%2fshortest-way-to-achieve-target-angle%23new-answer', 'question_page');
);
Post as a guest
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
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
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
I've edited this as I understand it. If I interpreted your question incorrectly, please change it or let me know.
â davidlowrydudaâ¦
Feb 16 '12 at 18:10
That's correct, thanks. As you might guess, English isn't my mother tongue. :D
â Ruuhkis
Feb 16 '12 at 18:33