1
0
mirror of https://github.com/emilk/egui.git synced 2026-06-27 15:13:12 -04:00

Add Image::rotate and Mesh::rotate (#1371)

Co-authored-by: Hunter Morgan <hmorgan@bellflight.com>
This commit is contained in:
Hunter522
2022-03-22 02:44:23 -05:00
committed by GitHub
parent 805539b50d
commit 0a400a5bcc
3 changed files with 38 additions and 2 deletions

View File

@@ -254,6 +254,15 @@ impl Mesh {
v.pos += delta;
}
}
/// Rotate by some angle about an origin, in-place.
///
/// Origin is a position in screen space.
pub fn rotate(&mut self, rot: Rot2, origin: Pos2) {
for v in &mut self.vertices {
v.pos = origin + rot * (v.pos - origin);
}
}
}
// ----------------------------------------------------------------------------