From e833394672b7ee9433b7a8688ad9e02628071aaf Mon Sep 17 00:00:00 2001 From: Taylor Holliday Date: Sat, 9 Sep 2023 22:54:44 -0700 Subject: [PATCH] #13 Add rotate_3d --- src/lib.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/lib.rs b/src/lib.rs index 5ac2641..f020a08 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -846,6 +846,14 @@ impl Vger { } } + /// Rotates the coordinate system (3d version). + pub fn rotate_3d>(&mut self, axis: Vec, theta: f32) { + if let Some(m) = self.tx_stack.last_mut() { + let a: LocalVector3D = axis.into(); + *m = m.pre_rotate(a.x, a.y, a.z, euclid::Angle::::radians(theta)); + } + } + /// Gets the current transform. pub fn current_transform(&self) -> LocalToWorld { *self.tx_stack.last().unwrap()