Mercurial Hosting > traffic-intelligence
comparison python/moving.py @ 89:f88a19695bba
added inner product
author | Nicolas Saunier <nicolas.saunier@polymtl.ca> |
---|---|
date | Thu, 09 Jun 2011 11:18:44 -0400 |
parents | 41da2cdcd91c |
children | f84293ad4611 |
comparison
equal
deleted
inserted
replaced
88:626560624d55 | 89:f88a19695bba |
---|---|
162 return (counter%2 == 1); | 162 return (counter%2 == 1); |
163 | 163 |
164 | 164 |
165 @staticmethod | 165 @staticmethod |
166 def dot(p1, p2): | 166 def dot(p1, p2): |
167 'Scalar product' | |
167 return p1.x*p2.x+p1.y*p2.y | 168 return p1.x*p2.x+p1.y*p2.y |
169 | |
170 @staticmethod | |
171 def inner(p1, p2): | |
172 'Inner product' | |
173 return p1.x*p2.y-p1.y*p2.x | |
168 | 174 |
169 @staticmethod | 175 @staticmethod |
170 def distanceNorm2(p1, p2): | 176 def distanceNorm2(p1, p2): |
171 return (p1-p2).norm2() | 177 return (p1-p2).norm2() |
172 | 178 |