Skip to content

Angle: add the normalize_zero method#438

Merged
bors[bot] merged 2 commits intorustgd:masterfrom
mathstuf:angle-normalize-zero
Jan 16, 2019
Merged

Angle: add the normalize_zero method#438
bors[bot] merged 2 commits intorustgd:masterfrom
mathstuf:angle-normalize-zero

Conversation

@mathstuf
Copy link
Copy Markdown
Contributor

@mathstuf mathstuf commented Nov 2, 2017

This method is like normalize except that it normalizes to have an
absolute value of no more than turn_div_2.


This is useful for making sure that an angle is no more than some offset from a target angle (e.g., implementing maximum turn rates in games).

@mathstuf mathstuf force-pushed the angle-normalize-zero branch from b967f1e to 162e248 Compare November 2, 2017 15:41
@mathstuf mathstuf force-pushed the angle-normalize-zero branch from 162e248 to ee347a1 Compare February 1, 2018 19:46
Comment thread src/structure.rs Outdated

/// Return the angle, normalized to the range `[-turn_div_2, turn_div_2)`.
#[inline]
fn normalize_zero(self) -> Self {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

everything about this PR looks good to me, but I'm not sure about the name. Would you find normalize_signed to be more descriptive?

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

normalize_to_turn_div_2() maybe ?

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.

Yeah, I'm not the biggest fan of the name as-is either. I personally like normalize_signed more of those options. I'll rebase once there's consensus on a name.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

normalize_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.

normalize_for_diff or normalize_for_offset (possibly without for_ on each).

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I think normalize_signed is most appropriate. @Rhuagh are you strongly opposed?

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

No, I'm just brainstorming

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.

Renamed to normalize_signed.

This method is like `normalize` except that it normalizes to have an
absolute value of no more than `turn_div_2`.
@mathstuf mathstuf force-pushed the angle-normalize-zero branch from ee347a1 to 1b57dc9 Compare January 16, 2019 21:02
@kvark
Copy link
Copy Markdown
Collaborator

kvark commented Jan 16, 2019

bors r+

bors Bot added a commit that referenced this pull request Jan 16, 2019
438: Angle: add the normalize_zero method r=kvark a=mathstuf

This method is like `normalize` except that it normalizes to have an
absolute value of no more than `turn_div_2`.

---
This is useful for making sure that an angle is no more than some offset from a target angle (e.g., implementing maximum turn rates in games).

Co-authored-by: Ben Boeckel <mathstuf@gmail.com>
@bors
Copy link
Copy Markdown
Contributor

bors Bot commented Jan 16, 2019

Build succeeded

@bors bors Bot merged commit 1b57dc9 into rustgd:master Jan 16, 2019
@mathstuf mathstuf deleted the angle-normalize-zero branch January 17, 2019 16:35
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.

3 participants