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
It would be nice to have an extend method on f32: fn extend(self, y: f32) -> Vec2.
Also the Vec2::extend method could take something that impls Into<ExtendRemaining2>, and the f32::extend method could take something that impls Into<ExtendRemaining3>. ExtendRemainingN is a trait that types implement that can fill up the remaining N "slots".
E.g. f32 impls ExtendRemaining2 because it can be appended when there are 2 free "slots". Vec2 also impls ExtendRemaining2 but not Vec3.
E.g. you want to be able to do p.extend(q) when both are Vec2 to create one Vec4.
Or 1f32.extend(p) when p is a Vec2 (to create a Vec3) or when p is a Vec3 (to create a Vec4).
Can you provide a code example of how you would like to use extend on f32? This would require adding a trait and implementation for primitive types, which is not something glam currently does or has any other need for.
For extending to other types, I would be more inclined to add more From conversions, e.g. there are currently:
impl From<(Vec2, f32)> for Vec3
impl From<(Vec3, f32)> for Vec4
I would be OK with continuing this pattern and adding:
impl From<(Vec2, f32, f32)> for Vec4
impl From<(Vec2, Vec2)> for Vec4
Which wouldn't require adding additional traits to glam.
It would be nice to have an
extend
method onf32
:fn extend(self, y: f32) -> Vec2
.Also the
Vec2::extend
method could take something that implsInto<ExtendRemaining2>
, and thef32::extend
method could take something that implsInto<ExtendRemaining3>
.ExtendRemainingN
is a trait that types implement that can fill up the remainingN
"slots".E.g.
f32
implsExtendRemaining2
because it can be appended when there are 2 free "slots".Vec2
also implsExtendRemaining2
but not Vec3.E.g. you want to be able to do
p.extend(q)
when both areVec2
to create oneVec4
.Or
1f32.extend(p)
whenp
is aVec2
(to create aVec3
) or whenp
is aVec3
(to create aVec4
).Related to #109, #110 and #112
The text was updated successfully, but these errors were encountered: