mirror of
https://github.com/emilk/egui.git
synced 2026-06-28 07:23:13 -04:00
Add Vec2::to_pos2
This commit is contained in:
@@ -133,6 +133,13 @@ impl Vec2 {
|
||||
Self { x: v, y: v }
|
||||
}
|
||||
|
||||
/// Treat this vector as a position.
|
||||
/// `v.to_pos2()` is equivalent to `Pos2::default() + v`.
|
||||
#[inline(always)]
|
||||
pub fn to_pos2(self) -> crate::Pos2 {
|
||||
crate::Pos2::new(self.x, self.y)
|
||||
}
|
||||
|
||||
/// Safe normalize: returns zero if input is zero.
|
||||
#[must_use]
|
||||
#[inline(always)]
|
||||
|
||||
Reference in New Issue
Block a user