Struct Capsule

Source
pub struct Capsule {
    pub a: Point3<f32>,
    pub d: Vector3<f32>,
    pub r: f32,
}
Expand description

A sphere swept along a line.

Capsules are described as all of the spheres that have a center point along their line segment.

A capsule can be constructed from a Moving<Sphere>

Fields§

§a: Point3<f32>

The starting point of the segment sweeping the sphere

§d: Vector3<f32>

When added to a produces the end point of the segment.

§r: f32

Radius of the sphere.

Implementations§

Source§

impl Capsule

Source

pub fn new(segment: Segment, radius: f32) -> Self

Create a new capsule from a segment and a radius.

Trait Implementations§

Source§

impl Add<Vector3<f32>> for Capsule

Source§

type Output = Capsule

The resulting type after applying the + operator.
Source§

fn add(self, v: Vector3<f32>) -> Capsule

Performs the + operation. Read more
Source§

impl AddAssign<Vector3<f32>> for Capsule

Source§

fn add_assign(&mut self, v: Vector3<f32>)

Performs the += operation. Read more
Source§

impl BoundedBy<AABB> for Capsule

Source§

fn bounds(&self) -> AABB

Source§

impl BoundedBy<Sphere> for Capsule

Source§

fn bounds(&self) -> Sphere

Source§

impl Clone for Capsule

Source§

fn clone(&self) -> Capsule

Returns a duplicate of the value. Read more
1.0.0 · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Contacts<Moving<Capsule>> for Capsule

Source§

fn contacts<F: FnMut(Contact)>( &self, capsule: &Moving<Capsule>, callback: F, ) -> bool

Calls the closure for each contact found. Returns true if any contact was found.
Source§

fn last_contact(&self, rhs: &RHS) -> Option<Contact>

Returns the last contact found, if one exists.
Source§

impl Contacts<Moving<Component>> for Capsule

Source§

fn contacts<F: FnMut(Contact)>( &self, rhs: &Moving<Component>, callback: F, ) -> bool

Calls the closure for each contact found. Returns true if any contact was found.
Source§

fn last_contact(&self, rhs: &RHS) -> Option<Contact>

Returns the last contact found, if one exists.
Source§

impl Contacts<Moving<Sphere>> for Capsule

Source§

fn contacts<F: FnMut(Contact)>( &self, sphere: &Moving<Sphere>, callback: F, ) -> bool

Calls the closure for each contact found. Returns true if any contact was found.
Source§

fn last_contact(&self, rhs: &RHS) -> Option<Contact>

Returns the last contact found, if one exists.
Source§

impl Convex for Capsule

Source§

fn support(&self, d: Vector3<f32>) -> Point3<f32>

Returns the point on the object that produces the greatest dot product with the supplied axis. The axis is expected to be normalized.
Source§

impl Debug for Capsule

Source§

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

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

impl<'de> Deserialize<'de> for Capsule

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl From<Capsule> for Component

Source§

fn from(c: Capsule) -> Self

Converts to this type from the input type.
Source§

impl From<Capsule> for Segment

Source§

fn from(c: Capsule) -> Segment

Converts to this type from the input type.
Source§

impl From<Moving<Sphere>> for Capsule

Source§

fn from(m: Moving<Sphere>) -> Self

Converts to this type from the input type.
Source§

impl Inertia for Capsule

Source§

fn tensor(&self, m: f32) -> Matrix3<f32>

Source§

impl Serialize for Capsule

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl Shape for Capsule

Source§

fn center(&self) -> Point3<f32>

Returns the center of mass of the geometry, assuming a regular density.
Source§

fn closest_point(&self, to: Point3<f32>) -> Point3<f32>

Returns the closest point on the shape to the given point.
Source§

fn set_pos(&mut self, p: Point3<f32>)

Sets the center of the shape to p.
Source§

impl Sub<Vector3<f32>> for Capsule

Source§

type Output = Capsule

The resulting type after applying the - operator.
Source§

fn sub(self, v: Vector3<f32>) -> Capsule

Performs the - operation. Read more
Source§

impl SubAssign<Vector3<f32>> for Capsule

Source§

fn sub_assign(&mut self, v: Vector3<f32>)

Performs the -= operation. Read more
Source§

impl Volumetric for Capsule

Source§

fn rotate<R: Rotation3<f32>>(self, r: R) -> Self

Rotate the bound in place. This is useless for spheres.
Source§

fn rotate_about<R: Rotation3<f32>>(self, r: R, p: Point3<f32>) -> Self

Rotates the object around a point.
Source§

impl Copy 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<ShapeA, ShapeB> Contacts<ShapeB> for ShapeA
where ShapeA: Convex + Volumetric, ShapeB: Convex + Volumetric,

Source§

fn contacts<F>(&self, rhs: &ShapeB, callback: F) -> bool
where F: FnMut(Contact),

Calls the closure for each contact found. Returns true if any contact was found.
Source§

fn last_contact(&self, rhs: &RHS) -> Option<Contact>

Returns the last contact found, if one exists.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<P> Intersects<Capsule> for P
where P: Particle,

Source§

fn intersection(&self, cap: &Capsule) -> Option<Intersection>

Returns an Intersection if one exists.
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<Recv, Arg> LocalContacts<Moving<Arg>> for Recv
where Recv: Contacts<Moving<Arg>> + Shape, Arg: Shape + Copy,

Source§

fn local_contacts<F>(&self, rhs: &Moving<Arg>, callback: F) -> bool
where F: FnMut(LocalContact),

Calls the closure for each contact found. Returns true if any contact was found.
Source§

fn last_local_contact(&self, rhs: &RHS) -> Option<LocalContact>

Returns the last contact found, if one exists.
Source§

impl<ShapeA, ShapeB> Penetrates<ShapeB> for ShapeA
where ShapeA: Convex + Volumetric, ShapeB: Convex + Volumetric,

Source§

fn separation(&self, rhs: &ShapeB) -> Option<f32>

Returns the minimum distance between the two object if they are not penetrating.
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.
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,