Add method Vector.length

This commit is contained in:
David Vierra 2013-01-03 20:58:41 -10:00
parent 86640ec61a
commit b511bb6d3d

4
box.py
View File

@ -1,5 +1,6 @@
from collections import namedtuple
import itertools
import math
_Vector = namedtuple("_Vector", ("x", "y", "z"))
@ -27,6 +28,9 @@ class Vector(_Vector):
__div__ = __truediv__
def length(self):
return math.sqrt(self[0] * self[0] + self[1] * self[1] + self[2] * self[2])
class BoundingBox (object):
type = int