Mercurial Hosting > traffic-intelligence
comparison python/moving.py @ 785:3aa6102ccc12 dev
addressed issues with ground truth annotations shifted in time
author | Nicolas Saunier <nicolas.saunier@polymtl.ca> |
---|---|
date | Thu, 03 Mar 2016 17:01:30 -0500 |
parents | 7c38250ddfc7 |
children | 21f10332c72b |
comparison
equal
deleted
inserted
replaced
784:30bd0f2223b7 | 785:3aa6102ccc12 |
---|---|
58 return (self.first<=instant and self.last>=instant) | 58 return (self.first<=instant and self.last>=instant) |
59 | 59 |
60 def inside(self, interval2): | 60 def inside(self, interval2): |
61 '''Indicates if the temporal interval of self is comprised in interval2''' | 61 '''Indicates if the temporal interval of self is comprised in interval2''' |
62 return (self.first >= interval2.first) and (self.last <= interval2.last) | 62 return (self.first >= interval2.first) and (self.last <= interval2.last) |
63 | |
64 def shift(self, offset): | |
65 self.first += offset | |
66 self.last += offset | |
63 | 67 |
64 @classmethod | 68 @classmethod |
65 def union(cls, interval1, interval2): | 69 def union(cls, interval1, interval2): |
66 '''Smallest interval comprising self and interval2''' | 70 '''Smallest interval comprising self and interval2''' |
67 return cls(min(interval1.first, interval2.first), max(interval2.last, interval2.last)) | 71 return cls(min(interval1.first, interval2.first), max(interval2.last, interval2.last)) |
171 def existsAtInstant(self, t): | 175 def existsAtInstant(self, t): |
172 return self.timeInterval.contains(t) | 176 return self.timeInterval.contains(t) |
173 | 177 |
174 def commonTimeInterval(self, obj2): | 178 def commonTimeInterval(self, obj2): |
175 return TimeInterval.intersection(self.getTimeInterval(), obj2.getTimeInterval()) | 179 return TimeInterval.intersection(self.getTimeInterval(), obj2.getTimeInterval()) |
180 | |
181 def shiftTimeInterval(self, offset): | |
182 self.timeInterval.shift(offset) | |
176 | 183 |
177 class Point(object): | 184 class Point(object): |
178 def __init__(self, x, y): | 185 def __init__(self, x, y): |
179 self.x = x | 186 self.x = x |
180 self.y = y | 187 self.y = y |