pub struct CapsuleChain {
pub points: Vec<[f64; 3]>,
pub radius: f64,
}Expand description
A chain of capsule segments forming a rope / chain approximation.
Each consecutive pair of control points defines a capsule segment of the same radius.
Fields§
§points: Vec<[f64; 3]>Control points of the chain (N points → N-1 segments).
radius: f64Uniform radius for all segments.
Implementations§
Source§impl CapsuleChain
impl CapsuleChain
Sourcepub fn with_radius(points: Vec<[f64; 3]>, radius: f64) -> Self
pub fn with_radius(points: Vec<[f64; 3]>, radius: f64) -> Self
Create a chain with a specified radius.
Sourcepub fn segment_count(&self) -> usize
pub fn segment_count(&self) -> usize
Number of capsule segments (one fewer than the number of points).
Sourcepub fn total_length(&self) -> f64
pub fn total_length(&self) -> f64
Total arc length of the chain (sum of segment lengths).
Sourcepub fn contains_point(&self, p: [f64; 3]) -> bool
pub fn contains_point(&self, p: [f64; 3]) -> bool
Returns true if p is inside any capsule segment of the chain.
Sourcepub fn min_distance_to_point(&self, p: [f64; 3]) -> f64
pub fn min_distance_to_point(&self, p: [f64; 3]) -> f64
Minimum distance from p to the chain surface (negative if inside).
Trait Implementations§
Source§impl Clone for CapsuleChain
impl Clone for CapsuleChain
Source§fn clone(&self) -> CapsuleChain
fn clone(&self) -> CapsuleChain
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 CapsuleChain
impl RefUnwindSafe for CapsuleChain
impl Send for CapsuleChain
impl Sync for CapsuleChain
impl Unpin for CapsuleChain
impl UnsafeUnpin for CapsuleChain
impl UnwindSafe for CapsuleChain
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.