Mercurial > hg > nsaunier > traffic-intelligence
comparison python/moving.py @ 357:e5fe0e6d48a1
corrected bug computing TTC (resp. pPET) if there is no collision point (resp. crossing zone)
| author | Nicolas Saunier <nicolas.saunier@polymtl.ca> |
|---|---|
| date | Thu, 11 Jul 2013 00:07:47 -0400 |
| parents | fa64b2e3a64f |
| children | 619ae9a9a788 |
comparison
equal
deleted
inserted
replaced
| 356:15fac9c45feb | 357:e5fe0e6d48a1 |
|---|---|
| 236 @staticmethod | 236 @staticmethod |
| 237 def distanceNorm2(p1, p2): | 237 def distanceNorm2(p1, p2): |
| 238 return (p1-p2).norm2() | 238 return (p1-p2).norm2() |
| 239 | 239 |
| 240 @staticmethod | 240 @staticmethod |
| 241 def plotAll(points, color='r'): | 241 def plotAll(points, **kwargs): |
| 242 from matplotlib.pyplot import scatter | 242 from matplotlib.pyplot import scatter |
| 243 scatter([p.x for p in points],[p.y for p in points], c=color) | 243 scatter([p.x for p in points],[p.y for p in points], **kwargs) |
| 244 | 244 |
| 245 class NormAngle(object): | 245 class NormAngle(object): |
| 246 '''Alternate encoding of a point, by its norm and orientation''' | 246 '''Alternate encoding of a point, by its norm and orientation''' |
| 247 | 247 |
| 248 def __init__(self, norm, angle): | 248 def __init__(self, norm, angle): |
