Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Only consider window edges that transitively touch each other #21

Open
Flupp opened this issue Jun 9, 2022 · 0 comments
Open

Only consider window edges that transitively touch each other #21

Flupp opened this issue Jun 9, 2022 · 0 comments

Comments

@Flupp
Copy link
Owner

Flupp commented Jun 9, 2022

There is the following longstanding deficiency:

Currently, not only snapped window edges are considered as connected, but even edges which are only on the same row/column are considered as connected. I have not decided yet if this is a bug or a feature.

A not too inefficient algorithm to find exactly those windows that transitively touch the moved edge might look as follows; we assume a vertical edge is moved:

  • Let W be the set of all windows.
  • Let S = {the resized window}.
  • Let TODO = WS.
  • Let x be the current horizontal position of the moved vertical edge.
  • Let l be the vertical position of the lower edge of the resized window.
  • Let u be the vertical position of the upper edge of the resized window.
  • While TODO ≠ ∅:
    • Choose cTODO.
    • TODO = TODOc.
    • If c has a vertical edge that has horizontal position x and that touches the interval (l, u), then:
      • Let S = S ∪ {c}.
      • Let l = min(l, vertical position of the lower edge of c).
      • Let u = max(u, vertical position of the upper edge of c).
      • Let TODO = WS.
  • Now S should contain exactly those windows that transitively stick to the moved edge.

Runtime presumably is in O(|W|²).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant