pub struct Material {
pub name: String,
pub density: f64,
pub friction: f64,
pub restitution: f64,
}Expand description
Physical material properties.
Fields§
§name: StringMaterial name
density: f64Density in kg/m^3
friction: f64Coefficient of friction (0..1)
restitution: f64Coefficient of restitution (bounciness, 0..1)
Implementations§
Source§impl Material
impl Material
Sourcepub fn impedance(&self, speed_of_sound: f64) -> f64
pub fn impedance(&self, speed_of_sound: f64) -> f64
Compute the impedance (density * speed_of_sound).
speed_of_sound - Speed of sound in the material (m/s).
Sourcepub fn is_heavier_than(&self, other: &Material) -> bool
pub fn is_heavier_than(&self, other: &Material) -> bool
Check whether this material is heavier than another.
Sourcepub fn is_bouncier_than(&self, other: &Material) -> bool
pub fn is_bouncier_than(&self, other: &Material) -> bool
Check whether this material is bouncier than another.
Sourcepub fn combine_average(&self, other: &Material) -> Material
pub fn combine_average(&self, other: &Material) -> Material
Combine this material with another using average rules.
Sourcepub fn weight(&self, volume: f64, gravity: f64) -> f64
pub fn weight(&self, volume: f64, gravity: f64) -> f64
Compute the weight of a given volume of this material (density * volume * g).
Sourcepub fn mass_from_volume(&self, volume: f64) -> f64
pub fn mass_from_volume(&self, volume: f64) -> f64
Compute the mass of a given volume of this material.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Material
impl<'de> Deserialize<'de> for Material
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for Material
impl RefUnwindSafe for Material
impl Send for Material
impl Sync for Material
impl Unpin for Material
impl UnsafeUnpin for Material
impl UnwindSafe for Material
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