diff python/moving.py @ 105:9844c69d8fa2

added multiply method to Point
author Nicolas Saunier <nico@confins.net>
date Thu, 14 Jul 2011 19:48:30 -0400
parents 13187af8622d
children 916678481896
line wrap: on
line diff
--- a/python/moving.py	Thu Jul 14 17:15:09 2011 -0400
+++ b/python/moving.py	Thu Jul 14 19:48:30 2011 -0400
@@ -131,6 +131,9 @@
     def __sub__(self, other):
         return Point(self.x-other.x, self.y-other.y)
 
+    def multiply(self, alpha):
+        return Point(self.x*alpha, self.y*alpha)
+
     def draw(self, options = ''):
         from matplotlib.pylab import plot
         plot([self.x], [self.y], 'x'+options)