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

Gizmos: arc_2d utility helpers #14932

Merged
merged 7 commits into from
Aug 28, 2024

Conversation

RobWalt
Copy link
Contributor

@RobWalt RobWalt commented Aug 26, 2024

Objective

Since #14731 is merged, it unblocked a few utility methods for 2D arcs. In 2D the pendant to long_arc_3d_between and short_arc_3d_between are missing. Since arc_2d can be a bit hard to use, this PR is trying to plug some holes in the arcs API.

Solution

Implement

  • long_arc_2d_between(center, from, tp, color)
  • short_arc_2d_between(center, from, tp, color)

Testing

  • There are new doc tests
  • The 2d_gizmos example has been extended a bit to include a few more arcs which can easily be checked with respect to the grid

Showcase

image

Code related to the screenshot (from outer = first line to inner = last line)

    my_gizmos.arc_2d(Isometry2d::IDENTITY, FRAC_PI_2, 80.0, ORANGE_RED);
    my_gizmos.short_arc_2d_between(Vec2::ZERO, Vec2::X * 40.0, Vec2::Y * 40.0, ORANGE_RED);
    my_gizmos.long_arc_2d_between(Vec2::ZERO, Vec2::X * 20.0, Vec2::Y * 20.0, ORANGE_RED);

@RobWalt RobWalt changed the title Arc 2d utility helper Gizmos: arc_2d utility helpers Aug 26, 2024
@RobWalt RobWalt marked this pull request as ready for review August 26, 2024 20:04
@alice-i-cecile alice-i-cecile added C-Usability A targeted quality-of-life change that makes Bevy easier to use A-Gizmos Visual editor and debug gizmos S-Needs-Review Needs reviewer attention (from anyone!) to move forward labels Aug 26, 2024
Copy link
Contributor

@bushrat011899 bushrat011899 left a comment

Choose a reason for hiding this comment

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

Looks good, excellent documentation!

@alice-i-cecile alice-i-cecile added S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it and removed S-Needs-Review Needs reviewer attention (from anyone!) to move forward labels Aug 28, 2024
@alice-i-cecile alice-i-cecile added this pull request to the merge queue Aug 28, 2024
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to a conflict with the base branch Aug 28, 2024
@alice-i-cecile
Copy link
Member

Merge conflicting with #14676 now, sorry!

@RobWalt RobWalt force-pushed the arc-2d-utility-helper branch from c63d59b to 13dcf5e Compare August 28, 2024 08:07
@RobWalt
Copy link
Contributor Author

RobWalt commented Aug 28, 2024

Merge conflicting with #14676 now, sorry!

No worries, not a problem at all! 💚


Oops just now noticed that the showcase example posted didn't really do what the code said. Updated it now

Before

image

After

image

Code

    my_gizmos.arc_2d(Isometry2d::IDENTITY, FRAC_PI_2, 80.0, ORANGE_RED);
    my_gizmos.short_arc_2d_between(Vec2::ZERO, Vec2::X * 40.0, Vec2::Y * 40.0, ORANGE_RED);
    my_gizmos.long_arc_2d_between(Vec2::ZERO, Vec2::X * 20.0, Vec2::Y * 20.0, ORANGE_RED);

@alice-i-cecile alice-i-cecile added this pull request to the merge queue Aug 28, 2024
Merged via the queue into bevyengine:main with commit 210c79c Aug 28, 2024
26 checks passed
@RobWalt RobWalt deleted the arc-2d-utility-helper branch August 28, 2024 13:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Gizmos Visual editor and debug gizmos C-Usability A targeted quality-of-life change that makes Bevy easier to use S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants