pub struct HashGrid {
pub config: HashGridConfig,
pub data: Vec<f32>,
/* private fields */
}Expand description
Multi-resolution hash grid with trilinear interpolation.
Fields§
§config: HashGridConfigGrid configuration.
data: Vec<f32>Flat feature storage: [n_levels * T * F].
Implementations§
Source§impl HashGrid
impl HashGrid
Sourcepub fn new(cfg: HashGridConfig, rng: &mut LcgRng) -> NerfResult<Self>
pub fn new(cfg: HashGridConfig, rng: &mut LcgRng) -> NerfResult<Self>
Create a new hash grid with parameters initialized to U(-0.0001, 0.0001).
§Errors
Returns InvalidHashConfig for invalid configuration.
Sourcepub fn output_dim(&self) -> usize
pub fn output_dim(&self) -> usize
Total output dimension: n_levels * n_features_per_level.
Sourcepub fn query(&self, xyz: [f32; 3]) -> NerfResult<Vec<f32>>
pub fn query(&self, xyz: [f32; 3]) -> NerfResult<Vec<f32>>
Query a single 3D point in [0, 1]^3.
Returns a feature vector of length output_dim.
§Errors
Returns DimensionMismatch for wrong input size.
Sourcepub fn query_batch(&self, xyz_batch: &[f32], n: usize) -> NerfResult<Vec<f32>>
pub fn query_batch(&self, xyz_batch: &[f32], n: usize) -> NerfResult<Vec<f32>>
Batch query: xyz_batch is a flat [N * 3] array.
Returns [N * output_dim].
§Errors
Returns DimensionMismatch if xyz_batch.len() != n * 3.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for HashGrid
impl RefUnwindSafe for HashGrid
impl Send for HashGrid
impl Sync for HashGrid
impl Unpin for HashGrid
impl UnsafeUnpin for HashGrid
impl UnwindSafe for HashGrid
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