-
Notifications
You must be signed in to change notification settings - Fork 157
Add Transform::{look_at_rh, look_at_lh} and deprecate look_at #508
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
Conversation
The Matrix4 and Decomposed |
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.
Thank you for this work! Having a couple of suggestions here
Since this is still open, and we have a chance to clean up the API with this PR a bit. I want to squeeze in a few suggestions:
|
These are interesting ideas, and they seem reasonable at the first glance. @aloucks could you check and see if this resonates with your vision? |
I agree that It's also confusing where some structs have the The |
That's fair, thanks for the detailed response :) I think I get the scope of this PR. Then I'd be happy with just getting the naming of the |
If it's the latter, I don't mind filling in the last renaming changes, or otherwise submitting another PR for that. |
Excellent! It would be great if you want to address the other changes in a separate PR. |
Corresponding functions have been added to Matrix4 and Decomposed and are now consistent. Matrix3, Matrix2, and the Rotation trait are only partially updated.
This makes the Matrix3/4 and Decomposed `look_at_*` functions consistent with looking at a center/focus point and `look_to_*` functions consistent with looking in a direction.
@kvark It looks like the build failure is due to nightly simd. |
Looks like a legitimate test issue on CI:
I wonder if it's caused by #500 but left unnoticed? |
@kvark Yeah, It was caused by #500, but it's still related to the simd implementation (which I didn't realize needed to be updated due to it being nightly only). I don't recall the failed build showing up. Do you remember if it visible before the merge? This kind of begs another question, should the simd impls be removed or otherwise disabled? It was always nightly only and doesn't compile at all on newer versions of rust. |
Honestly, I'd just remove the nightly-only stuff. We have other math crates that can do SIMD on stable, so hardly anyone would want to prefer cgmath for them. The Travis CI has been wonky and not always triggering, hence we missed the breakage. We need to move to GHA ASAP. |
@@ -189,14 +189,27 @@ impl<S: BaseFloat> Matrix3<S> { | |||
|
|||
/// Create a rotation matrix that will cause a vector to point at | |||
/// `dir`, using `up` for orientation. | |||
#[deprecated = "Use Matrix3::look_to_lh"] | |||
pub fn look_at(dir: Vector3<S>, up: Vector3<S>) -> Matrix3<S> { |
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.
since we are about to release a breaking version, let's just kill all the deprecated stuff, perhaps?
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.
I deprecated them for two reasons. 1) As a consumer of a library I always appreciate when items are deprecated for one or two releases before being outright removed, and 2) If a bug is introduced, the the old versions are still there for reference and fallback.
@kvark Agreed. I'll try to get to it this week but no guarantee unfortunately. If someone else has time to remove the nightly simd stuff sooner, that would be great. |
The corresponding functions have been added to Matrix4 and Decomposed and are now consistent.
Matrix3, Matrix2, and the Rotation trait are only partially updated. The
look_at
methods on these should probably be renamed tolook_to_[lh|rh]
as they take a direction vector, not a focus point. Does handedness even make sense for Matrix2?The older functions have all been left in-tact and marked deprecated. I don't think the old functionality should be removed in the near or medium term.