Struct vek::geom::repr_c::Disk[][src]

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

impl<P, E> Disk<P, E>[src]

pub fn circumference(self) -> E where
    E: Copy + FloatConst + Mul<Output = E> + Add<Output = E>, 
[src]

Gets this disk’s circumference.

pub fn area(self) -> E where
    E: Copy + FloatConst + Mul<Output = E>, 
[src]

Gets this disk’s area.

impl<P, E> Disk<P, E>[src]

pub fn new(center: Vec2<P>, radius: E) -> Self[src]

Creates a new Disk from center and radius.

pub fn unit(center: Vec2<P>) -> Self where
    E: One
[src]

Creates a new Disk from center and a radius equal to one.

pub fn point(center: Vec2<P>) -> Self where
    E: Zero
[src]

Creates a new Disk from center and a radius equal to zero.

pub fn diameter(self) -> E where
    E: Copy + Add<Output = E>, 
[src]

Gets the value of twice the radius.

pub fn rect(self) -> Rect<P, E> where
    P: Sub<P, Output = P> + From<E> + Copy,
    E: Copy + Add<E, Output = E>, 
[src]

Gets the bounding rectangle for this shape.

impl<T> Disk<T, T> where
    T: Copy + Add<T, Output = T> + Sub<T, Output = T>, 
[src]

pub fn aabr(self) -> Aabr<T>[src]

Gets this shape’s bounds.

impl<T: Real + Add<T, Output = T>> Disk<T, T>[src]

pub fn contains_point(self, p: Vec2<T>) -> bool where
    T: PartialOrd
[src]

Does this shape contain the given point ?

pub fn collides_with_disk(self, other: Self) -> bool where
    T: PartialOrd
[src]

Does this shape collide with another ?

pub fn collision_vector_with_disk(self, other: Self) -> Vec2<T>[src]

Gets a vector that tells how much this shape penetrates another.

Trait Implementations

impl<P: Clone, E: Clone> Clone for Disk<P, E>[src]

fn clone(&self) -> Disk<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: Debug, E: Debug> Debug for Disk<P, E>[src]

fn fmt(&self, f: &mut Formatter<'_>) -> Result[src]

Formats the value using the given formatter. Read more

impl<P: Default, E: Default> Default for Disk<P, E>[src]

fn default() -> Disk<P, E>[src]

Returns the “default value” for a type. Read more

impl<'de, P, E> Deserialize<'de> for Disk<P, E> where
    P: Deserialize<'de>,
    E: Deserialize<'de>, 
[src]

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
    __D: Deserializer<'de>, 
[src]

Deserialize this value from the given Serde deserializer. Read more

impl<P: Hash, E: Hash> Hash for Disk<P, E>[src]

fn hash<__H: Hasher>(&self, state: &mut __H)[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]

Feeds a slice of this type into the given Hasher. Read more

impl<P: PartialEq, E: PartialEq> PartialEq<Disk<P, E>> for Disk<P, E>[src]

fn eq(&self, other: &Disk<P, E>) -> bool[src]

This method tests for self and other values to be equal, and is used by ==. Read more

fn ne(&self, other: &Disk<P, E>) -> bool[src]

This method tests for !=.

impl<P, E> Serialize for Disk<P, E> where
    P: Serialize,
    E: Serialize
[src]

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error> where
    __S: Serializer
[src]

Serialize this value into the given Serde serializer. Read more

impl<P: Copy, E: Copy> Copy for Disk<P, E>[src]

impl<P: Eq, E: Eq> Eq for Disk<P, E>[src]

impl<P, E> StructuralEq for Disk<P, E>[src]

impl<P, E> StructuralPartialEq for Disk<P, E>[src]

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

impl<T> Any for T where
    T: 'static + ?Sized
[src]

pub fn type_id(&self) -> TypeId[src]

Gets the TypeId of self. Read more

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

pub fn borrow(&self) -> &T[src]

Immutably borrows from an owned value. Read more

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

pub fn borrow_mut(&mut self) -> &mut T[src]

Mutably borrows from an owned value. Read more

impl<T> From<T> for T[src]

pub fn from(t: T) -> T[src]

Performs the conversion.

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

pub fn into(self) -> U[src]

Performs the conversion.

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

pub fn to_owned(&self) -> T[src]

Creates owned data from borrowed data, usually by cloning. Read more

pub fn clone_into(&self, target: &mut T)[src]

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

Uses borrowed data to replace owned data, usually by cloning. Read more

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]

Performs the conversion.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>[src]

Performs the conversion.

impl<T> DeserializeOwned for T where
    T: for<'de> Deserialize<'de>, 
[src]