yoanlcq / vek

Generic 2D-3D math swiss army knife for game engines, with SIMD support and focus on convenience.
https://docs.rs/vek
Apache License 2.0
282 stars 32 forks source link

Add `From<(Vec2<T>, T)>` for `Vec3<T>`? #71

Closed Imberflur closed 3 years ago

Imberflur commented 3 years ago

Right now this either has to be done by:

Vec3::new(vec2.x, vec2.y, z)

or

Vec3::from(vec2) + Vec3::unit_z() * z

where it could just be

Vec3::from((vec2, z))

And this would be really convenient in creating APIs that take Into<Vec3<T>> since then just (vec2, z) could be passed in instead of having to convert it.

yoanlcq commented 3 years ago

Interesting, PR #70 is a bit related. Although, I understand how what is being asked here is slightly different, and I agree that it would be elegant.

I'll look into this today.

yoanlcq commented 3 years ago

I closed this in a commit, but I still need to wait for CI to greenlight this. When it's OK, I'll publish a new version with this feature.

yoanlcq commented 3 years ago

Version 0.14.1 has been published just now with this feature. Thanks!