Angle: add the normalize_zero method#438
Merged
bors[bot] merged 2 commits intorustgd:masterfrom Jan 16, 2019
Merged
Conversation
b967f1e to
162e248
Compare
162e248 to
ee347a1
Compare
kvark
approved these changes
Jan 13, 2019
|
|
||
| /// Return the angle, normalized to the range `[-turn_div_2, turn_div_2)`. | ||
| #[inline] | ||
| fn normalize_zero(self) -> Self { |
Collaborator
There was a problem hiding this comment.
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?
Contributor
Author
There was a problem hiding this comment.
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.
Contributor
Author
There was a problem hiding this comment.
normalize_for_diff or normalize_for_offset (possibly without for_ on each).
Collaborator
There was a problem hiding this comment.
I think normalize_signed is most appropriate. @Rhuagh are you strongly opposed?
Contributor
Author
There was a problem hiding this comment.
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`.
ee347a1 to
1b57dc9
Compare
Collaborator
|
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>
Contributor
Build succeeded |
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.
This method is like
normalizeexcept that it normalizes to have anabsolute 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).