Mercurial Hosting > traffic-intelligence
comparison python/moving.py @ 114:680d4c82886d
minor change to the point marker
author | Nicolas Saunier <nico@confins.net> |
---|---|
date | Mon, 18 Jul 2011 19:24:06 -0400 |
parents | 606010d1d9a4 |
children | 550556378466 |
comparison
equal
deleted
inserted
replaced
113:606010d1d9a4 | 114:680d4c82886d |
---|---|
133 return Point(self.x-other.x, self.y-other.y) | 133 return Point(self.x-other.x, self.y-other.y) |
134 | 134 |
135 def multiply(self, alpha): | 135 def multiply(self, alpha): |
136 return Point(self.x*alpha, self.y*alpha) | 136 return Point(self.x*alpha, self.y*alpha) |
137 | 137 |
138 def draw(self, options = ''): | 138 def draw(self, options = 'o'): |
139 from matplotlib.pylab import plot | 139 from matplotlib.pylab import plot |
140 plot([self.x], [self.y], 'x'+options) | 140 plot([self.x], [self.y], options) |
141 | 141 |
142 def norm2Squared(self): | 142 def norm2Squared(self): |
143 '''2-norm distance (Euclidean distance)''' | 143 '''2-norm distance (Euclidean distance)''' |
144 return self.x*self.x+self.y*self.y | 144 return self.x*self.x+self.y*self.y |
145 | 145 |