Mercurial Hosting > traffic-intelligence
comparison python/moving.py @ 659:784298512b60
minor modifications
author | Nicolas Saunier <nicolas.saunier@polymtl.ca> |
---|---|
date | Thu, 14 May 2015 23:18:44 +0200 |
parents | 107f1ad02b69 |
children | 994dd644f6ab |
comparison
equal
deleted
inserted
replaced
658:6668f541b915 | 659:784298512b60 |
---|---|
387 return Point(X,Y) | 387 return Point(X,Y) |
388 | 388 |
389 def getSYfromXY(p, splines, goodEnoughSplineDistance = 0.5): | 389 def getSYfromXY(p, splines, goodEnoughSplineDistance = 0.5): |
390 ''' Snap a point p to it's nearest subsegment of it's nearest spline (from the list splines). A spline is a list of points (class Point), most likely a trajectory. | 390 ''' Snap a point p to it's nearest subsegment of it's nearest spline (from the list splines). A spline is a list of points (class Point), most likely a trajectory. |
391 | 391 |
392 Output: | 392 Output: |
393 ======= | 393 ======= |
394 [spline index, | 394 [spline index, |
395 subsegment leading point index, | 395 subsegment leading point index, |
396 snapped point, | 396 snapped point, |
397 subsegment distance, | 397 subsegment distance, |
398 spline distance, | 398 spline distance, |
399 orthogonal point offset] | 399 orthogonal point offset] |
400 | |
401 or None | |
400 ''' | 402 ''' |
401 minOffsetY = float('inf') | 403 minOffsetY = float('inf') |
402 #For each spline | 404 #For each spline |
403 for spline in range(len(splines)): | 405 for spline in range(len(splines)): |
404 #For each spline point index | 406 #For each spline point index |