Frage

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?

War es hilfreich?

Lösung

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

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top