pub struct BendingConstraint {
pub v0: usize,
pub v1: usize,
pub v2: usize,
pub v3: usize,
pub rest_angle: f64,
pub stiffness: f64,
}Expand description
A bending constraint connecting four vertices that share a common edge.
The constraint resists deviation from the rest_angle dihedral angle.
Fields§
§v0: usizeFirst wing vertex index.
v1: usizeEdge vertex index (first).
v2: usizeEdge vertex index (second).
v3: usizeSecond wing vertex index.
rest_angle: f64Rest dihedral angle (radians).
stiffness: f64Bending stiffness (N·m/rad).
Implementations§
Source§impl BendingConstraint
impl BendingConstraint
Sourcepub fn new(
v0: usize,
v1: usize,
v2: usize,
v3: usize,
rest_angle: f64,
stiffness: f64,
) -> Self
pub fn new( v0: usize, v1: usize, v2: usize, v3: usize, rest_angle: f64, stiffness: f64, ) -> Self
Create a new bending constraint.
Sourcepub fn compute_force(&self, verts: &[ClothVertex]) -> Vec<[f64; 3]>
pub fn compute_force(&self, verts: &[ClothVertex]) -> Vec<[f64; 3]>
Compute restoring forces on the four vertices.
Returns [f_v0, f_v1, f_v2, f_v3] — one [f64;3] force per vertex.
Trait Implementations§
Source§impl Clone for BendingConstraint
impl Clone for BendingConstraint
Source§fn clone(&self) -> BendingConstraint
fn clone(&self) -> BendingConstraint
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 BendingConstraint
impl RefUnwindSafe for BendingConstraint
impl Send for BendingConstraint
impl Sync for BendingConstraint
impl Unpin for BendingConstraint
impl UnsafeUnpin for BendingConstraint
impl UnwindSafe for BendingConstraint
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<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more