Skip to content

Commit

Permalink
#13 Add rotate_3d
Browse files Browse the repository at this point in the history
  • Loading branch information
wtholliday committed Sep 10, 2023
1 parent eefdbd5 commit e833394
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -846,6 +846,14 @@ impl Vger {
}
}

/// Rotates the coordinate system (3d version).
pub fn rotate_3d<Vec: Into<LocalVector3D>>(&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::<f32>::radians(theta));
}
}

/// Gets the current transform.
pub fn current_transform(&self) -> LocalToWorld {
*self.tx_stack.last().unwrap()
Expand Down

0 comments on commit e833394

Please sign in to comment.