DiscussWorldIssues - Socio-Economic Religion and Political Uncensored Debate

DiscussWorldIssues - Socio-Economic Religion and Political Uncensored Debate (http://www.discussworldissues.com/forums/index.php)
-   General Discussion (http://www.discussworldissues.com/forums/forumdisplay.php?f=27)
-   -   Equivalence of directions (a programming question) (http://www.discussworldissues.com/forums/showthread.php?t=50083)

Angelinaaiiiiiiiii 12-23-2011 08:58 PM

Equivalence of directions (a programming question)
 
Offhand I'd say that you would probably benefit from using polar coordinates instead of cartesian coordinates, but I haven't used polar coordinates with enough regularity to come up with an algorithm off the top of my head.

maks_holi 12-23-2011 09:41 PM

There's no way to do this without trig

The best way is via polar coords.

consider a direction as an iterative series of actions (turn plus step) on the following triplex: d,a,h

h is heading, d is distance from origin, a is angle of current position from x axis.

I will write out form of iteration when not on phone. Two directions are equivalent if their final triplexes match in d and a (h doesn't matter). Iteration involves law of sines and law of cosines.

paulaglober 12-23-2011 10:25 PM

So the non-trig way to do it with pi/4 turns is a special case, the because the results of trig are rational at every step!?

RaicickKida 12-24-2011 08:11 PM

Quote:

You're building a new bar pickup line? http://www.discussworldissues.com/fo...es/biggrin.gif
I'm happily married, thank you.. http://www.discussworldissues.com/fo...lies/smile.gif


All times are GMT +1. The time now is 07:41 PM.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
Search Engine Friendly URLs by vBSEO 3.6.0 PL2