Struct RotatingBody
pub struct RotatingBody {
pub moment_of_inertia: f64,
pub angular_velocity: f64,
}Expand description
A rotating body with scalar moment of inertia and angular velocity.
Fields§
§moment_of_inertia: f64§angular_velocity: f64Implementations§
§impl RotatingBody
impl RotatingBody
pub const fn new(
moment_of_inertia: f64,
angular_velocity: f64,
) -> Option<RotatingBody>
pub const fn new( moment_of_inertia: f64, angular_velocity: f64, ) -> Option<RotatingBody>
Creates a rotating body when moment_of_inertia is non-negative and both values are finite.
pub fn angular_momentum(&self) -> Option<f64>
pub fn angular_momentum(&self) -> Option<f64>
Computes angular momentum using L = Iω.
pub fn rotational_kinetic_energy(&self) -> Option<f64>
pub fn rotational_kinetic_energy(&self) -> Option<f64>
Computes rotational kinetic energy using KE_rot = 0.5 * I * ω².
§Examples
use use_rotation::RotatingBody;
let body = RotatingBody::new(4.0, 5.0).unwrap();
assert_eq!(body.rotational_kinetic_energy(), Some(50.0));pub fn angular_acceleration_from_torque(&self, torque: f64) -> Option<f64>
pub fn angular_acceleration_from_torque(&self, torque: f64) -> Option<f64>
Computes angular acceleration from applied torque using α = τ / I.
Trait Implementations§
§impl Clone for RotatingBody
impl Clone for RotatingBody
§fn clone(&self) -> RotatingBody
fn clone(&self) -> RotatingBody
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read more§impl Debug for RotatingBody
impl Debug for RotatingBody
§impl PartialEq for RotatingBody
impl PartialEq for RotatingBody
impl Copy for RotatingBody
impl StructuralPartialEq for RotatingBody
Auto Trait Implementations§
impl Freeze for RotatingBody
impl RefUnwindSafe for RotatingBody
impl Send for RotatingBody
impl Sync for RotatingBody
impl Unpin for RotatingBody
impl UnsafeUnpin for RotatingBody
impl UnwindSafe for RotatingBody
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more