Mercurial Hosting > traffic-intelligence
diff python/moving.py @ 255:13ec22bec5d4
corrected typos and bugs and added a test
author | Nicolas Saunier <nicolas.saunier@polymtl.ca> |
---|---|
date | Mon, 23 Jul 2012 23:07:19 -0400 |
parents | 59f547aebaac |
children | dc1faa7287bd |
line wrap: on
line diff
--- a/python/moving.py Mon Jul 23 12:35:45 2012 -0400 +++ b/python/moving.py Mon Jul 23 23:07:19 2012 -0400 @@ -245,11 +245,11 @@ def __add__(self, other): 'a norm cannot become negative' - return NormAngle(max(self.norm+other.norm, 0), self.orientation+other.orientation) + return NormAngle(max(self.norm+other.norm, 0), self.angle+other.angle) def getPoint(self): from math import cos, sin - return Point(self.norm*cos(self.orientation), self.norm*sin(self.orientation)) + return Point(self.norm*cos(self.angle), self.norm*sin(self.angle)) def predictPositionNoLimit(nTimeSteps, initialPosition, initialVelocity, initialAcceleration = Point(0,0)): @@ -571,7 +571,7 @@ def predictPosition(self, instant, nTimeSteps, externalAcceleration = Point(0,0)): '''Predicts the position of object at instant+deltaT, at constant speed''' - return predictPosition(nTimeSteps, self.getPositionAtInstant(instant), self.getVelocityAtInstant(instant), externalAcceleration) + return predictPositionNoLimit(nTimeSteps, self.getPositionAtInstant(instant), self.getVelocityAtInstant(instant), externalAcceleration) @staticmethod def collisionCourseDotProduct(movingObject1, movingObject2, instant):