You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
What problem does this solve or what need does it fill?
Currently Vec3 provides extend(w) to unproject into homogeneous coordinates (hence Vec4 with euclidean hyperspace w - maybe I missed it, but there is no inverse to extend() or the documentation misses to mention it.
Eigen is using homogeneous() and hnormalized() which is rather meh and it doesn't allow for w=0
Armadillo has a reshape() and resize() but seems quite dated anyway. Numpy has pythonic syntax-sugar to deal with this. GLM only does projection/unprojection through constructors.
So, I guess there is no common agreement. Maybe shrink() or contract() would work.
Still mulling over what to call this. The operation is simple, naming is hard. It seems like this operation is "perspective divide" or "homogeneous divide" or "homogeneous normalization" are common names for this operation. Thus the "hnormalize" in Eigen. Vek calls it "homogenize(d)".
I'm thinking of adding Vec3::from_homogeneous(Vec4) -> Vec3 which performs the divide by w. It would be up to the user to make sure the input was valid (w != 0). Also Vec3::to_homogeneous(self) -> Vec4 which is like Vec3::extend(1.,0). This is what cgmath currently does https://docs.rs/cgmath/latest/cgmath/struct.Point3.html#method.from_homogeneous.
Might also add a Vec4::homogenize() -> Vec4 which returns a Vec4 divided by w.
What problem does this solve or what need does it fill?
Currently
Vec3
providesextend(w)
to unproject into homogeneous coordinates (henceVec4
with euclidean hyperspacew
- maybe I missed it, but there is no inverse toextend()
or the documentation misses to mention it.What solution would you like?
I would prefer to write something like this
transform.translation = view.w_axis.project()
rather than
transform.translation = view.w_axis.xyz() / view.w_axis.w;
My example is now for
Vec4
... same applies to homogeneous representations ofVec2
in vectorspace R3 usingVec3
What alternative(s) have you considered?
Keep writing rather obvious code
This was originally a request in bevy bevyengine/bevy#6916
The text was updated successfully, but these errors were encountered: