pub struct BoundingBox { /* private fields */ }
Expand description

Defines a rectangular bounding box.

The Y axis convention is downwards.

Implementations

Constructs a new bounding box.

Arguments
  • center - The position of the center of the bounding box
  • width - The bounding box’s width
  • height - The bounding box’s height

Constructs a new bounding box centeterd at origin with the provided width and height.

Constructs a new square bounding box centeterd at origin with the provided width.

Gets the position of the box’s center.

Gets the position of the top right corner of the bounding box.

Gets the position of the bottom left corner of the bounding box.

Gets the width of the bounding box.

Gets the height of the bounding box.

Gets the Y coordinate of the top of the bounding box.

Gets the Y coordinate of the bottom of the bounding box.

Gets the X coordinate of the left of the bounding box.

Gets the X coordinate of the right of the bounding box.

Gets a slice of corners oriented counter-clockwise.

Returns whether a given point is inside (or on the edges) of the bounding box.

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

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

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

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.