move everything from c3nav.routing.graph to c3nav.routing
This commit is contained in:
parent
7b792ace8b
commit
2826e76a0f
7 changed files with 9 additions and 10 deletions
15
src/c3nav/routing/connection.py
Normal file
15
src/c3nav/routing/connection.py
Normal file
|
@ -0,0 +1,15 @@
|
|||
import numpy as np
|
||||
|
||||
|
||||
class GraphConnection():
|
||||
def __init__(self, graph, from_point, to_point, distance=None):
|
||||
self.graph = graph
|
||||
self.from_point = from_point
|
||||
self.to_point = to_point
|
||||
self.distance = distance if distance is not None else np.linalg.norm(from_point.xy - to_point.xy)
|
||||
|
||||
if to_point in from_point.connections:
|
||||
self.graph.connections.remove(from_point.connections[to_point])
|
||||
|
||||
from_point.connections[to_point] = self
|
||||
to_point.connections_in[from_point] = self
|
Loading…
Add table
Add a link
Reference in a new issue