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

Fix documentation of cross product; add convenience Vec2 methods #409

Merged
merged 3 commits into from
Jan 15, 2025

Conversation

raphlinus
Copy link
Contributor

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.

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?
Copy link
Member

@tomcur tomcur left a 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
Comment on lines 336 to 341
/// 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.
Copy link
Member

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:

Suggested change
/// 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][])
Copy link
Member

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.

@raphlinus raphlinus changed the title Fix documentation of cross product Fix documentation of cross product; add convenience Vec2 methods Jan 14, 2025
Thanks @tomcur for suggesting the improvement.
@raphlinus raphlinus added this pull request to the merge queue Jan 15, 2025
Merged via the queue into main with commit d7bb94d Jan 15, 2025
15 checks passed
@raphlinus raphlinus deleted the fix_cross branch January 15, 2025 20:49
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.

2 participants