Struct math2d::RoundedRect

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

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.

Implementations§

Constructs the rounded rectangle from its components

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

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.

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§

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more
Returns the “default value” for a type. Read more
Deserialize this value from the given Serde deserializer. Read more
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
This method tests for self and other values to be equal, and is used by ==. Read more
This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason. Read more
Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.