comparison python/ubc_utils.py @ 25:28e546861263

added Point class and modified trajectory accordingly
author Nicolas Saunier <nico@confins.net>
date Sat, 05 Dec 2009 12:08:25 -0500
parents 9d6831cfe675
children 1a2ac2d4f53a
comparison
equal deleted inserted replaced
24:6fb59cfb201e 25:28e546861263
31 l = lines[0].split(' ') 31 l = lines[0].split(' ')
32 parsedLine = [int(n) for n in l[:4]] 32 parsedLine = [int(n) for n in l[:4]]
33 obj = MovingObject(num = objNum, timeInterval = TimeInterval(parsedLine[1],parsedLine[2])) 33 obj = MovingObject(num = objNum, timeInterval = TimeInterval(parsedLine[1],parsedLine[2]))
34 add = True 34 add = True
35 if (len(lines) >= 3): 35 if (len(lines) >= 3):
36 obj.positions = Trajectory([[float(n) for n in lines[1].split(' ')], 36 obj.positions = Trajectory(lines[1], lines[2])
37 [float(n) for n in lines[2].split(' ')]])
38 if (len(lines) >= 5): 37 if (len(lines) >= 5):
39 obj.velocities = Trajectory([[float(n) for n in lines[3].split(' ')], 38 obj.velocities = Trajectory(lines[3], lines[4])
40 [float(n) for n in lines[4].split(' ')]])
41 39
42 if len(lines) != 2: 40 if len(lines) != 2:
43 objects.append(obj) 41 objects.append(obj)
44 objNum+=1 42 objNum+=1
45 else: 43 else: