Struct broccoli::node::Rect[][src]

#[repr(C)]
#[must_use]
pub struct Rect<T> { pub x: Range<T>, pub y: Range<T>, }
Expand description

An axis aligned rectangle. Stored as two Ranges. It is a semi-closed rectangle. A point is considered inside the rectangle if it is in [start,end) for both x and y.

Fields

x: Range<T>y: Range<T>

Implementations

Create a rectangle from a point and radius.

Get the range of one axis.

Get the mutable range of one axis.

Constructor. (xstart,xend) is the x component range. (ystart,yend) is the y component range.

Returns each corner in this order: topleft topright bottomright bottomleft

(a,b) is the x component range. (c,d) is the y component range.

Returns true if the point is contained in the the ranges of both axis.

Grow a rectangle of a radius.

If the point is outisde the rectangle, returns the squared distance from the closest corner of the rectangle. If the point is inside the rectangle, it will return None.

If the point is outisde the rectangle, returns the squared distance from a point to the furthest corner of the rectangle.

Subdivides the rectangle. No floating point calculations are done. Important to note that a point that was in the original rectangle, could actually be inside both subdivded rectangles. This is because the ranges are inclusive on both sides [start,end].

Returns true if the rectangle’s ranges are not degenerate.

Returns true if the specified rect is inside of this rect.

Grow the rectangle to fit the specified rectangle by replacing values with the specified rectangle. No floating point computations.

Get an intersecting rectangle. No floating point calculations as the new rectangle is made up of values from this rectangle and the specified rectangle.

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

Performs the conversion.

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

This method tests for !=.

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

Performs the conversion.

Performs the conversion.

The alignment of pointer.

The type for initializers.

Initializes a with the given initializer. Read more

Dereferences the given pointer. Read more

Mutably dereferences the given pointer. Read more

Drops the object pointed to by the given pointer. Read more

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)

recently added

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.