Hello there. I've recently happened upon a formula for calculating distance between two points using coordinates:
Distance = |P-E| = |(3,3)-(1,2)| = |(2,1)| = sqrt(22+12) = sqrt(5) = 2.23
("P" and "E" stand for the two points)
I was wondering, if this...
...Gives any significant advantage over simply using DistanceBetweenPoints in JASS? I've always been simply using the function, but if this is the better way...
Distance = |P-E| = |(3,3)-(1,2)| = |(2,1)| = sqrt(22+12) = sqrt(5) = 2.23
("P" and "E" stand for the two points)
I was wondering, if this...
JASS:
local real x
local real y
local real x2
local real y2
local real a
local real b
local real dist
local unit u1 = gg_unit_hkni_0001
local unit u2 = gg_unit_hkni_0002
set x = GetUnitX(u1)
set y = GetUnitY(u1)
set x2 = GetUnitX(u2)
set y2 = GetUnitY(u2)
set a = (x2 - x)
set b = (y2 - y)
set dist = SquareRoot(a*a + b*b)
...Gives any significant advantage over simply using DistanceBetweenPoints in JASS? I've always been simply using the function, but if this is the better way...