Struct pixel_game_lib::Sphere 
source · pub struct Sphere<P, E> {
    pub center: Vec3<P>,
    pub radius: E,
}Expand description
Re-export vek types. Sphere (3D), represented by center and radius.
Fields§
§center: Vec3<P>§radius: EImplementations§
source§impl<P, E> Sphere<P, E>
 
impl<P, E> Sphere<P, E>
sourcepub fn surface_area(self) -> E
 
pub fn surface_area(self) -> E
Gets this sphere’s surface area.
source§impl<P, E> Sphere<P, E>
 
impl<P, E> Sphere<P, E>
sourcepub fn new(center: Vec3<P>, radius: E) -> Sphere<P, E>
 
pub fn new(center: Vec3<P>, radius: E) -> Sphere<P, E>
Creates a new
Sphere
from center and radius.
sourcepub fn unit(center: Vec3<P>) -> Sphere<P, E>where
    E: One,
 
pub fn unit(center: Vec3<P>) -> Sphere<P, E>where
    E: One,
Creates a new
Sphere
from center and a radius equal to one.
source§impl<T> Sphere<T, T>
 
impl<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: Sphere<T, T>) -> boolwhere
    T: PartialOrd,
 
pub fn collides_with_sphere(self, other: Sphere<T, T>) -> boolwhere
    T: PartialOrd,
Does this shape collide with another ?
sourcepub fn collision_vector_with_sphere(self, other: Sphere<T, T>) -> Vec3<T>
 
pub fn collision_vector_with_sphere(self, other: Sphere<T, T>) -> 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<Sphere<P, E>, <__D as Deserializer<'de>>::Error>where
    __D: Deserializer<'de>,
 
fn deserialize<__D>(
    __deserializer: __D
) -> Result<Sphere<P, E>, <__D as Deserializer<'de>>::Error>where
    __D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
source§impl<P, E> PartialEq for Sphere<P, E>
 
impl<P, E> PartialEq for Sphere<P, E>
source§impl<P, E> Serialize for Sphere<P, E>
 
impl<P, E> Serialize for Sphere<P, E>
source§fn serialize<__S>(
    &self,
    __serializer: __S
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
    __S: Serializer,
 
fn serialize<__S>(
    &self,
    __serializer: __S
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
    __S: Serializer,
Serialize this value into the given Serde serializer. Read more
impl<P, E> Copy for Sphere<P, E>
impl<P, E> Eq for Sphere<P, E>
impl<P, E> StructuralEq for Sphere<P, E>
impl<P, E> StructuralPartialEq for Sphere<P, E>
Auto Trait Implementations§
impl<P, E> RefUnwindSafe for Sphere<P, E>where
    E: RefUnwindSafe,
    P: RefUnwindSafe,
impl<P, E> Send for Sphere<P, E>
impl<P, E> Sync for Sphere<P, E>
impl<P, E> Unpin for Sphere<P, E>
impl<P, E> UnwindSafe for Sphere<P, E>where
    E: UnwindSafe,
    P: UnwindSafe,
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
    T: ?Sized,
 
impl<T> BorrowMut<T> for Twhere
    T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
 
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
source§impl<Q, K> Equivalent<K> for Q
 
impl<Q, K> Equivalent<K> for Q
source§fn equivalent(&self, key: &K) -> bool
 
fn equivalent(&self, key: &K) -> bool
Compare self to 
key and return true if they are equal.§impl<Q, K> Equivalent<K> for Q
 
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
 
fn equivalent(&self, key: &K) -> bool
Checks if this value is equivalent to the given key. Read more