Struct lowdim::BBox[][src]

pub struct BBox<S: Integer, V: Vector<S>> { /* fields omitted */ }
Expand description

A bounding box.

An axis-aligned non-empty volume of the same dimension as the space.

Implementations

Constructs a bounding box from origin and size.

All coordinates of size must be positive to make the box non-empty.

Constructs a bounding box which contains a single point.

Example
let p = p2d(2, 3);
assert_eq!(bb2d(2..3, 3..4), BBox2d::from_point(p));

Constructs the smallest bounding box containing two points.

Example
let p0 = p2d(2, 3);
let p1 = p2d(-1, 4);
assert_eq!(bb2d(-1..3, 3..5), BBox2d::from_points(p0, p1));

The minimal point in the bounding box.

The maximal point in the bounding box.

The center point in the bounding box.

This is only the true center of the bounding box if the bounding box has odd dimensions. Otherwise the coordinates of the center are rounded according to the rules for integer division, i.e. towards zero.

The least upper bound of two bounding boxes w.r.t. inclusion.

That is, the smallest bounding box encompassing the points in the two boxes.

Example
let bb0 = bb2d(-2..3, -1..2);
let bb1 = bb2d(-5..4, 2..5);
assert_eq!(bb2d(-5..4, -1..5), bb0.lub(&bb1));

Returns the smallest bounding box encompassing this box and a given point.

Example
let bb = bb2d(-2..3, -1..2);
let p = p2d(3, 4);
assert_eq!(bb2d(-2..4, -1..5), bb.extend_to(p));

Constructs a bounding box from bounds.

As always, lower bounds are inclusive, upper bounds exclusive.

Returns the lower bound in the x-coordinate (inclusive).

Returns the upper bound in the x-coordinate (exclusive).

Returns the lower bound in the x-coordinate (inclusive).

Returns the upper bound in the x-coordinate (inclusive).

👎 Deprecated:

Use x_start or x_min instead.

Returns the lower bound in the x-coordinate (inclusive).

👎 Deprecated:

Use x_end instead, or consider using x_max.

Returns the upper bound in the x-coordinate (exclusive).

Returns the lower bound in the y-coordinate (inclusive).

Returns the upper bound in the y-coordinate (exclusive).

Returns the lower bound in the y-coordinate (inclusive).

Returns the upper bound in the y-coordinate (inclusive).

👎 Deprecated:

Use y_start or y_min instead.

Returns the lower bound in the y-coordinate (inclusive).

👎 Deprecated:

Use y_end instead, or consider using y_max.

Returns the upper bound in the y-coordinate (exclusive).

Returns the width of the bounding box.

Returns the height of the bounding box.

Returns the area of the bounding box.

Returns true if the point is inside the bounding box.

The range of the x coordinate

The range of the y coordinate

Returns an iterator over the points in the bounding box.

Points are returned by row.

Returns the sequential index for a given point.

Points are counted by row.

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 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 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.