comparison python/moving.py @ 587:cf578ba866da

added code to load bounding box corners as trajectories
author Nicolas Saunier <nicolas.saunier@polymtl.ca>
date Thu, 04 Dec 2014 17:46:32 -0500
parents 6ebfb43e938e
children c5406edbcf12
comparison
equal deleted inserted replaced
586:ff4f0ce46ca6 587:cf578ba866da
1274 def collisionCourseCosine(movingObject1, movingObject2, instant): 1274 def collisionCourseCosine(movingObject1, movingObject2, instant):
1275 'A positive result indicates that the road users are getting closer' 1275 'A positive result indicates that the road users are getting closer'
1276 return Point.cosine(movingObject1.getPositionAtInstant(instant)-movingObject2.getPositionAtInstant(instant), #deltap 1276 return Point.cosine(movingObject1.getPositionAtInstant(instant)-movingObject2.getPositionAtInstant(instant), #deltap
1277 movingObject2.getVelocityAtInstant(instant)-movingObject1.getVelocityAtInstant(instant)) #deltav 1277 movingObject2.getVelocityAtInstant(instant)-movingObject1.getVelocityAtInstant(instant)) #deltav
1278 1278
1279
1280 ##################
1281 # Bounding Boxes
1282 ##################
1283
1284 # class BoundingBoxes(STObject):
1285 # '''Class for : a spatio-temporal object
1286 # with a trajectory and a geometry (constant volume over time) and a usertype (e.g. road user) coded as a number (see
1287 # '''
1288
1289 # def __init__(self, num = None, timeInterval = None, positions = None, velocities = None, geometry = None, userType = userType2Num['unknown']):
1290 # super(MovingObject, self).__init__(num, timeInterval)
1291 # self.positions = positions
1292 # self.velocities = velocities
1293 # self.geometry = geometry
1294 # self.userType = userType
1295 # self.features = []
1296 # # compute bounding polygon from trajectory
1297
1279 def plotRoadUsers(objects, colors): 1298 def plotRoadUsers(objects, colors):
1280 '''Colors is a PlottingPropertyValues instance''' 1299 '''Colors is a PlottingPropertyValues instance'''
1281 from matplotlib.pyplot import figure, axis 1300 from matplotlib.pyplot import figure, axis
1282 figure() 1301 figure()
1283 for obj in objects: 1302 for obj in objects: