pub enum VoxelValue {
PrimitiveUndefined,
PrimitiveOutsideSurfaceToWalk,
PrimitiveInsideSurfaceToWalk,
PrimitiveOnSurfaceNoWalk,
PrimitiveOnSurfaceToWalk1,
PrimitiveOnSurfaceToWalk2,
PrimitiveOutsideSurface,
PrimitiveInsideSurface,
PrimitiveOnSurface,
}Expand description
The state of a voxel during and after voxelization.
This enum represents the classification of each voxel in the grid. After voxelization completes,
only three values are meaningful for end-user code: PrimitiveOutsideSurface,
PrimitiveInsideSurface, and PrimitiveOnSurface. The other variants are intermediate
states used during the flood-fill algorithm.
§Usage
Most users will work with VoxelSet which filters out outside voxels and only stores
filled ones. However, if you’re working directly with VoxelizedVolume, you’ll encounter
all these values.
§Final States (After Voxelization)
PrimitiveOutsideSurface: Voxel is completely outside the shapePrimitiveInsideSurface: Voxel is fully inside the shape (only withFillMode::FloodFill)PrimitiveOnSurface: Voxel intersects the boundary surface
§Intermediate States (During Voxelization)
The following are temporary states used during the flood-fill algorithm and should be ignored by user code:
PrimitiveUndefinedPrimitiveOutsideSurfaceToWalkPrimitiveInsideSurfaceToWalkPrimitiveOnSurfaceNoWalkPrimitiveOnSurfaceToWalk1PrimitiveOnSurfaceToWalk2
§Example
use parry3d::transformation::voxelization::{FillMode, VoxelValue, VoxelizedVolume};
use parry3d::shape::Cuboid;
use nalgebra::Vector3;
let cuboid = Cuboid::new(Vector3::new(1.0, 1.0, 1.0));
let (vertices, indices) = cuboid.to_trimesh();
// Create a dense voxelized volume
let volume = VoxelizedVolume::voxelize(
&vertices,
&indices,
8,
FillMode::FloodFill { detect_cavities: false },
false,
);
// Query individual voxel values
let resolution = volume.resolution();
for i in 0..resolution[0] {
for j in 0..resolution[1] {
for k in 0..resolution[2] {
match volume.voxel(i, j, k) {
VoxelValue::PrimitiveOnSurface => {
// This voxel is on the boundary
}
VoxelValue::PrimitiveInsideSurface => {
// This voxel is inside the shape
}
VoxelValue::PrimitiveOutsideSurface => {
// This voxel is outside the shape
}
_ => {
// Should not happen after voxelization completes
}
}
}
}
}Variants§
PrimitiveUndefined
Intermediate value, should be ignored by end-user code.
PrimitiveOutsideSurfaceToWalk
Intermediate value, should be ignored by end-user code.
PrimitiveInsideSurfaceToWalk
Intermediate value, should be ignored by end-user code.
PrimitiveOnSurfaceNoWalk
Intermediate value, should be ignored by end-user code.
PrimitiveOnSurfaceToWalk1
Intermediate value, should be ignored by end-user code.
PrimitiveOnSurfaceToWalk2
Intermediate value, should be ignored by end-user code.
PrimitiveOutsideSurface
A voxel that is outside of the voxelized shape.
PrimitiveInsideSurface
A voxel that is on the interior of the voxelized shape.
PrimitiveOnSurface
Voxel that intersects the surface of the voxelized shape.
Trait Implementations§
Source§impl Clone for VoxelValue
impl Clone for VoxelValue
Source§fn clone(&self) -> VoxelValue
fn clone(&self) -> VoxelValue
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for VoxelValue
impl Debug for VoxelValue
Source§impl PartialEq for VoxelValue
impl PartialEq for VoxelValue
impl Copy for VoxelValue
impl Eq for VoxelValue
impl StructuralPartialEq for VoxelValue
Auto Trait Implementations§
impl Freeze for VoxelValue
impl RefUnwindSafe for VoxelValue
impl Send for VoxelValue
impl Sync for VoxelValue
impl Unpin for VoxelValue
impl UnwindSafe for VoxelValue
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be
downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further
downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSend for T
impl<T> DowncastSend for T
Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.