Struct CollisionBody1D
pub struct CollisionBody1D {
pub mass: f64,
pub velocity: f64,
}Expand description
A one-dimensional body with scalar mass and velocity.
Fields§
§mass: f64§velocity: f64Implementations§
§impl CollisionBody1D
impl CollisionBody1D
pub fn new(mass: f64, velocity: f64) -> Option<CollisionBody1D>
pub fn new(mass: f64, velocity: f64) -> Option<CollisionBody1D>
Creates a one-dimensional collision body when mass is non-negative and both values are
finite.
pub fn kinetic_energy(&self) -> Option<f64>
pub fn kinetic_energy(&self) -> Option<f64>
Computes kinetic energy for this body.
§Examples
use use_collision::CollisionBody1D;
let body = CollisionBody1D::new(2.0, 3.0).unwrap();
assert_eq!(body.kinetic_energy(), Some(9.0));Trait Implementations§
§impl Clone for CollisionBody1D
impl Clone for CollisionBody1D
§fn clone(&self) -> CollisionBody1D
fn clone(&self) -> CollisionBody1D
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 CollisionBody1D
impl Debug for CollisionBody1D
§impl PartialEq for CollisionBody1D
impl PartialEq for CollisionBody1D
impl Copy for CollisionBody1D
impl StructuralPartialEq for CollisionBody1D
Auto Trait Implementations§
impl Freeze for CollisionBody1D
impl RefUnwindSafe for CollisionBody1D
impl Send for CollisionBody1D
impl Sync for CollisionBody1D
impl Unpin for CollisionBody1D
impl UnsafeUnpin for CollisionBody1D
impl UnwindSafe for CollisionBody1D
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