![]() |
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.
|
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. |
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!?
|
Quote:
|
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