Struct building_blocks_core::extent::ExtentN[][src]

pub struct ExtentN<N> {
    pub minimum: PointN<N>,
    pub shape: PointN<N>,
}
Expand description

An N-dimensional extent. This is mathematically the Cartesian product of a half-closed interval [a, b) in each dimension. You can also just think of it as an axis-aligned box with some shape and a minimum point. When doing queries against lattice maps, this is the primary structure used to determine the bounds of your query.

Fields

minimum: PointN<N>

The least point contained in the extent.

shape: PointN<N>

The length of each dimension.

Implementations

The default representation of an extent as the minimum point and shape.

Translate the extent such that it has new_min as it’s new minimum.

The least point p for which all points q in the extent satisfy q < p.

Returns true iff the point p is contained in this extent.

Resize the extent by mutating its shape by delta.

Returns a new extent that’s been padded on all borders by pad_amount.

The number of points contained in the extent.

Returns true iff the number of points in the extent is 0.

An alternative representation of an extent as the minimum point and least upper bound.

Returns the extent containing only the points in both self and other.

Returns true iff the intersection of self and other is equal to self.

An alternative representation of an integer extent as the minimum point and maximum point. This only works for integer extents, where there is a unique maximum point.

The unique greatest point in the extent.

Constructs the unique extent with both p1 and p2 as corners.

Iterate over all points in the extent.

let extent = Extent3i::from_min_and_shape(PointN([0, 0, 0]), PointN([2, 2, 1]));
let points = extent.iter_points().collect::<Vec<_>>();
assert_eq!(points, vec![
    PointN([0, 0, 0]), PointN([1, 0, 0]), PointN([0, 1, 0]), PointN([1, 1, 0])
]);

Trait Implementations

The resulting type after applying the + operator.

Performs the + operation. Read more

Performs the += operation. Read more

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Deserialize this value from the given Serde deserializer. Read more

The resulting type after applying the * operator.

Performs the * operation. Read more

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

This method tests for !=.

Serialize this value into the given Serde serializer. Read more

The resulting type after applying the - operator.

Performs the - operation. Read more

Performs the -= operation. 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

Performs the conversion.

Performs the conversion.

Should always be Self

Performance hack: Clone doesn’t get inlined for Copy types in debug mode, so make it inline anyway.

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

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