Skip to content

Commit

Permalink
Merge pull request #241 from dlyongemallo/magic_wand_phase_to_larger_…
Browse files Browse the repository at this point in the history
…sliced_area

Assign phase to spider with larger sliced area when using magic wand.
  • Loading branch information
RazinShaikh committed May 9, 2024
2 parents aae8b09 + d8d173b commit 0afbc3c
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions zxlive/proof_panel.py
Original file line number Diff line number Diff line change
Expand Up @@ -363,10 +363,11 @@ def snap_vector(v: QVector2D) -> None:
avg_left = -avg_right

dist = 0.25 if QVector2D.dotProduct(avg_left, avg_right) != 0 else 0.35
# Put the phase on the left hand side if the mouse direction is further
# away from the average direction of the left neighbours than the right.
# Put the phase on the left hand side if the mouse direction is closer
# to the average direction of the left neighbours than the right, i.e.,
# associate the phase to the larger sliced area.
phase_left = QVector2D.dotProduct(QVector2D(mouse_dir), avg_left) \
<= QVector2D.dotProduct(QVector2D(mouse_dir), avg_right)
>= QVector2D.dotProduct(QVector2D(mouse_dir), avg_right)

new_g = copy.deepcopy(self.graph)
left_vert = new_g.add_vertex(self.graph.type(v),
Expand Down

0 comments on commit 0afbc3c

Please sign in to comment.