Vector Length

''' ---------------
''' Return the length of a 3D vector
''' ---------------
Function VectorLength(v)

VectorLength = Null

Dim dist, x, y, z, x2, y2, z2
x = v(XX) : y = v(YY) : z = v(ZZ)
x2 = x * x : y2 = y * y : z2 = z * z
dist = x2 + y2 + z2

VectorLength = Sqr(dist)

End Function

Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License