pub struct Scatter3D { /* private fields */ }Expand description
A 3D scatter plot: per-point (x, y, z) positions coloured by a per-point
value through a Colormap, drawn as PointMarker sprites of one size.
Port of silx plot3d.items.Scatter3D (DataItem3D + ColormapMixIn +
SymbolMixIn). silx colours points on the GPU from a colormap texture; here
the mapping is done on the CPU via Colormap::color_at when building the
geometry — simpler, and points are few relative to image rasters.
Implementations§
Source§impl Scatter3D
impl Scatter3D
Sourcepub fn new() -> Self
pub fn new() -> Self
An empty scatter with silx defaults: the viridis colormap over [0, 1],
circle markers at DEFAULT_SCATTER3D_SIZE.
Sourcepub fn set_data(
&mut self,
x: &[f32],
y: &[f32],
z: &[f32],
values: &[f64],
) -> bool
pub fn set_data( &mut self, x: &[f32], y: &[f32], z: &[f32], values: &[f64], ) -> bool
Replace the point data (silx Scatter3D.setData). The four arrays must be
the same length; on a length mismatch the data is left unchanged and
false is returned (silx asserts equal lengths).
Sourcepub fn with_data(self, x: &[f32], y: &[f32], z: &[f32], values: &[f64]) -> Self
pub fn with_data(self, x: &[f32], y: &[f32], z: &[f32], values: &[f64]) -> Self
Builder form of set_data; a length mismatch leaves the
data empty.
Sourcepub fn set_colormap(&mut self, colormap: Colormap)
pub fn set_colormap(&mut self, colormap: Colormap)
Set the colormap (silx ColormapMixIn.setColormap).
Sourcepub fn with_colormap(self, colormap: Colormap) -> Self
pub fn with_colormap(self, colormap: Colormap) -> Self
Builder form of set_colormap.
Sourcepub fn colormap_mut(&mut self) -> &mut Colormap
pub fn colormap_mut(&mut self) -> &mut Colormap
Mutable access to the colormap (e.g. to set the value range directly).
Sourcepub fn autoscale_colormap(&mut self, mode: AutoscaleMode) -> (f64, f64)
pub fn autoscale_colormap(&mut self, mode: AutoscaleMode) -> (f64, f64)
Fit the colormap’s value range to the current data with mode (silx’s
colormap autoscale over the value array), returning the new (vmin, vmax).
With no data the range falls back to the autoscale default, matching
AutoscaleMode::range.
Sourcepub fn set_marker(&mut self, marker: PointMarker)
pub fn set_marker(&mut self, marker: PointMarker)
Set the marker shape (silx SymbolMixIn.setSymbol).
Sourcepub fn with_marker(self, marker: PointMarker) -> Self
pub fn with_marker(self, marker: PointMarker) -> Self
Builder form of set_marker.
Sourcepub fn set_size(&mut self, size: f32)
pub fn set_size(&mut self, size: f32)
Set the marker size in pixels (silx SymbolMixIn.setSymbolSize), clamped
to be non-negative.
Sourcepub fn bounds(&self) -> Option<(Vec3, Vec3)>
pub fn bounds(&self) -> Option<(Vec3, Vec3)>
Axis-aligned data bounds (min, max) over the points (silx
DataItem3D.getBounds), or None when empty. Useful to frame a
crate::widget::scene_widget::SceneWidget.
Sourcepub fn append_to(&self, geometry: &mut Scene3dGeometry)
pub fn append_to(&self, geometry: &mut Scene3dGeometry)
Append this scatter’s points (coloured through the colormap) to
geometry, ready to upload via crate::render::gpu_scene3d::set_scene3d.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Scatter3D
impl RefUnwindSafe for Scatter3D
impl Send for Scatter3D
impl Sync for Scatter3D
impl Unpin for Scatter3D
impl UnsafeUnpin for Scatter3D
impl UnwindSafe for Scatter3D
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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.