Mercurial Hosting > traffic-intelligence
comparison python/moving.py @ 249:99173da7afae
corrected small bugs and typos
author | Nicolas Saunier <nicolas.saunier@polymtl.ca> |
---|---|
date | Sat, 21 Jul 2012 00:50:42 -0400 |
parents | 571ba5ed22e2 |
children | 59f547aebaac |
comparison
equal
deleted
inserted
replaced
248:571ba5ed22e2 | 249:99173da7afae |
---|---|
229 scatter([p.x for p in points],[p.y for p in points], c=color) | 229 scatter([p.x for p in points],[p.y for p in points], c=color) |
230 | 230 |
231 | 231 |
232 def predictPosition(nTimeSteps, initialPosition, initialVelocity, initialAcceleration = Point(0,0)): | 232 def predictPosition(nTimeSteps, initialPosition, initialVelocity, initialAcceleration = Point(0,0)): |
233 '''Predicts the position in nTimeSteps at constant speed/acceleration''' | 233 '''Predicts the position in nTimeSteps at constant speed/acceleration''' |
234 return initalPosition+velocity.multiply(nTimeSteps) + initialAcceleration.multiply(nTimeSteps**2) | 234 return initialPosition+initialVelocity.multiply(nTimeSteps) + initialAcceleration.multiply(nTimeSteps**2) |
235 | 235 |
236 | 236 |
237 class FlowVector: | 237 class FlowVector: |
238 '''Class to represent 4-D flow vectors, | 238 '''Class to represent 4-D flow vectors, |
239 ie a position and a velocity''' | 239 ie a position and a velocity''' |