pub struct GravityParticle {
pub x: Vec3,
pub v: Vec3,
pub f: Vec3,
pub m: f64,
}Expand description
A massive particle subject to gravitational forces.
Fields§
§x: Vec3Position (m).
v: Vec3Velocity (m/s).
f: Vec3Force accumulator (N).
m: f64Mass (kg).
Implementations§
Source§impl GravityParticle
impl GravityParticle
Sourcepub fn reset_force(&mut self)
pub fn reset_force(&mut self)
Reset force accumulator.
Sourcepub fn velocity_verlet_step(&mut self, dt: f64)
pub fn velocity_verlet_step(&mut self, dt: f64)
Integrate using velocity Verlet (kick-drift-kick).
Sourcepub fn velocity_verlet_complete(&mut self, dt: f64)
pub fn velocity_verlet_complete(&mut self, dt: f64)
Complete velocity Verlet after force recomputation.
Sourcepub fn kinetic_energy(&self) -> f64
pub fn kinetic_energy(&self) -> f64
Kinetic energy: 0.5 * m * v².
Trait Implementations§
Source§impl Clone for GravityParticle
impl Clone for GravityParticle
Source§fn clone(&self) -> GravityParticle
fn clone(&self) -> GravityParticle
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 GravityParticle
impl RefUnwindSafe for GravityParticle
impl Send for GravityParticle
impl Sync for GravityParticle
impl Unpin for GravityParticle
impl UnsafeUnpin for GravityParticle
impl UnwindSafe for GravityParticle
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self to the equivalent element of its superset.