Skip to content

Commit

Permalink
Merge 865b8d4 into 447720b
Browse files Browse the repository at this point in the history
  • Loading branch information
Nick Gamberini committed Sep 6, 2015
2 parents 447720b + 865b8d4 commit bac9a54
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions spock/vector.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,9 +89,6 @@ def trunc(self):
def __trunc__(self):
return self.__class__(*map(math.trunc, self))

def norm(self):
return math.sqrt(sum(map(lambda a: a * a, self)))

# Utilities

def ifloor(self):
Expand All @@ -114,6 +111,12 @@ def dist_sq(self, other=None):
v = self - other if other else self
return sum(map(lambda a: a * a, v))

def dist(self, other=None):
return math.sqrt(self.dist_sq(other))

def norm(self):
return self / self.dist()

# Truthy evaluation
def __bool__(self):
return any(self)
Expand Down

0 comments on commit bac9a54

Please sign in to comment.