pub enum Extent {
Dims([u32; 3]),
Ranges(RangeExtent),
}
Expand description
The extent of the structured object being represented in 3D space.
Variants§
Dims([u32; 3])
Legacy formats use dimensions to indicate the extent of a grid.
Ranges(RangeExtent)
In XML format, inclusive ranges are given as a 6-tuple:
[ x0 x1 y0 y1 z0 z1 ]
where the extent of the grid in say x
is given by the inclusive range x0..=x1
.
These are translated into Rust’s RangeInclusive
for explicitness and convenience as
[ x0..=x1, y0..=y1, z0..=z1 ]
The equivalent extent in legacy format would be Dims([x1-x0+1, y1-y0+1, z1-z0+1])
.
Implementations§
Source§impl Extent
impl Extent
Sourcepub fn into_dims(self) -> [u32; 3]
pub fn into_dims(self) -> [u32; 3]
Convert Extent
to a triple of dimensions.
If the extent is stored as Extent::Ranges
such as
[ x0..=x1, y0..=y1, z0..=z1 ]
then the equivalent extent in legacy format is returned:
[x1-x0+1, y1-y0+1, z1-z0+1]
Sourcepub fn into_ranges(self) -> [RangeInclusive<i32>; 3]
pub fn into_ranges(self) -> [RangeInclusive<i32>; 3]
Convert Extent
to a triplet of ranges.
If the extent is stored as Extent::Dims
such as
[ nx, ny, nz ]
then the equivalent extent in XML format is returned:
[0..=nx, 0..=ny, 0..=nz]
Sourcepub fn num_points(&self) -> u64
pub fn num_points(&self) -> u64
Compute the total number of points represented by this extent.