fix problem with automatically created nodes
This commit is contained in:
parent
0ccb68b95f
commit
64326207be
1 changed files with 8 additions and 2 deletions
|
@ -37,12 +37,18 @@ class Route:
|
||||||
nodes.append(self.destination_addition)
|
nodes.append(self.destination_addition)
|
||||||
|
|
||||||
if self.origin_xyz is not None:
|
if self.origin_xyz is not None:
|
||||||
origin_distance = np.linalg.norm(self.router.nodes[nodes[0][0]].xyz - self.origin_xyz)
|
node = nodes[0][0]
|
||||||
|
if isinstance(node, int):
|
||||||
|
node = self.router.nodes[node]
|
||||||
|
origin_distance = np.linalg.norm(node.xyz - self.origin_xyz)
|
||||||
else:
|
else:
|
||||||
origin_distance = 0
|
origin_distance = 0
|
||||||
|
|
||||||
if self.destination_xyz is not None:
|
if self.destination_xyz is not None:
|
||||||
destination_distance = np.linalg.norm(self.router.nodes[nodes[-1][0]].xyz - self.destination_xyz)
|
node = nodes[-1][0]
|
||||||
|
if isinstance(node, int):
|
||||||
|
node = self.router.nodes[node]
|
||||||
|
destination_distance = np.linalg.norm(node.xyz - self.destination_xyz)
|
||||||
else:
|
else:
|
||||||
destination_distance = 0
|
destination_distance = 0
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue