Struct vek::geom::repr_c::Sphere
[−]
[src]
pub struct Sphere<P, E> { pub center: Vec3<P>, pub radius: E, }
Sphere (3D), represented by center and radius.
Fields
center: Vec3<P>
radius: E
Methods
impl<P, E> Sphere<P, E>
[src]
fn surface_area(self) -> E where
E: Copy + One + FloatConst + Add<Output = E> + Mul<Output = E>,
[src]
E: Copy + One + FloatConst + Add<Output = E> + Mul<Output = E>,
Gets this sphere's surface area.
fn volume(self) -> E where
E: Copy + One + FloatConst + Add<Output = E> + Mul<Output = E> + Div<Output = E>,
[src]
E: Copy + One + FloatConst + Add<Output = E> + Mul<Output = E> + Div<Output = E>,
Gets this sphere's volume.
impl<P, E> Sphere<P, E>
[src]
fn new(center: Vec3<P>, radius: E) -> Self
[src]
Creates a new
from center
and radius
.
fn unit(center: Vec3<P>) -> Self where
E: One,
[src]
E: One,
Creates a new
from center
and a radius
equal to one.
fn point(center: Vec3<P>) -> Self where
E: Zero,
[src]
E: Zero,
Creates a new
from center
and a radius
equal to zero.
fn diameter(self) -> E where
E: Copy + Add<Output = E>,
[src]
E: Copy + Add<Output = E>,
Gets the value of twice the radius.
fn rect3(self) -> Rect3<P, E> where
P: Sub<P, Output = P> + From<E> + Copy,
E: Copy + Add<E, Output = E>,
[src]
P: Sub<P, Output = P> + From<E> + Copy,
E: Copy + Add<E, Output = E>,
Gets the bounding rectangle for this shape.
impl<T> Sphere<T, T> where
T: Copy + Add<T, Output = T> + Sub<T, Output = T>,
[src]
T: Copy + Add<T, Output = T> + Sub<T, Output = T>,
impl<T: Float + Sum> Sphere<T, T>
[src]
fn contains_point(self, p: Vec3<T>) -> bool where
T: PartialOrd,
[src]
T: PartialOrd,
Does this shape contain the given point ?
fn collides_with_sphere(self, other: Self) -> bool where
T: PartialOrd,
[src]
T: PartialOrd,
Does this shape collide with another ?
fn collision_vector_with_sphere(self, other: Self) -> Vec3<T>
[src]
Gets a vector that tells how much this shape penetrates another.
Trait Implementations
impl<P: Debug, E: Debug> Debug for Sphere<P, E>
[src]
impl<P: Default, E: Default> Default for Sphere<P, E>
[src]
impl<P: Clone, E: Clone> Clone for Sphere<P, E>
[src]
fn clone(&self) -> Sphere<P, E>
[src]
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl<P: Copy, E: Copy> Copy for Sphere<P, E>
[src]
impl<P: Hash, E: Hash> Hash for Sphere<P, E>
[src]
fn hash<__HPE: Hasher>(&self, __arg_0: &mut __HPE)
[src]
Feeds this value into the given [Hasher
]. Read more
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
Feeds a slice of this type into the given [Hasher
]. Read more