pub struct ClassicalParticle {
pub mass: f64,
pub position: Vec<f64>,
pub velocity: Vec<f64>,
}Expand description
A classical point particle in n-dimensional space.
Fields§
§mass: f64Mass of the particle (kg).
position: Vec<f64>Position vector (m).
velocity: Vec<f64>Velocity vector (m/s).
Implementations§
Source§impl ClassicalParticle
impl ClassicalParticle
Sourcepub fn new(mass: f64, dim: usize) -> Self
pub fn new(mass: f64, dim: usize) -> Self
Create a new particle at the origin with zero velocity.
Sourcepub fn kinetic_energy(&self) -> f64
pub fn kinetic_energy(&self) -> f64
Kinetic energy: K = ½ m v².
Sourcepub fn set_position(&mut self, pos: Vec<f64>)
pub fn set_position(&mut self, pos: Vec<f64>)
Set the position vector.
Sourcepub fn set_velocity(&mut self, vel: Vec<f64>)
pub fn set_velocity(&mut self, vel: Vec<f64>)
Set the velocity vector.
Trait Implementations§
Source§impl Clone for ClassicalParticle
impl Clone for ClassicalParticle
Source§fn clone(&self) -> ClassicalParticle
fn clone(&self) -> ClassicalParticle
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 moreAuto Trait Implementations§
impl Freeze for ClassicalParticle
impl RefUnwindSafe for ClassicalParticle
impl Send for ClassicalParticle
impl Sync for ClassicalParticle
impl Unpin for ClassicalParticle
impl UnsafeUnpin for ClassicalParticle
impl UnwindSafe for ClassicalParticle
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