pub struct CapsuleFrustum {
pub r_bottom: f64,
pub r_top: f64,
pub height: f64,
}Expand description
A capsule-like shape with different radii at each end (a “swept frustum”).
The axis runs along Y from y=0 (radius r_bottom) to y=height (radius r_top).
The radius varies linearly along the axis.
Fields§
§r_bottom: f64Radius at the bottom cap (y=0).
r_top: f64Radius at the top cap (y=height).
height: f64Total height (length of axis segment).
Implementations§
Source§impl CapsuleFrustum
impl CapsuleFrustum
Sourcepub fn radius_at_height(&self, y: f64) -> f64
pub fn radius_at_height(&self, y: f64) -> f64
Interpolated radius at height y (clamped to [0, height]).
Sourcepub fn volume(&self) -> f64
pub fn volume(&self) -> f64
Approximate volume (frustum cone + two hemispheres of different sizes).
Sourcepub fn contains_point(&self, p: [f64; 3]) -> bool
pub fn contains_point(&self, p: [f64; 3]) -> bool
Returns true if point p is inside the frustum.
Trait Implementations§
Source§impl Clone for CapsuleFrustum
impl Clone for CapsuleFrustum
Source§fn clone(&self) -> CapsuleFrustum
fn clone(&self) -> CapsuleFrustum
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 CapsuleFrustum
impl RefUnwindSafe for CapsuleFrustum
impl Send for CapsuleFrustum
impl Sync for CapsuleFrustum
impl Unpin for CapsuleFrustum
impl UnsafeUnpin for CapsuleFrustum
impl UnwindSafe for CapsuleFrustum
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.