Add Image::rotate and Mesh::rotate (#1371)
Co-authored-by: Hunter Morgan <hmorgan@bellflight.com>
This commit is contained in:
co-authored by
Hunter Morgan
parent
805539b50d
commit
0a400a5bcc
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user