Struct spade::BoundingRect

source ·
pub struct BoundingRect<V: PointN> { /* private fields */ }
Expand description

An axis aligned minimal bounding rectangle.

An axis aligned minimal bounding rectangle is the smallest rectangle that completely surrounds an object and is aligned along all axes. The vector type V’s dimension determines if this is a rectangle, a box or a higher dimensional volume.

Implementations

Creates a bounding rectangle that contains exactly one point.

This will create a bounding rectangle with lower == upper == point.

Create a bounding rectangle from a set of points

Panics

Panics if the given iterator is empty.

Creates a bounding rectangle that contains two points.

Returns the lower corner of the bounding rectangle.

The lower corner has the smaller coordinates.

Returns the upper corner of the bounding rectangle.

The upper corner has the larger coordinates.

Checks if a point is contained within the bounding rectangle.

A point lying exactly on the bounding rectangle’s border is also contained.

Checks if another bounding rectangle is completley contained withing this rectangle.

A rectangle is contained if and only if all four corner are contained (see contains_point).

Enlarges this bounding rectangle to contain a point.

If the point is already contained, nothing will be changed. Otherwise, this will enlarge self to be just large enough to contain the new point.

Enlarges this bounding rectangle to contain a rectangle.

If the rectangle is already contained, nothing will be changed. Otherwise, this will enlarge self to be just large enough to contain the new rectangle.

Returns the rectangle’s area.

Returns half of the rectangle’s margin, thus width + height.

Returns the rectangle’s center.

Returns the intersection of this and another bounding rectangle.

If the rectangles do not intersect, a bounding rectangle with an area and margin of zero is returned.

Returns true if this and another bounding rectangle intersect each other. If the rectangles just “touch” each other at one side, true is returned.

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
Feeds this value into the given Hasher. Read more
Feeds a slice of this type into the given Hasher. Read more
This method returns an Ordering between self and other. Read more
Compares and returns the maximum of two values. Read more
Compares and returns the minimum of two values. Read more
Restrict a value to a certain interval. Read more
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
This method returns an ordering between self and other values if one exists. Read more
This method tests less than (for self and other) and is used by the < operator. Read more
This method tests less than or equal to (for self and other) and is used by the <= operator. Read more
This method tests greater than (for self and other) and is used by the > operator. Read more
This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more
The object’s point type.
Returns the object’s minimal bounding rectangle. Read more
Returns the squared euclidean distance from the object’s contour. Returns a value samller than zero if the point is contained within the object. Read more
Returns true if a given point is contained in this object.

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.

Should always be Self
Tests if Self the same as the type T Read more
The inverse inclusion map: attempts to construct self from the equivalent element of its superset. Read more
Checks if self is actually part of its subset T (and can be converted to it).
Use with care! Same as self.to_subset but without any property checks. Always succeeds.
The inclusion map: converts self to the equivalent element of its superset.
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.