Skip to content

Commit

Permalink
Updating visualization
Browse files Browse the repository at this point in the history
  • Loading branch information
Chad-Peterson committed Apr 18, 2024
1 parent be5c236 commit 18422dc
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion src/yamada/spatial_graphs.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ def __init__(self,
self.adjacent_edge_pairs = self._get_adjacent_edge_pairs()
self.nonadjacent_edge_pairs = [edge_pair for edge_pair in self.edge_pairs if edge_pair not in self.adjacent_edge_pairs]



@staticmethod
def _validate_nodes(nodes: list[str]) -> list[str]:
"""
Expand Down Expand Up @@ -527,6 +529,19 @@ def _validate_node_positions(self,

return node_positions

def get_nonadjacent_edge_pairs_with_a_possible_crossing(self):

edges = self.edges
nodes = self.nodes
node_positions = self.node_positions
node_positions_dict = {node: position for node, position in zip(nodes, node_positions)}
edge_positions = [[node_positions_dict[node] for node in edge] for edge in edges]


nonadjacent_edge_pairs_with_a_possible_crossing = []



def get_edge_vertices_and_or_crossings(self, edge):
"""
Returns a list of the vertices and crossings along a give edge, specifically ordered from -x to +x.
Expand Down Expand Up @@ -1100,6 +1115,7 @@ def get_crossings(self):
crossing_positions = []



# TODO Modify nonadjacent edge pairs that are within some axis aligned bounding box

for line_1, line_2 in self.nonadjacent_edge_pairs:
Expand Down Expand Up @@ -1393,7 +1409,7 @@ def plot(self):

# Plot the crossing positions
# TODO, the out of plane as transparent red spheres, connected by a line...
if self.crossing_positions is not None:
if crossing_positions is not None:
for crossing_position in crossing_positions:
height = np.max(node_positions[:, 1]) - np.min(node_positions[:, 1])
crossing_center = crossing_position #+ np.array([0, height / 2, 0])
Expand Down

0 comments on commit 18422dc

Please sign in to comment.