Deducing Distance and Bearing - sh4rkman/SquadCalc GitHub Wiki
⬅️
Previous: Home
•
Next: Deducing Altitude
➡️
When placing a weapon and a target on the map, squadmaps already know their (x,y) positions in meters on the map, therefore we can deduce the distance between those two points as follow :
https://en.wikipedia.org/wiki/Euclidean_distance
Suppose we want to find the distance between :
- P1: Mortar (x: 400m, y: 800m)
- P2: Target (x: 1000m, y: 1000m)
That target is precisely located 632.5m from the mortar.
(and not 650m like the Squad leader marker you spent the last 2 minutes requesting is telling you.)
To find the angle between two points on a flat plane, given their coordinates, you can use the arctangent function (often denoted as atan2). This function computes the angle of the line connecting the two points with respect to the positive x-axis.
The angle 𝜃 from P1 to P2 is calculated as follows:
In the same example seen before, we got :
That's our bearing, halfway done !
⬅️
Previous: Home
•
Next: Deducing Altitude
➡️