pub struct Grid3<T = f32> { /* private fields */ }Expand description
Stores values on a 3D cube lattice on the coordinates [0,0,0] - [w-1, h-1, d-1]. A 3D tensor, basically.
TODO (nummelin): Should we separate storage so we can store just a bitset of inside/outside (which is enough for most uses).
Implementations§
Source§impl<T> Grid3<T>where
T: SignedDistance,
impl<T> Grid3<T>where
T: SignedDistance,
Sourcepub fn gradient_clamped(&self, p: Index3) -> Vec3
pub fn gradient_clamped(&self, p: Index3) -> Vec3
Returns the distance gradient at the given coordinate. Coordinate must be within the grid.
Sourcepub fn fast_gradient(
&self,
x: usize,
y: usize,
z: usize,
i: usize,
ys: usize,
zs: usize,
) -> Vec3
pub fn fast_gradient( &self, x: usize, y: usize, z: usize, i: usize, ys: usize, zs: usize, ) -> Vec3
Returns a fast approximation of the distance gradient at the given coordinate.
Coordinate must be within the grid.
Sourcepub fn set_truncated_sync(
&mut self,
sdf: impl Fn(Index3) -> T + Send + Sync,
truncate_dist: f32,
)
pub fn set_truncated_sync( &mut self, sdf: impl Fn(Index3) -> T + Send + Sync, truncate_dist: f32, )
Will set all values closer than the given truncate distance
Cells outside the given truncate distance will have approximated distances.
Will run synchronously regardless of with_rayon feature availability.
Source§impl<T> Grid3<T>where
T: SignedDistance,
impl<T> Grid3<T>where
T: SignedDistance,
Sourcepub fn marching_cubes_with_color(
&self,
color: impl Fn(Vec3) -> Vec3 + Send + Sync,
) -> TriangleMesh
pub fn marching_cubes_with_color( &self, color: impl Fn(Vec3) -> Vec3 + Send + Sync, ) -> TriangleMesh
Gives a mesh using colors from the given function
Sourcepub fn marching_cubes(&self) -> TriangleMesh
pub fn marching_cubes(&self) -> TriangleMesh
Does NOT return colors
Trait Implementations§
Auto Trait Implementations§
impl<T> Freeze for Grid3<T>
impl<T> RefUnwindSafe for Grid3<T>where
T: RefUnwindSafe,
impl<T> Send for Grid3<T>where
T: Send,
impl<T> Sync for Grid3<T>where
T: Sync,
impl<T> Unpin for Grid3<T>where
T: Unpin,
impl<T> UnwindSafe for Grid3<T>where
T: UnwindSafe,
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