Mercurial Hosting > traffic-intelligence
comparison python/event.py @ 95:857bcd41e9a2
bug introduced by conversion of interval length to int
author | Nicolas Saunier <nicolas.saunier@polymtl.ca> |
---|---|
date | Mon, 13 Jun 2011 16:46:16 -0400 |
parents | 7da14f07e1f9 |
children | dbe7e53334d7 |
comparison
equal
deleted
inserted
replaced
94:7da14f07e1f9 | 95:857bcd41e9a2 |
---|---|
37 | 37 |
38 def computeIndicators(self): | 38 def computeIndicators(self): |
39 '''Computes the collision course cosine only if the cosine is positive''' | 39 '''Computes the collision course cosine only if the cosine is positive''' |
40 collisionCourseDotProduct = [0]*int(self.timeInterval.length()) | 40 collisionCourseDotProduct = [0]*int(self.timeInterval.length()) |
41 collisionCourseCosine = {} | 41 collisionCourseCosine = {} |
42 distances = [0]*self.timeInterval.length() | 42 distances = [0]*int(self.timeInterval.length()) |
43 for i,instant in enumerate(self.timeInterval): | 43 for i,instant in enumerate(self.timeInterval): |
44 deltap = self.movingObject1.getPositionAtInstant(instant)-self.movingObject2.getPositionAtInstant(instant) | 44 deltap = self.movingObject1.getPositionAtInstant(instant)-self.movingObject2.getPositionAtInstant(instant) |
45 deltav = self.movingObject2.getVelocityAtInstant(instant)-self.movingObject1.getVelocityAtInstant(instant) | 45 deltav = self.movingObject2.getVelocityAtInstant(instant)-self.movingObject1.getVelocityAtInstant(instant) |
46 collisionCourseDotProduct[i] = moving.Point.dot(deltap, deltav) | 46 collisionCourseDotProduct[i] = moving.Point.dot(deltap, deltav) |
47 distances[i] = deltap.norm2() | 47 distances[i] = deltap.norm2() |