Struct building_blocks_core::extent::ExtentN [−][src]
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
.
The number of points contained in the extent.
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.
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
Performs the +=
operation. Read more
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Performs the -=
operation. Read more
Auto Trait Implementations
impl<N> RefUnwindSafe for ExtentN<N> where
N: RefUnwindSafe,
impl<N> UnwindSafe for ExtentN<N> where
N: UnwindSafe,
Blanket Implementations
Mutably borrows from an owned value. Read more
The inverse inclusion map: attempts to construct self
from the equivalent element of its
superset. Read more
pub fn is_in_subset(&self) -> bool
pub fn is_in_subset(&self) -> bool
Checks if self
is actually part of its subset T
(and can be converted to it).
pub fn to_subset_unchecked(&self) -> SS
pub fn to_subset_unchecked(&self) -> SS
Use with care! Same as self.to_subset
but without any property checks. Always succeeds.
pub fn from_subset(element: &SS) -> SP
pub fn from_subset(element: &SS) -> SP
The inclusion map: converts self
to the equivalent element of its superset.