alloy::geometry

Struct Sphere

source
pub struct Sphere { /* private fields */ }
Expand description

A sphere in 3D space.

Implementations§

source§

impl Sphere

source

pub const fn new(center: Point3, radius: f32) -> Self

Create a new sphere

§Parameters
  • center - The center of the sphere
  • radius - The radius of the sphere
source§

impl Sphere

source

pub const fn center(&self) -> &Point3

Get the center of the sphere

source

pub const fn radius(&self) -> f32

Get the radius of the sphere

source§

impl Sphere

source

pub fn distance_to(&self, point: &Point3) -> f32

Get the distance to the nearest point on the sphere to a point

§Parameters
  • point - The point to find the nearest point to

Trait Implementations§

source§

impl Encloses<Point3> for Sphere

source§

fn encloses(&self, point: &Point3) -> bool

Determines if this object encloses another object. Read more
source§

impl Encloses for Sphere

source§

fn encloses(&self, other: &Self) -> bool

Determines if this object encloses another object. Read more
source§

impl Intersects<AABB> for Sphere

source§

fn intersects(&self, other: &AABB) -> bool

Determines if this object intersects with another object. Read more
source§

impl Intersects<Line> for Sphere

source§

fn intersects(&self, other: &Line) -> bool

Determines if this object intersects with another object. Read more
source§

impl Intersects<Sphere> for AABB

source§

fn intersects(&self, other: &Sphere) -> bool

Determines if this object intersects with another object. Read more
source§

impl Intersects<Sphere> for Line

source§

fn intersects(&self, other: &Sphere) -> bool

Determines if this object intersects with another object. Read more
source§

impl Intersects for Sphere

source§

fn intersects(&self, other: &Self) -> bool

Determines if this object intersects with another object. Read more

Auto Trait Implementations§

§

impl Freeze for Sphere

§

impl RefUnwindSafe for Sphere

§

impl Send for Sphere

§

impl Sync for Sphere

§

impl Unpin for Sphere

§

impl UnwindSafe for Sphere

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.