This commit is contained in:
Applevangelist
2022-10-21 15:15:51 +02:00
parent 60927e6728
commit 1411309204
2 changed files with 22 additions and 13 deletions

View File

@@ -1062,9 +1062,13 @@ end
-- @return #number Distance between the vectors.
function UTILS.VecDist2D(a, b)
local d = math.huge
if (not a) or (not b) then return d end
local c={x=b.x-a.x, y=b.y-a.y}
local d=math.sqrt(c.x*c.x+c.y*c.y)
d=math.sqrt(c.x*c.x+c.y*c.y)
return d
end
@@ -1075,10 +1079,15 @@ end
-- @param DCS#Vec3 b Vector in 3D with x, y, z components.
-- @return #number Distance between the vectors.
function UTILS.VecDist3D(a, b)
local d = math.huge
if (not a) or (not b) then return d end
local c={x=b.x-a.x, y=b.y-a.y, z=b.z-a.z}
local d=math.sqrt(UTILS.VecDot(c, c))
d=math.sqrt(UTILS.VecDot(c, c))
return d
end