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

Use minimum enclosing circle as selection centre for scale and rotate #29938

Merged
merged 20 commits into from
Sep 27, 2024

Conversation

OliBomby
Copy link
Contributor

@OliBomby OliBomby commented Sep 19, 2024

Closes #29567

Uses Welzl's algorithm to efficiently compute the minimum enclosing circle to use as the centre of selection when doing scale or rotate operations. It's a recursive algorithm with max depth equal to the number of points.

As I also explained in the issue, I think the minimum enclosing circle centre best represents our expectations when considering a selection centre. Also it's able to take into account the shapes of sliders unlike a center of mass calculation (as in stable).

In the issue there is also the idea of visually indicating the centre point while doing the operation, kind of like a gizmo. Do we want this? If so, where in the drawable tree?

Copy link
Collaborator

@bdach bdach left a comment

Choose a reason for hiding this comment

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

I guess no major objections to the choice of algorithm from my side.

osu.Game/Utils/GeometryUtils.cs Outdated Show resolved Hide resolved
osu.Game/Utils/GeometryUtils.cs Outdated Show resolved Hide resolved
osu.Game/Utils/GeometryUtils.cs Outdated Show resolved Hide resolved
osu.Game/Utils/GeometryUtils.cs Outdated Show resolved Hide resolved
osu.Game/Utils/GeometryUtils.cs Outdated Show resolved Hide resolved
osu.Game/Utils/GeometryUtils.cs Outdated Show resolved Hide resolved
@peppy peppy self-requested a review September 27, 2024 06:27
peppy
peppy previously approved these changes Sep 27, 2024
Copy link
Member

@peppy peppy left a comment

Choose a reason for hiding this comment

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

Does what it says it will. Code looks fine.

@bdach bdach self-requested a review September 27, 2024 07:19
@bdach bdach merged commit 3359328 into ppy:master Sep 27, 2024
9 of 13 checks passed
@OliBomby OliBomby deleted the selection-center branch September 27, 2024 08:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Rotation around selection center is not calculated correctly
3 participants