pub struct MeshOneFormQuantity { /* private fields */ }Expand description
A one-form quantity on a surface mesh.
Stores one scalar value per edge with orientation conventions. Rendered as arrows at edge midpoints, where the arrow direction is along the edge and length is proportional to the value.
Implementations§
Source§impl MeshOneFormQuantity
impl MeshOneFormQuantity
Sourcepub fn new(
name: impl Into<String>,
structure_name: impl Into<String>,
values: Vec<f32>,
orientations: Vec<bool>,
) -> Self
pub fn new( name: impl Into<String>, structure_name: impl Into<String>, values: Vec<f32>, orientations: Vec<bool>, ) -> Self
Creates a new one-form quantity.
Sourcepub fn orientations(&self) -> &[bool]
pub fn orientations(&self) -> &[bool]
Returns the edge orientation flags.
Sourcepub fn length_scale(&self) -> f32
pub fn length_scale(&self) -> f32
Gets the length scale.
Sourcepub fn set_length_scale(&mut self, scale: f32) -> &mut Self
pub fn set_length_scale(&mut self, scale: f32) -> &mut Self
Sets the length scale.
Sourcepub fn set_radius(&mut self, r: f32) -> &mut Self
pub fn set_radius(&mut self, r: f32) -> &mut Self
Sets the radius.
Sourcepub fn compute_edge_vectors(
&self,
vertices: &[Vec3],
edges: &[(u32, u32)],
) -> (Vec<Vec3>, Vec<Vec3>)
pub fn compute_edge_vectors( &self, vertices: &[Vec3], edges: &[(u32, u32)], ) -> (Vec<Vec3>, Vec<Vec3>)
Convert edge scalars + orientations to vector field for rendering.
Returns (positions, vectors) — one arrow per edge at the edge midpoint.
The vector direction is along the edge, scaled by the one-form value.
Sourcepub fn auto_scale(
&mut self,
structure_length_scale: f32,
vertices: &[Vec3],
edges: &[(u32, u32)],
)
pub fn auto_scale( &mut self, structure_length_scale: f32, vertices: &[Vec3], edges: &[(u32, u32)], )
Auto-scales length and radius based on the structure’s bounding box diagonal.
Sourcepub fn init_gpu_resources(
&mut self,
device: &Device,
bind_group_layout: &BindGroupLayout,
camera_buffer: &Buffer,
vertices: &[Vec3],
edges: &[(u32, u32)],
)
pub fn init_gpu_resources( &mut self, device: &Device, bind_group_layout: &BindGroupLayout, camera_buffer: &Buffer, vertices: &[Vec3], edges: &[(u32, u32)], )
Initializes GPU resources for this vector quantity.
Computes edge midpoint positions and direction vectors from the mesh, then creates GPU buffers for arrow rendering.
Sourcepub fn render_data(&self) -> Option<&VectorRenderData>
pub fn render_data(&self) -> Option<&VectorRenderData>
Returns the render data if initialized.
Sourcepub fn update_uniforms(&self, queue: &Queue, model: &Mat4)
pub fn update_uniforms(&self, queue: &Queue, model: &Mat4)
Updates GPU uniforms with the given model transform.
Sourcepub fn build_egui_ui(&mut self, ui: &mut Ui) -> bool
pub fn build_egui_ui(&mut self, ui: &mut Ui) -> bool
Builds the egui UI for this quantity.
Trait Implementations§
Source§impl Quantity for MeshOneFormQuantity
impl Quantity for MeshOneFormQuantity
Source§fn as_any_mut(&mut self) -> &mut dyn Any
fn as_any_mut(&mut self) -> &mut dyn Any
Any for downcasting.Source§fn structure_name(&self) -> &str
fn structure_name(&self) -> &str
Source§fn kind(&self) -> QuantityKind
fn kind(&self) -> QuantityKind
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 clear_gpu_resources(&mut self)
fn clear_gpu_resources(&mut self)
impl EdgeQuantity for MeshOneFormQuantity
Auto Trait Implementations§
impl Freeze for MeshOneFormQuantity
impl !RefUnwindSafe for MeshOneFormQuantity
impl Send for MeshOneFormQuantity
impl Sync for MeshOneFormQuantity
impl Unpin for MeshOneFormQuantity
impl UnsafeUnpin for MeshOneFormQuantity
impl !UnwindSafe for MeshOneFormQuantity
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> 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