[][src]Struct kas::geom::Quad

#[repr(C)]pub struct Quad {
    pub a: Vec2,
    pub b: Vec2,
}

Axis-aligned 2D cuboid, specified via two corners a and b

Typically it is expected that a.le(b), although this is not required.

Fields

a: Vec2b: Vec2

Implementations

impl Quad[src]

pub fn with_coords(a: Vec2, b: Vec2) -> Self[src]

Construct with two coords

pub fn with_pos_and_size(pos: Vec2, size: Vec2) -> Self[src]

Construct with position and size

pub fn size(&self) -> Vec2[src]

Get the size

pub fn ab(&self) -> Vec2[src]

Swizzle coordinates: x from first, y from second point

pub fn ba(&self) -> Vec2[src]

Swizzle coordinates: x from second, y from first point

pub fn shrink(&self, value: f32) -> Quad[src]

Shrink self in all directions by the given value

In debug mode, this asserts a.le(b) after shrinking.

pub fn shrink_vec(&self, value: Vec2) -> Quad[src]

Shrink self in all directions by the given value

In debug mode, this asserts a.le(b) after shrinking.

pub fn intersection(&self, rhs: &Quad) -> Option<Quad>[src]

Calculate the intersection of two quads

Trait Implementations

impl Clone for Quad[src]

impl Copy for Quad[src]

impl Debug for Quad[src]

impl From<Rect> for Quad[src]

impl PartialEq<Quad> for Quad[src]

impl StructuralPartialEq for Quad[src]

Auto Trait Implementations

impl RefUnwindSafe for Quad

impl Send for Quad

impl Sync for Quad

impl Unpin for Quad

impl UnwindSafe for Quad

Blanket Implementations

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

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

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

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

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

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

type Owned = T

The resulting type after obtaining ownership.

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.

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.