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

Macro: Rotate attachment point unused #3373

Closed
SashaGraves opened this issue Sep 28, 2023 · 1 comment · Fixed by #3396
Closed

Macro: Rotate attachment point unused #3373

SashaGraves opened this issue Sep 28, 2023 · 1 comment · Fixed by #3396

Comments

@SashaGraves
Copy link
Contributor

SashaGraves commented Sep 28, 2023

Background

Monomer connection point (CP) rotates around the center of the monomer if CP is connected to a bond and the bond changes its position relatively to the monomer. In certain cases rotated CP may partially or fully overlap with another CP. In order to minimize the amount of such cases free connection points should be rearranged around the monomer once such an overlap occurs.

Example of current behaviour:
image

Example of expected behaviour:
image

Solution:

The rules for rearrangement are as follows:

  1. Only free CPs should be rearranged, connected ones should keep their positions.
  2. Free CPs should be rearranged only when CP rotation is finished, no rearrangements while user keeps dragging connected monomer.
  3. There are 8 predefined sectors with center axis at 0 (right), 45, 90 (top), 135, 180 (left), 225, 270 (down) and 315 degrees. Two CPs are considered overlapping if they appear in the same sector, i.e. they overlap or are close enough.
  4. Once rearrangement starts, first priority is to move each free CP to the center of its default sector: R1 - left, R2-right, R3-top, R4-bottom, R5-top-left, R6-top-right, R7-bottom-left, R8-bottom-right.
  5. Free CP can be moved to its default sector if there is no connected CP in this sector, other free CPs are not taken into consideration. If CP cannot be moved to its default connection, it is assigned to a sector on further steps (see below).
  6. Once CPs assignment on default positions is finished, second priority is to keep free CPs at their old positions if no conflicts occurred on previous steps.
  7. Remaining free CPs are distributed across available sectors, where available sector is the one having neither connected nor free CP. The algorithm should search through sectors starting from the one at 0 degrees and moving clockwise.
image
@Nitvex Nitvex added this to the Macromolecules MVP milestone Sep 28, 2023
@Nitvex Nitvex changed the title Rotate attachment point unused Macro: Rotate attachment point unused Oct 13, 2023
Nitvex pushed a commit that referenced this issue Oct 18, 2023
* rotate attachment points unused

* remove snapshots

* add snapshots

* added types after review

* fix type

* fix type issue after merge

* test updated

* snapshots updated

* - in progress

---------

Co-authored-by: Roman Rodionov <roman_rodionov@epam.com>
@MartaWilliams
Copy link
Collaborator

Tested - functionality works correctly, only attachment points are sometimes on different heights/ have different length
image

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

Successfully merging a pull request may close this issue.

4 participants