-
Notifications
You must be signed in to change notification settings - Fork 71
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
Fix documentation of cross product; add convenience Vec2 methods #409
Conversation
I managed to get this wrong when I was trying to nail down the sign conventions, and it's been bothering me since I noticed it. The PR adds a couple of simple convenience methods I find myself using quite a bit as I implement stroke expansion. Note that a lot of methods can become const when we bump the MSRV, but that should happen separately.
Two separate entries, one for the fix one for the added methods. Should it be two separate PRs?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Math looks correct. There's a missing link in the changelog and I added a docs suggestion inline.
Should it be two separate PRs?
It could be two PRs, or maybe just update the title to indicate methods are added.
src/vec2.rs
Outdated
/// Combine two vectors interpreted as rotation and scaling. | ||
/// | ||
/// Interpret both vectors as a rotation and a scale, and combine | ||
/// their effects. This operation is equivalent to multiplication | ||
/// when the vectors are interpreted as complex numbers. It is | ||
/// commutative. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It might be worth it to state explicitly that the angles are added, and the magnitudes are multiplied.
Maybe:
/// Combine two vectors interpreted as rotation and scaling. | |
/// | |
/// Interpret both vectors as a rotation and a scale, and combine | |
/// their effects. This operation is equivalent to multiplication | |
/// when the vectors are interpreted as complex numbers. It is | |
/// commutative. | |
/// Combine two vectors interpreted as rotation and scaling. | |
/// | |
/// Interpret both vectors as a rotation and a scale, and combine | |
/// their effects by adding the angles and multiplying the magnitudes. | |
/// This operation is equivalent to multiplication when the vectors | |
/// are interpreted as complex numbers. It is commutative. |
@@ -20,12 +20,17 @@ This release has an [MSRV][] of 1.65. | |||
- `Stroke` is now `PartialEq`, `StrokeOpts` is now `Clone`, `Copy`, `Debug`, `Eq`, `PartialEq`. ([#379][] by [@waywardmonkeys][]) | |||
- Implement `Sum` for `Vec2`. ([#399][] by [@Philipp-M][]) | |||
- Add triangle shape. ([#350][] by [@juliapaci][]) | |||
- Add `Vec2::turn_90` and `Vec2::rotate_scale` methods ([#409] by [@raphlinus][]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The link to #409
is missing at the bottom of the file.
Thanks @tomcur for suggesting the improvement.
I managed to get this wrong when I was trying to nail down the sign conventions, and it's been bothering me since I noticed it.
The PR adds a couple of simple convenience methods I find myself using quite a bit as I implement stroke expansion.
Note that a lot of methods can become const when we bump the MSRV, but that should happen separately.