emath: impl From<Vec> for Pos

This commit is contained in:
Varphone Wong
2024-03-11 10:21:58 +08:00
parent 9af6811290
commit cf63d5931d
+16
View File
@@ -90,6 +90,22 @@ impl From<&Pos2> for (f32, f32) {
}
}
// ----------------------------------------------------------------------------
// Compatibility and convenience conversions to and from Vec2:
impl From<Vec2> for Pos2 {
#[inline(always)]
fn from(v: Vec2) -> Self {
Self { x: v.x, y: v.y }
}
}
impl From<&Vec2> for Pos2 {
#[inline(always)]
fn from(v: &Vec2) -> Self {
Self { x: v.x, y: v.y }
}
}
// ----------------------------------------------------------------------------
// Mint compatibility and convenience conversions