comparison python/moving.py @ 383:0ce2210790b1

fixed stupid naming bug
author Nicolas Saunier <nicolas.saunier@polymtl.ca>
date Mon, 22 Jul 2013 11:46:35 -0400
parents 387cc0142211
children 31604ef1cad4
comparison
equal deleted inserted replaced
382:ba813f148ade 383:0ce2210790b1
522 522
523 def similarOrientation(self, refDirection, cosineThreshold, minProportion = 0.5): 523 def similarOrientation(self, refDirection, cosineThreshold, minProportion = 0.5):
524 '''Indicates whether the minProportion (<=1.) (eg half) of the trajectory elements (vectors for velocity) 524 '''Indicates whether the minProportion (<=1.) (eg half) of the trajectory elements (vectors for velocity)
525 have a cosine with refDirection is smaller than cosineThreshold''' 525 have a cosine with refDirection is smaller than cosineThreshold'''
526 count = 0 526 count = 0
527 lengthTreshold = float(self.length())*minProportion 527 lengthThreshold = float(self.length())*minProportion
528 for p in self: 528 for p in self:
529 if p.similarOrientation(refDirection, cosineThreshold): 529 if p.similarOrientation(refDirection, cosineThreshold):
530 count += 1 530 count += 1
531 if count > lengthThreshold: 531 if count > lengthThreshold:
532 return True 532 return True