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

Page tags: library vector
page_revision: 1, last_edited: 1217786850|%e %b %Y, %H:%M %Z (%O ago)
Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License