SKETCH-2697 prefer positions with positive coordinates to break ties …#261
Merged
ZontaNicola merged 6 commits intoschrodinger:mainfrom Mar 30, 2026
Merged
SKETCH-2697 prefer positions with positive coordinates to break ties …#261ZontaNicola merged 6 commits intoschrodinger:mainfrom
ZontaNicola merged 6 commits intoschrodinger:mainfrom
Conversation
…when picking regions in empty space
JarrettSJohnson
approved these changes
Mar 5, 2026
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); | ||
| }); |
Member
There was a problem hiding this comment.
haven't tried, but looks like a good candidate for a projection
best_i = *std::ranges::max_element(tied_indices, {}, score_angle);
Contributor
Author
There was a problem hiding this comment.
whoo what kind of magic is that! thanks!
ethan-schrodinger
approved these changes
Mar 5, 2026
cdvonbargen
approved these changes
Mar 5, 2026
Collaborator
cdvonbargen
left a comment
There was a problem hiding this comment.
Do you have any example picture of before/after?
KevKeating
approved these changes
Mar 5, 2026
Contributor
Author
Contributor
Author
KevKeating
approved these changes
Mar 26, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


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