pub struct Sphere<P, E> {
pub center: Vec3<P>,
pub radius: E,
}
Expand description
Sphere (3D), represented by center and radius.
Fields§
§center: Vec3<P>
§radius: E
Implementations§
source§impl<P, E> Sphere<P, E>
impl<P, E> Sphere<P, E>
sourcepub fn surface_area(self) -> Ewhere
E: Copy + One + FloatConst + Add<Output = E> + Mul<Output = E>,
pub fn surface_area(self) -> Ewhere
E: Copy + One + FloatConst + Add<Output = E> + Mul<Output = E>,
Gets this sphere’s surface area.
source§impl<P, E> Sphere<P, E>
impl<P, E> Sphere<P, E>
source§impl<T: Real + Add<T, Output = T>> Sphere<T, T>
impl<T: Real + Add<T, Output = T>> Sphere<T, T>
sourcepub fn contains_point(self, p: Vec3<T>) -> boolwhere
T: PartialOrd,
pub fn contains_point(self, p: Vec3<T>) -> boolwhere
T: PartialOrd,
Does this shape contain the given point ?
sourcepub fn collides_with_sphere(self, other: Self) -> boolwhere
T: PartialOrd,
pub fn collides_with_sphere(self, other: Self) -> boolwhere
T: PartialOrd,
Does this shape collide with another ?
sourcepub fn collision_vector_with_sphere(self, other: Self) -> Vec3<T>
pub fn collision_vector_with_sphere(self, other: Self) -> Vec3<T>
Gets a vector that tells how much this shape penetrates another.
Trait Implementations§
source§impl<'de, P, E> Deserialize<'de> for Sphere<P, E>where
P: Deserialize<'de>,
E: Deserialize<'de>,
impl<'de, P, E> Deserialize<'de> for Sphere<P, E>where
P: Deserialize<'de>,
E: Deserialize<'de>,
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more