Converting grid ref to heading/bearing
Hi, I'm new, I hope this is the right forum for this!
I am trying to re-create a model I wrote years ago, (lost the source code), One requirement is an algorythm that will calculate the angle, between two points on a plane, from the x,y coordinates of the start and finish; I will be writing in Pascal or Object pascal, but I am NOT asking for code, just the algorythm. However, if you do NOT have the design but do have code, I will be happy to look at that
Thanks,
Jim
Re: Converting grid ref to heading/bearing
I think you have to provide some additional information. Two points make a single line or at least can do so.
Re: Converting grid ref to heading/bearing
Thanks s_m_a ??
You're right! The bearing I am calculating is between the line specified by the two points and the X axis West to East. That axis being zero degrees.
This is dictated by the progarming language that I favour where the 0 / (nought) axis is horizontal, not vertical like we use in normal navigation.
I hope that is clear. Sorry for the obvious omission.
I fear I need a spell checker on this interface!
Thanks and best wishes, Jim
Re: Converting grid ref to heading/bearing
Sounds like the good ol' conversion from cartesian to polar coordinates (which is independent from any programming language anyway).
HTH
Re: Converting grid ref to heading/bearing
Thanks eri523,
I had not come across te cartesian to polor convertion thing but it is allmost exactly what I am doing now with one great difference.
I am NOT calculating the angle as if the start point is at 0.0. If I do that and simple translate the start x,y, it makes my method far neater. Thanks for that.
I think there is another problem with the code which I have not discovered the cause of, I'll be back!
feralipod