changeset 64:c75bcdaed00f

added functions for plotting points
author Nicolas Saunier <nicolas.saunier@polymtl.ca>
date Fri, 05 Nov 2010 11:07:44 -0400
parents 40e8e3bb3702
children 75cf537b8d88
files python/moving.py
diffstat 1 files changed, 8 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/python/moving.py	Fri Nov 05 11:07:31 2010 -0400
+++ b/python/moving.py	Fri Nov 05 11:07:44 2010 -0400
@@ -135,12 +135,18 @@
         '2-norm distance (Euclidean distance)'
         return sqrt(self.norm2Squared())
 
+    def aslist(self):
+        return [self.x, self.y]
+
     @staticmethod
     def distanceNorm2(p1, p2):
         return (p1-p2).norm2()
 
-    def aslist(self):
-        return [self.x, self.y]
+    @staticmethod
+    def plotAll(points, color='r'):
+        from matplotlib.pyplot import scatter
+        scatter([p.x for p in points],[p.y for p in points], c=color)
+
 
 class Trajectory:
     '''Class for trajectories