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

Allow building non-`Trig` transforms that don't rotate #367

Conversation

@fitzgen
Copy link
Member

fitzgen commented Aug 10, 2019

The Trig trait bound is only required for doing rotations, and also Trig is only implemented for f64 and f32. Putting the Trig trait bound on the main impl for Transform2D methods was a pretty restrictive and applied restrictions more often than was needed.

This commit moves the Trig trait bound to an impl specifically for rotation-related methods of Transform2D, and the result is that we can now scale or translate things represented with i32 or i64 or other non-Trig scalars.


This change is Reviewable

The `Trig` trait bound is only required for doing rotations, and also `Trig` is
only implemented for `f64` and `f32`. Putting the `Trig` trait bound on the main
`impl` for `Transform2D` methods was a pretty restrictive and applied
restrictions more often than was needed.

This commit moves the `Trig` trait bound to an `impl` specifically for
rotation-related methods of `Transform2D`, and the result is that we can now
scale or translate things represented with `i32` or `i64` or other non-`Trig`
scalars.
@fitzgen fitzgen requested a review from nical Aug 10, 2019
@nical
Copy link
Collaborator

nical commented Aug 11, 2019

Neat. @bors-servo r+

@bors-servo
Copy link
Contributor

bors-servo commented Aug 11, 2019

📌 Commit 92a9f16 has been approved by nical

@bors-servo
Copy link
Contributor

bors-servo commented Aug 11, 2019

Testing commit 92a9f16 with merge bd51fba...

bors-servo added a commit that referenced this pull request Aug 11, 2019
…orm-2d-methods, r=nical

Allow building non-`Trig` transforms that don't rotate

The `Trig` trait bound is only required for doing rotations, and also `Trig` is only implemented for `f64` and `f32`. Putting the `Trig` trait bound on the main `impl` for `Transform2D` methods was a pretty restrictive and applied restrictions more often than was needed.

This commit moves the `Trig` trait bound to an `impl` specifically for rotation-related methods of `Transform2D`, and the result is that we can now scale or translate things represented with `i32` or `i64` or other non-`Trig` scalars.

<!-- 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/367)
<!-- Reviewable:end -->
@bors-servo
Copy link
Contributor

bors-servo commented Aug 11, 2019

☀️ Test successful - checks-travis
Approved by: nical
Pushing bd51fba to master...

@bors-servo bors-servo merged commit 92a9f16 into servo:master Aug 11, 2019
2 checks passed
2 checks passed
Travis CI - Pull Request Build Passed
Details
homu Test successful
Details
@fitzgen fitzgen deleted the fitzgen:less-restrictive-trait-bounds-for-transform-2d-methods branch Aug 12, 2019
@fitzgen
Copy link
Member Author

fitzgen commented Aug 12, 2019

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

3 participants
You can’t perform that action at this time.