team-3/src/c3nav/routing/connection.py

12 lines
347 B
Python
Raw Normal View History

2016-12-05 13:49:23 +01:00
import numpy as np
2016-12-03 19:09:39 +01:00
class GraphConnection():
def __init__(self, from_point, to_point, distance=None):
self.from_point = from_point
self.to_point = to_point
2016-12-08 18:12:07 +01:00
self.distance = distance if distance is not None else abs(np.linalg.norm(from_point.xy - to_point.xy))
2016-12-03 19:09:39 +01:00
def serialize(self):
return (self.distance, )