Mercurial > hg > nsaunier > traffic-intelligence
comparison python/moving.py @ 987:f026ce2af637
found bug with direct ttc computation
| author | Nicolas Saunier <nicolas.saunier@polymtl.ca> |
|---|---|
| date | Wed, 07 Mar 2018 23:37:00 -0500 |
| parents | 51d8406b2489 |
| children | e8eabef7857c |
comparison
equal
deleted
inserted
replaced
| 986:3be8aaa47651 | 987:f026ce2af637 |
|---|---|
| 315 @staticmethod | 315 @staticmethod |
| 316 def cross(p1, p2): | 316 def cross(p1, p2): |
| 317 'Cross product' | 317 'Cross product' |
| 318 return p1.x*p2.y-p1.y*p2.x | 318 return p1.x*p2.y-p1.y*p2.x |
| 319 | 319 |
| 320 @staticmethod | |
| 321 def parallel(p1, p2): | |
| 322 return Point.cross(p1, p2) == 0. | |
| 323 | |
| 320 @staticmethod | 324 @staticmethod |
| 321 def cosine(p1, p2): | 325 def cosine(p1, p2): |
| 322 return Point.dot(p1,p2)/(p1.norm2()*p2.norm2()) | 326 return Point.dot(p1,p2)/(p1.norm2()*p2.norm2()) |
| 323 | 327 |
| 324 @staticmethod | 328 @staticmethod |
