pub struct Capsule {
pub a: Vec3,
pub b: Vec3,
pub radius: Real,
}Expand description
A capsule: a line segment swept by a sphere.
Fields§
§a: Vec3First endpoint of the central axis.
b: Vec3Second endpoint of the central axis.
radius: RealRadius of the capsule.
Implementations§
Source§impl Capsule
impl Capsule
Sourcepub fn upright(center: Vec3, half_height: Real, radius: Real) -> Self
pub fn upright(center: Vec3, half_height: Real, radius: Real) -> Self
Create an upright capsule centered at center with given height and radius.
Sourcepub fn sq_dist_point_to_axis(&self, point: &Vec3) -> Real
pub fn sq_dist_point_to_axis(&self, point: &Vec3) -> Real
Squared distance from a point to the capsule’s central axis segment.
Sourcepub fn contains_point(&self, point: &Vec3) -> bool
pub fn contains_point(&self, point: &Vec3) -> bool
Test if a point is inside the capsule.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Capsule
impl RefUnwindSafe for Capsule
impl Send for Capsule
impl Sync for Capsule
impl Unpin for Capsule
impl UnsafeUnpin for Capsule
impl UnwindSafe for Capsule
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.