Question

I am looking for a way to calculate the bearing or azimuth (0-360°) of one drawing point, or pixel, or screen coord, to another.

I currently have the distance portion of it, and with maths not being the favourite subject in my schooling days, I am turning to this for assistance.

I've seen numerous examples of calculating distance and bearing of latitude and longitude, but I only want to calculate screen coordinates. At a later date, I will convert these to Lat/Long.

Screen coordinates originate top/left at (0,0) so I am aware of this. I also need the ability to move the 'origin' with the mouse. This is something that I can already easily do. Part of the question is do I have to convert the points into proper cartesian points (i.e. with negative values of points 'south' and 'west' or 'below' and 'left' of the origin?

Was it helpful?

Solution

it is something like arctan( (x2-x1)/(y2-y1) )

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top