Skip to main content

Capsule

Struct Capsule 

Source
pub struct Capsule {
    pub from: [f64; 3],
    pub to: [f64; 3],
    pub radius: f64,
}
Expand description

A capsule: every point within radius of the segment from from to to. A slanted rod, arm or shaft as a part that can hit an obstacle (Machine::collision_capsules), where a box along the scene’s axes around it would be up to its length wider than it. Metres, in scene coordinates.

Fields§

§from: [f64; 3]§to: [f64; 3]§radius: f64

Implementations§

Source§

impl Capsule

Source

pub fn gap_capsule(&self, other: &Capsule) -> f64

The clearance between two capsules (the planning check of the machine’s own parts, Machine::connected_bodies): the distance of the two segments (closest points as Ericson, Real-Time Collision Detection 5.1.9) less both radii. Negative in an overlap, then up to the radii’s sum where the segments cross (a measure of how deep, not the exact depth).

Source

pub fn extent(&self) -> ([f64; 3], [f64; 3])

The least and greatest corner of the box along the scene’s axes around the capsule.

Source

pub fn gap(&self, other: &Aabb) -> ([f64; 3], [f64; 3], f64)

The nearest points of the capsule and the box, one on each, and the clearance between them, as Aabb::gap has them: the least signed distance of the segment’s points to the box, less the radius. Negative in an overlap, where it is the depth to the box face nearest to the segment’s deepest point (both points then on the segment). The signed distance of a point to a box is convex along a line, so its least along the segment is found by a golden-section search, to the last bit of the segment’s parameter: exact, as is the box’s.

Trait Implementations§

Source§

impl Clone for Capsule

Source§

fn clone(&self) -> Capsule

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for Capsule

Source§

impl Debug for Capsule

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl PartialEq for Capsule

Source§

fn eq(&self, other: &Capsule) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl StructuralPartialEq for Capsule

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.