pub struct Disk<P, E> {
pub center: Vec2<P>,
pub radius: E,
}
Expand description
Disk (2D), represented by center and radius.
Fields
center: Vec2<P>
radius: E
Implementations
sourceimpl<P, E> Disk<P, E>
impl<P, E> Disk<P, E>
sourcepub fn circumference(self) -> E where
E: Copy + FloatConst + Mul<Output = E> + Add<Output = E>,
pub fn circumference(self) -> E where
E: Copy + FloatConst + Mul<Output = E> + Add<Output = E>,
Gets this disk’s circumference.
sourcepub fn area(self) -> E where
E: Copy + FloatConst + Mul<Output = E>,
pub fn area(self) -> E where
E: Copy + FloatConst + Mul<Output = E>,
Gets this disk’s area.
sourceimpl<P, E> Disk<P, E>
impl<P, E> Disk<P, E>
sourcepub fn unit(center: Vec2<P>) -> Self where
E: One,
pub fn unit(center: Vec2<P>) -> Self where
E: One,
Creates a new
Disk
from center
and a radius
equal to one.
sourcepub fn point(center: Vec2<P>) -> Self where
E: Zero,
pub fn point(center: Vec2<P>) -> Self where
E: Zero,
Creates a new
Disk
from center
and a radius
equal to zero.
sourceimpl<T: Real + Add<T, Output = T>> Disk<T, T>
impl<T: Real + Add<T, Output = T>> Disk<T, T>
sourcepub fn contains_point(self, p: Vec2<T>) -> bool where
T: PartialOrd,
pub fn contains_point(self, p: Vec2<T>) -> bool where
T: PartialOrd,
Does this shape contain the given point ?
sourcepub fn collides_with_disk(self, other: Self) -> bool where
T: PartialOrd,
pub fn collides_with_disk(self, other: Self) -> bool where
T: PartialOrd,
Does this shape collide with another ?
sourcepub fn collision_vector_with_disk(self, other: Self) -> Vec2<T>
pub fn collision_vector_with_disk(self, other: Self) -> Vec2<T>
Gets a vector that tells how much this shape penetrates another.
Trait Implementations
sourceimpl<'de, P, E> Deserialize<'de> for Disk<P, E> where
P: Deserialize<'de>,
E: Deserialize<'de>,
impl<'de, P, E> Deserialize<'de> for Disk<P, E> where
P: Deserialize<'de>,
E: Deserialize<'de>,
sourcefn 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
impl<P: Copy, E: Copy> Copy for Disk<P, E>
impl<P: Eq, E: Eq> Eq for Disk<P, E>
impl<P, E> StructuralEq for Disk<P, E>
impl<P, E> StructuralPartialEq for Disk<P, E>
Auto Trait Implementations
impl<P, E> RefUnwindSafe for Disk<P, E> where
E: RefUnwindSafe,
P: RefUnwindSafe,
impl<P, E> Send for Disk<P, E> where
E: Send,
P: Send,
impl<P, E> Sync for Disk<P, E> where
E: Sync,
P: Sync,
impl<P, E> Unpin for Disk<P, E> where
E: Unpin,
P: Unpin,
impl<P, E> UnwindSafe for Disk<P, E> where
E: UnwindSafe,
P: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
🔬 This is a nightly-only experimental API. (
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more