pub struct VolumeGrid { /* private fields */ }Expand description
A regular 3D grid structure.
VolumeGrid represents a regular axis-aligned 3D grid defined by:
- Grid dimensions (number of nodes in X, Y, Z)
- Bounding box (min and max corners in world space)
Node values are at grid vertices, cell values are at grid cell centers.
Implementations§
Source§impl VolumeGrid
impl VolumeGrid
Sourcepub fn new(
name: impl Into<String>,
node_dim: UVec3,
bound_min: Vec3,
bound_max: Vec3,
) -> Self
pub fn new( name: impl Into<String>, node_dim: UVec3, bound_min: Vec3, bound_max: Vec3, ) -> Self
Creates a new volume grid.
§Arguments
name- The name of the gridnode_dim- Number of nodes in each dimension (X, Y, Z)bound_min- Minimum corner of the grid bounding boxbound_max- Maximum corner of the grid bounding box
Sourcepub fn new_uniform(
name: impl Into<String>,
dim: u32,
bound_min: Vec3,
bound_max: Vec3,
) -> Self
pub fn new_uniform( name: impl Into<String>, dim: u32, bound_min: Vec3, bound_max: Vec3, ) -> Self
Creates a volume grid with uniform dimensions.
Sourcepub fn grid_spacing(&self) -> Vec3
pub fn grid_spacing(&self) -> Vec3
Returns the grid spacing (distance between adjacent nodes).
Sourcepub fn flatten_node_index(&self, i: u32, j: u32, k: u32) -> u64
pub fn flatten_node_index(&self, i: u32, j: u32, k: u32) -> u64
Flattens a 3D node index to a linear index.
Sourcepub fn unflatten_node_index(&self, idx: u64) -> UVec3
pub fn unflatten_node_index(&self, idx: u64) -> UVec3
Unflattens a linear node index to a 3D index.
Sourcepub fn position_of_node(&self, i: u32, j: u32, k: u32) -> Vec3
pub fn position_of_node(&self, i: u32, j: u32, k: u32) -> Vec3
Returns the world position of a node at the given 3D index.
Sourcepub fn edge_color(&self) -> Vec4
pub fn edge_color(&self) -> Vec4
Gets the edge color.
Sourcepub fn set_edge_color(&mut self, color: Vec3) -> &mut Self
pub fn set_edge_color(&mut self, color: Vec3) -> &mut Self
Sets the edge color.
Sourcepub fn edge_width(&self) -> f32
pub fn edge_width(&self) -> f32
Gets the edge width.
Sourcepub fn set_edge_width(&mut self, width: f32) -> &mut Self
pub fn set_edge_width(&mut self, width: f32) -> &mut Self
Sets the edge width.
Sourcepub fn cube_size_factor(&self) -> f32
pub fn cube_size_factor(&self) -> f32
Gets the cube size factor.
Sourcepub fn set_cube_size_factor(&mut self, factor: f32) -> &mut Self
pub fn set_cube_size_factor(&mut self, factor: f32) -> &mut Self
Sets the cube size factor (0 = no cubes, 1 = full size).
Sourcepub fn quantities_mut(&mut self) -> &mut [Box<dyn Quantity>]
pub fn quantities_mut(&mut self) -> &mut [Box<dyn Quantity>]
Returns a mutable reference to the quantities list.
Sourcepub fn init_render_data(
&mut self,
device: &Device,
bind_group_layout: &BindGroupLayout,
camera_buffer: &Buffer,
queue: &Queue,
)
pub fn init_render_data( &mut self, device: &Device, bind_group_layout: &BindGroupLayout, camera_buffer: &Buffer, queue: &Queue, )
Initializes GPU render data.
Sourcepub fn render_data(&self) -> Option<&CurveNetworkRenderData>
pub fn render_data(&self) -> Option<&CurveNetworkRenderData>
Returns the render data if available.
Sourcepub fn update_gpu_buffers(&self, queue: &Queue)
pub fn update_gpu_buffers(&self, queue: &Queue)
Updates GPU buffers per-frame (wireframe uniforms: edge color, edge width).
Sourcepub fn add_node_scalar_quantity(
&mut self,
name: impl Into<String>,
values: Vec<f32>,
) -> &mut Self
pub fn add_node_scalar_quantity( &mut self, name: impl Into<String>, values: Vec<f32>, ) -> &mut Self
Adds a node scalar quantity to the grid.
Sourcepub fn add_cell_scalar_quantity(
&mut self,
name: impl Into<String>,
values: Vec<f32>,
) -> &mut Self
pub fn add_cell_scalar_quantity( &mut self, name: impl Into<String>, values: Vec<f32>, ) -> &mut Self
Adds a cell scalar quantity to the grid.
Sourcepub fn build_egui_ui(&mut self, ui: &mut Ui, colormap_names: &[&str])
pub fn build_egui_ui(&mut self, ui: &mut Ui, colormap_names: &[&str])
Builds the egui UI for this volume grid.
§Arguments
colormap_names- Available colormap names for quantity visualization. If empty, defaults to built-in names.
Trait Implementations§
Source§impl HasQuantities for VolumeGrid
impl HasQuantities for VolumeGrid
Source§fn add_quantity(&mut self, quantity: Box<dyn Quantity>)
fn add_quantity(&mut self, quantity: Box<dyn Quantity>)
Source§fn get_quantity_mut(&mut self, name: &str) -> Option<&mut Box<dyn Quantity>>
fn get_quantity_mut(&mut self, name: &str) -> Option<&mut Box<dyn Quantity>>
Source§fn remove_quantity(&mut self, name: &str) -> Option<Box<dyn Quantity>>
fn remove_quantity(&mut self, name: &str) -> Option<Box<dyn Quantity>>
Source§fn quantities(&self) -> &[Box<dyn Quantity>]
fn quantities(&self) -> &[Box<dyn Quantity>]
Source§fn num_quantities(&self) -> usize
fn num_quantities(&self) -> usize
Source§impl Structure for VolumeGrid
impl Structure for VolumeGrid
Source§fn as_any_mut(&mut self) -> &mut dyn Any
fn as_any_mut(&mut self) -> &mut dyn Any
Any for downcasting.Source§fn type_name(&self) -> &'static str
fn type_name(&self) -> &'static str
PointCloud”, “SurfaceMesh”).Source§fn bounding_box(&self) -> Option<(Vec3, Vec3)>
fn bounding_box(&self) -> Option<(Vec3, Vec3)>
Source§fn length_scale(&self) -> f32
fn length_scale(&self) -> f32
Source§fn set_transform(&mut self, transform: Mat4)
fn set_transform(&mut self, transform: Mat4)
Source§fn is_enabled(&self) -> bool
fn is_enabled(&self) -> bool
Source§fn set_enabled(&mut self, enabled: bool)
fn set_enabled(&mut self, enabled: bool)
Source§fn draw(&self, _ctx: &mut dyn RenderContext)
fn draw(&self, _ctx: &mut dyn RenderContext)
Source§fn draw_pick(&self, _ctx: &mut dyn RenderContext)
fn draw_pick(&self, _ctx: &mut dyn RenderContext)
Source§fn build_pick_ui(&self, _ui: &dyn Any, _pick: &PickResult)
fn build_pick_ui(&self, _ui: &dyn Any, _pick: &PickResult)
ImGui UI for a picked element.Source§fn clear_gpu_resources(&mut self)
fn clear_gpu_resources(&mut self)
Source§fn center_bounding_box(&mut self)
fn center_bounding_box(&mut self)
Source§fn reset_transform(&mut self)
fn reset_transform(&mut self)
Source§fn material(&self) -> &str
fn material(&self) -> &str
Source§fn set_material(&mut self, _material: &str)
fn set_material(&mut self, _material: &str)
Auto Trait Implementations§
impl Freeze for VolumeGrid
impl !RefUnwindSafe for VolumeGrid
impl Send for VolumeGrid
impl Sync for VolumeGrid
impl Unpin for VolumeGrid
impl !UnwindSafe for VolumeGrid
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> 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>. Box<dyn Any> can
then be further downcast into Box<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>. Rc<Any> 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> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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 more