[vec] Fix sqrdist* functions.
This commit is contained in:
parent
99fde174df
commit
9928899df1
4
vec.lua
4
vec.lua
|
@ -148,14 +148,14 @@ end
|
|||
function vec.sqrdist(x1,y1, x2,y2)
|
||||
local dx,dy = x2-x1, y2-y1
|
||||
|
||||
return dx*dx, dy*dy -- vec.sqrlen(dx,dy)
|
||||
return dx*dx + dy*dy -- vec.sqrlen(dx,dy)
|
||||
end
|
||||
|
||||
--- vec.sqrdist() equivalent for 3D vectors.
|
||||
function vec.sqrdist3(x1,y1,z1, x2,y2,z2)
|
||||
local dx,dy,dz = x2-x1, y2-y1, z2-z1
|
||||
|
||||
return dx*dx, dy*dy, dz*dz
|
||||
return dx*dx + dy*dy + dz*dz
|
||||
end
|
||||
|
||||
--- Calculate the distance between two vectors/points.
|
||||
|
|
Loading…
Reference in New Issue