Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upAngle between a Vector and the x axis. #235
Merged
Conversation
|
r? @kvark |
src/vector.rs
Outdated
| impl<T, U> TypedVector2D<T, U> | ||
| where T: Trig + Copy + Sub<T, Output = T> { | ||
| /// Returns the angle between this vector and the x axis between -PI and PI. | ||
| pub fn angle(&self) -> Radians<T> { |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
nical
Nov 22, 2017
Author
Collaborator
Yep sounds good, if you have suggestions let me know, maybe
x_anglex_axis_angleangle_from_x_axis(a bit long but very explicit) ?
This comment has been minimized.
This comment has been minimized.
kvark
Nov 22, 2017
Member
last one would be my preference. The method involves some math, so it's ok to have the name longer
|
@bors-servo r+ |
|
|
bors-servo
added a commit
that referenced
this pull request
Nov 22, 2017
Angle between a Vector and the x axis. I use this a lot in lyon, and having it in euclid would be much nicer. This PR implements computing the angle between a 2d vector and the x axis using an approximation of atan2. This approximation is faster enough that it made a difference in lyon, so I am very much inclined to use it by default here (or at least use it for f32 vectors). <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/euclid/235) <!-- Reviewable:end -->
|
|
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.
nical commentedNov 22, 2017
•
edited by larsbergstrom
I use this a lot in lyon, and having it in euclid would be much nicer.
This PR implements computing the angle between a 2d vector and the x axis using an approximation of atan2. This approximation is faster enough that it made a difference in lyon, so I am very much inclined to use it by default here (or at least use it for f32 vectors).
This change is