Capsule

Struct Capsule 

Source
pub struct Capsule {
    pub axis: LineSegment,
    pub radius: f32,
}
Expand description

A cylinder capped with a half-sphere at each end

Fields§

§axis: LineSegment

The central axis of the capsule

§radius: f32

The radius of the capsule

Implementations§

Source§

impl Capsule

Source

pub fn new(a: Point, b: Point, radius: f32) -> Self

Construct a capsule from the end points of the central axis, and a radius

Trait Implementations§

Source§

impl ClosestPoint<Capsule> for Ray

Source§

fn closest_point(&self, other: &Capsule) -> Point

The closest point to another object
Source§

impl ClosestPoint<Ray> for Capsule

Source§

fn closest_point(&self, other: &Ray) -> Point

The closest point to another object
Source§

impl Debug for Capsule

Source§

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

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

impl Distance<Capsule> for Capsule

Source§

fn distance(&self, other: &Capsule) -> f32

The distance between two objects
Source§

impl Distance<Capsule> for Line

Source§

fn distance(&self, other: &Capsule) -> f32

The distance between two objects
Source§

impl Distance<Capsule> for Ray

Source§

fn distance(&self, other: &Capsule) -> f32

The distance between two objects
Source§

impl Distance<Capsule> for Sphere

Source§

fn distance(&self, other: &Capsule) -> f32

The distance between two objects
Source§

impl Distance<Line> for Capsule

Source§

fn distance(&self, other: &Line) -> f32

The distance between two objects
Source§

impl Distance<Point> for Capsule

Source§

fn distance(&self, p: &Point) -> f32

The distance between two objects
Source§

impl Distance<Ray> for Capsule

Source§

fn distance(&self, other: &Ray) -> f32

The distance between two objects
Source§

impl Distance<Sphere> for Capsule

Source§

fn distance(&self, other: &Sphere) -> f32

The distance between two objects
Source§

impl Intersection<Capsule> for Ray

Source§

fn intersects(&self, rhs: &Capsule) -> bool

Whether this shape intersect with the other
Source§

impl Intersection<Ray> for Capsule

Source§

fn intersects(&self, rhs: &Ray) -> bool

Whether this shape intersect with the other

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> 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, 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.