1
0
mirror of https://github.com/emilk/egui.git synced 2026-08-30 13:20:05 -04:00

Optimize meshing

This commit is contained in:
Emil Ernerfeldt
2020-05-11 13:11:01 +02:00
parent 6bee26ca59
commit 4fcea59929
8 changed files with 89 additions and 46 deletions

View File

@@ -8,6 +8,7 @@ pub struct Vec2 {
pub y: f32,
}
#[inline(always)]
pub fn vec2(x: f32, y: f32) -> Vec2 {
Vec2 { x, y }
}
@@ -39,6 +40,7 @@ impl Vec2 {
}
}
#[inline(always)]
pub fn rot90(self) -> Self {
vec2(self.y, -self.x)
}
@@ -212,6 +214,13 @@ pub fn pos2(x: f32, y: f32) -> Pos2 {
}
impl Pos2 {
pub fn to_vec2(self) -> Vec2 {
Vec2 {
x: self.x,
y: self.y,
}
}
pub fn dist(self: Self, other: Self) -> f32 {
(self - other).length()
}