[][src]Struct math2d::RoundedRect

#[repr(C)]
pub struct RoundedRect { pub rect: Rectf, pub radius_x: f32, pub radius_y: f32, }

Represents a rectangle with rounded corners described by ellipses that touch the internal edges of the rectangle at the tangent points.

Diagram visualizing the meaning of the structure components

Fields

rect: Rectf

The overall rectangle containing this rounded rectangle

radius_x: f32

The x-radius of the ellipse nested in each corner.

radius_y: f32

The y-radius of the ellipse nested in each corner.

Methods

impl RoundedRect[src]

pub fn new(
    rect: impl Into<Rectf>,
    rx: f32,
    ry: f32
) -> RoundedRect
[src]

Constructs the rounded rectangle from its components

pub fn corner_ellipse(&self, corner: RectCorner) -> Ellipse[src]

Gets the ellipse that resides in the given corner of the rectangle

pub fn contains_point(
    &self,
    point: impl Into<Point2f>
) -> bool
[src]

Checks if the given point resides within the rounded rectangle, taking care to exclude the parts of the corners that are excluded from the ellipses.

pub fn contains_point_crude(
    &self,
    point: impl Into<Point2f>
) -> bool
[src]

Checks if the point resides within the rectangle without checking the corner cases of being inside the square rectangle but not inside the rounded corners. This function may be decently faster than contains_point.

Trait Implementations

impl Clone for RoundedRect[src]

fn clone_from(&mut self, source: &Self)
1.0.0
[src]

Performs copy-assignment from source. Read more

impl Copy for RoundedRect[src]

impl PartialEq<RoundedRect> for RoundedRect[src]

impl Default for RoundedRect[src]

impl<R> From<(R, f32, f32)> for RoundedRect where
    R: Into<Rectf>, 
[src]

impl From<RoundedRect> for D2D1_ROUNDED_RECT[src]

impl From<D2D1_ROUNDED_RECT> for RoundedRect[src]

impl Debug for RoundedRect[src]

impl Serialize for RoundedRect[src]

impl<'de> Deserialize<'de> for RoundedRect[src]

Auto Trait Implementations

impl Send for RoundedRect

impl Sync for RoundedRect

Blanket Implementations

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

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

type Owned = T

impl<T> From for T[src]

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

type Error = !

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

The type returned in the event of a conversion error.

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

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

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

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

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

The type returned in the event of a conversion error.

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

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