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§
Source§impl RotatingBody
impl RotatingBody
Sourcepub const fn new(moment_of_inertia: f64, angular_velocity: f64) -> Option<Self>
pub const fn new(moment_of_inertia: f64, angular_velocity: f64) -> Option<Self>
Creates a rotating body when moment_of_inertia is non-negative and both values are finite.
Sourcepub fn angular_momentum(&self) -> Option<f64>
pub fn angular_momentum(&self) -> Option<f64>
Computes angular momentum using L = Iω.
Sourcepub 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));Sourcepub 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§
Source§impl Clone for RotatingBody
impl Clone for RotatingBody
Source§fn clone(&self) -> RotatingBody
fn clone(&self) -> RotatingBody
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for RotatingBody
impl Debug for RotatingBody
Source§impl PartialEq for RotatingBody
impl PartialEq for RotatingBody
Source§fn eq(&self, other: &RotatingBody) -> bool
fn eq(&self, other: &RotatingBody) -> bool
Tests for
self and other values to be equal, and is used by ==.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