pub struct VoxelSdf {
pub nx: usize,
pub ny: usize,
pub nz: usize,
pub origin: [f64; 3],
pub dx: f64,
pub values: Vec<f64>,
}Expand description
Discretised signed distance field on a regular axis-aligned grid.
Fields§
§nx: usize§ny: usize§nz: usize§origin: [f64; 3]§dx: f64§values: Vec<f64>Implementations§
Source§impl VoxelSdf
impl VoxelSdf
Sourcepub fn new(nx: usize, ny: usize, nz: usize, origin: [f64; 3], dx: f64) -> Self
pub fn new(nx: usize, ny: usize, nz: usize, origin: [f64; 3], dx: f64) -> Self
Create a zeroed voxel grid.
Sourcepub fn idx(&self, ix: usize, iy: usize, iz: usize) -> usize
pub fn idx(&self, ix: usize, iy: usize, iz: usize) -> usize
Flat index from 3-D grid coordinates.
Sourcepub fn world_to_grid(&self, p: [f64; 3]) -> [f64; 3]
pub fn world_to_grid(&self, p: [f64; 3]) -> [f64; 3]
Convert a world-space point to fractional grid coordinates.
Sourcepub fn sample_trilinear(&self, p: [f64; 3]) -> f64
pub fn sample_trilinear(&self, p: [f64; 3]) -> f64
Trilinear interpolation of the voxel grid at world-space point p.
Auto Trait Implementations§
impl Freeze for VoxelSdf
impl RefUnwindSafe for VoxelSdf
impl Send for VoxelSdf
impl Sync for VoxelSdf
impl Unpin for VoxelSdf
impl UnsafeUnpin for VoxelSdf
impl UnwindSafe for VoxelSdf
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
Mutably borrows from an owned value. Read more
Source§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>
The inverse inclusion map: attempts to construct
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
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
Use with care! Same as
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self to the equivalent element of its superset.