Mercurial Hosting > traffic-intelligence
comparison 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 |
comparison
equal
deleted
inserted
replaced
242:942455aff829 | 243:e0988a8ace0c |
---|---|
506 at which the object passes from one side of the segment to the other | 506 at which the object passes from one side of the segment to the other |
507 empty list if there is no crossing''' | 507 empty list if there is no crossing''' |
508 indices = self.positions.getIntersections(p1, p2) | 508 indices = self.positions.getIntersections(p1, p2) |
509 return [t+self.getFirstInstant() for t in indices] | 509 return [t+self.getFirstInstant() for t in indices] |
510 | 510 |
511 def predictPosition(self, instant, deltaT, externalAcceleration = Point(0,0)): | |
512 '''Predicts the position of object at instant+deltaT, | |
513 at constant speed''' | |
514 return self.getPositionAtInstant(instant) + self.getVelocityAtInstant(instant).multiply(deltaT) + externalAcceleration.multiply(deltaT**2) | |
515 | |
511 @staticmethod | 516 @staticmethod |
512 def collisionCourseDotProduct(movingObject1, movingObject2, instant): | 517 def collisionCourseDotProduct(movingObject1, movingObject2, instant): |
513 'A positive result indicates that the road users are getting closer' | 518 'A positive result indicates that the road users are getting closer' |
514 deltap = movingObject1.getPositionAtInstant(instant)-movingObject2.getPositionAtInstant(instant) | 519 deltap = movingObject1.getPositionAtInstant(instant)-movingObject2.getPositionAtInstant(instant) |
515 deltav = movingObject2.getVelocityAtInstant(instant)-movingObject1.getVelocityAtInstant(instant) | 520 deltav = movingObject2.getVelocityAtInstant(instant)-movingObject1.getVelocityAtInstant(instant) |