diff python/moving.py @ 243:e0988a8ace0c

started adapting and moving to other modules Mohamed's work
author Nicolas Saunier <nicolas.saunier@polymtl.ca>
date Mon, 16 Jul 2012 04:57:35 -0400
parents c31722fcc9de
children 5027c174ab90
line wrap: on
line diff
--- a/python/moving.py	Fri Jul 13 17:30:25 2012 -0400
+++ b/python/moving.py	Mon Jul 16 04:57:35 2012 -0400
@@ -508,6 +508,11 @@
         indices = self.positions.getIntersections(p1, p2)
         return [t+self.getFirstInstant() for t in indices]
 
+    def predictPosition(self, instant, deltaT, externalAcceleration = Point(0,0)):
+        '''Predicts the position of object at instant+deltaT, 
+        at constant speed'''
+        return self.getPositionAtInstant(instant) + self.getVelocityAtInstant(instant).multiply(deltaT) + externalAcceleration.multiply(deltaT**2)
+
     @staticmethod
     def collisionCourseDotProduct(movingObject1, movingObject2, instant):
         'A positive result indicates that the road users are getting closer'