Skip to content

SKETCH-2697 prefer positions with positive coordinates to break ties …#261

Merged
ZontaNicola merged 6 commits intoschrodinger:mainfrom
ZontaNicola:SKETCH-2697
Mar 30, 2026
Merged

SKETCH-2697 prefer positions with positive coordinates to break ties …#261
ZontaNicola merged 6 commits intoschrodinger:mainfrom
ZontaNicola:SKETCH-2697

Conversation

@ZontaNicola
Copy link
Copy Markdown
Contributor

Description

This function looks at the bond directions and picks the biggest white space region around a center, so that we can, for instance, add the chirality labels in there. When there's a tie, (common with three substituents at 120°), instead of picking the first one we come across, we now pick one that has y>0 and x>0. The direction is somewhat arbitrary (although I think we want labels above and to the right whenever possible), but it's important it's the same for every center. This way we avoid clashes where we pick regions on opposite sides for very close centers.

Testing Done

CLAUDE did the maths and added a test

Copy link
Copy Markdown
Member

@JarrettSJohnson JarrettSJohnson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

Comment on lines +130 to +133
best_i = *std::max_element(tied_indices.begin(), tied_indices.end(),
[&score_angle](int a, int b) {
return score_angle(a) < score_angle(b);
});
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

haven't tried, but looks like a good candidate for a projection

best_i = *std::ranges::max_element(tied_indices, {}, score_angle);

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

whoo what kind of magic is that! thanks!

Copy link
Copy Markdown
Collaborator

@cdvonbargen cdvonbargen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you have any example picture of before/after?

@ZontaNicola
Copy link
Copy Markdown
Contributor Author

hmm I'm now thinking that what I have here is not going to work in this case...Screenshot 2026-03-06 at 17 50 22

@ZontaNicola
Copy link
Copy Markdown
Contributor Author

ZontaNicola commented Mar 25, 2026

I had CLAUDE implement Kevin's suggestion and place annotations close to the horizontal position. here's the examples from the case
Screenshot 2026-03-25 at 15 30 39

Copy link
Copy Markdown
Collaborator

@ethan-schrodinger ethan-schrodinger left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice.

Comment thread src/schrodinger/sketcher/molviewer/coord_utils.cpp
@ZontaNicola ZontaNicola added this pull request to the merge queue Mar 30, 2026
Merged via the queue into schrodinger:main with commit 693ef6a Mar 30, 2026
6 checks passed
@ZontaNicola ZontaNicola deleted the SKETCH-2697 branch March 30, 2026 13:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants