Deducing Distance and Bearing - sh4rkman/SquadCalc GitHub Wiki

⬅️ Previous: Home    •    Next: Deducing Altitude ➡️

Finding Distance

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 :

image
https://en.wikipedia.org/wiki/Euclidean_distance

$d = \sqrt{(x_2 − x_1)^2+(y_2 − y_1)^2}$

Suppose we want to find the distance between :

  • P1: Mortar (x: 400m, y: 800m)
  • P2: Target (x: 1000m, y: 1000m)

$d = \sqrt{(x_2 − x_1)^2+(y_2 − y_1)^2} $
$d = \sqrt{(1000 - 400)²+(1000 - 800)²} $
$d = \sqrt{(600)²+(200)²} $
$d = \sqrt{400 000} $
$d ≃ 632.46m$

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.)


Finding Bearing

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.

image

The angle 𝜃 from P1 to P2 is calculated as follows:
$θ=atan2(Δy,Δx)$

In the same example seen before, we got :
$θ = atan2(Δy,Δx)$
$θ = atan2(200, 600)$
$θ ≃ 0.3218 rad $
$θ ≃ 18.4° $

That's our bearing, halfway done !



⬅️ Previous: Home    •    Next: Deducing Altitude ➡️

⚠️ **GitHub.com Fallback** ⚠️