pub struct Plot3DUi<'ui> { /* private fields */ }Expand description
Per-frame access helper mirroring dear-implot
This provides access to all 3D plotting functions. It is tied to the lifetime
of the current ImGui frame and should be obtained via Plot3DContext::get_plot_ui().
§Example
use dear_implot3d::*;
if let Some(_token) = plot_ui.begin_plot("My 3D Plot").build() {
plot_ui.setup_axes("X", "Y", "Z", Axis3DFlags::NONE, Axis3DFlags::NONE, Axis3DFlags::NONE);
let xs = [0.0, 1.0, 2.0];
let ys = [0.0, 1.0, 0.0];
let zs = [0.0, 0.5, 1.0];
plot_ui.plot_line_f32("Line", &xs, &ys, &zs, Line3DFlags::NONE);
}Implementations§
Source§impl<'ui> Plot3DUi<'ui>
impl<'ui> Plot3DUi<'ui>
Sourcepub fn plot3d<S: AsRef<str>>(&self, title: S) -> Plot3DBuilder
pub fn plot3d<S: AsRef<str>>(&self, title: S) -> Plot3DBuilder
Convenience builder entry from Ui
Source§impl<'ui> Plot3DUi<'ui>
impl<'ui> Plot3DUi<'ui>
Sourcepub fn begin_plot<S: AsRef<str>>(&self, title: S) -> Plot3DBuilder
pub fn begin_plot<S: AsRef<str>>(&self, title: S) -> Plot3DBuilder
Builder to configure and begin a 3D plot
Returns a Plot3DBuilder that allows you to configure the plot before calling .build().
§Example
use dear_implot3d::*;
if let Some(_token) = plot_ui
.begin_plot("My Plot")
.size([600.0, 400.0])
.flags(Plot3DFlags::NO_LEGEND)
.build()
{
// Plot content here
}Sourcepub fn plot_line_f32<S: AsRef<str>>(
&self,
label: S,
xs: &[f32],
ys: &[f32],
zs: &[f32],
flags: Line3DFlags,
)
pub fn plot_line_f32<S: AsRef<str>>( &self, label: S, xs: &[f32], ys: &[f32], zs: &[f32], flags: Line3DFlags, )
Convenience: plot a simple 3D line (f32)
This is a quick way to plot a line without using the builder pattern.
For more control, use the plots::Line3D builder.
§Arguments
label- Label for the legendxs- X coordinatesys- Y coordinateszs- Z coordinatesflags- Line flags (e.g.,Line3DFlags::SEGMENTS,Line3DFlags::LOOP)
§Example
use dear_implot3d::*;
let xs = [0.0, 1.0, 2.0];
let ys = [0.0, 1.0, 0.0];
let zs = [0.0, 0.5, 1.0];
plot_ui.plot_line_f32("Line", &xs, &ys, &zs, Line3DFlags::NONE);Sourcepub fn plot_line_f32_raw<S: AsRef<str>>(
&self,
label: S,
xs: &[f32],
ys: &[f32],
zs: &[f32],
flags: Line3DFlags,
offset: i32,
stride: i32,
)
pub fn plot_line_f32_raw<S: AsRef<str>>( &self, label: S, xs: &[f32], ys: &[f32], zs: &[f32], flags: Line3DFlags, offset: i32, stride: i32, )
Raw line plot (f32) with offset/stride
Sourcepub fn plot_line_f64<S: AsRef<str>>(
&self,
label: S,
xs: &[f64],
ys: &[f64],
zs: &[f64],
flags: Line3DFlags,
)
pub fn plot_line_f64<S: AsRef<str>>( &self, label: S, xs: &[f64], ys: &[f64], zs: &[f64], flags: Line3DFlags, )
Convenience: plot a simple 3D line (f64)
Sourcepub fn plot_line_f64_raw<S: AsRef<str>>(
&self,
label: S,
xs: &[f64],
ys: &[f64],
zs: &[f64],
flags: Line3DFlags,
offset: i32,
stride: i32,
)
pub fn plot_line_f64_raw<S: AsRef<str>>( &self, label: S, xs: &[f64], ys: &[f64], zs: &[f64], flags: Line3DFlags, offset: i32, stride: i32, )
Raw line plot (f64) with offset/stride
Sourcepub fn plot_scatter_f32<S: AsRef<str>>(
&self,
label: S,
xs: &[f32],
ys: &[f32],
zs: &[f32],
flags: Scatter3DFlags,
)
pub fn plot_scatter_f32<S: AsRef<str>>( &self, label: S, xs: &[f32], ys: &[f32], zs: &[f32], flags: Scatter3DFlags, )
Convenience: plot a 3D scatter (f32)
Sourcepub fn plot_scatter_f32_raw<S: AsRef<str>>(
&self,
label: S,
xs: &[f32],
ys: &[f32],
zs: &[f32],
flags: Scatter3DFlags,
offset: i32,
stride: i32,
)
pub fn plot_scatter_f32_raw<S: AsRef<str>>( &self, label: S, xs: &[f32], ys: &[f32], zs: &[f32], flags: Scatter3DFlags, offset: i32, stride: i32, )
Raw scatter plot (f32) with offset/stride
Sourcepub fn plot_scatter_f64<S: AsRef<str>>(
&self,
label: S,
xs: &[f64],
ys: &[f64],
zs: &[f64],
flags: Scatter3DFlags,
)
pub fn plot_scatter_f64<S: AsRef<str>>( &self, label: S, xs: &[f64], ys: &[f64], zs: &[f64], flags: Scatter3DFlags, )
Convenience: plot a 3D scatter (f64)
Sourcepub fn plot_scatter_f64_raw<S: AsRef<str>>(
&self,
label: S,
xs: &[f64],
ys: &[f64],
zs: &[f64],
flags: Scatter3DFlags,
offset: i32,
stride: i32,
)
pub fn plot_scatter_f64_raw<S: AsRef<str>>( &self, label: S, xs: &[f64], ys: &[f64], zs: &[f64], flags: Scatter3DFlags, offset: i32, stride: i32, )
Raw scatter plot (f64) with offset/stride
Sourcepub fn plot_triangles_f32<S: AsRef<str>>(
&self,
label: S,
xs: &[f32],
ys: &[f32],
zs: &[f32],
flags: Triangle3DFlags,
)
pub fn plot_triangles_f32<S: AsRef<str>>( &self, label: S, xs: &[f32], ys: &[f32], zs: &[f32], flags: Triangle3DFlags, )
Convenience: plot triangles from interleaved xyz arrays (count must be multiple of 3)
pub fn plot_triangles_f32_raw<S: AsRef<str>>( &self, label: S, xs: &[f32], ys: &[f32], zs: &[f32], flags: Triangle3DFlags, offset: i32, stride: i32, )
Sourcepub fn plot_quads_f32<S: AsRef<str>>(
&self,
label: S,
xs: &[f32],
ys: &[f32],
zs: &[f32],
flags: Quad3DFlags,
)
pub fn plot_quads_f32<S: AsRef<str>>( &self, label: S, xs: &[f32], ys: &[f32], zs: &[f32], flags: Quad3DFlags, )
Convenience: plot quads from interleaved xyz arrays (count must be multiple of 4)
pub fn plot_quads_f32_raw<S: AsRef<str>>( &self, label: S, xs: &[f32], ys: &[f32], zs: &[f32], flags: Quad3DFlags, offset: i32, stride: i32, )
Sourcepub fn plot_triangles_f64<S: AsRef<str>>(
&self,
label: S,
xs: &[f64],
ys: &[f64],
zs: &[f64],
flags: Triangle3DFlags,
)
pub fn plot_triangles_f64<S: AsRef<str>>( &self, label: S, xs: &[f64], ys: &[f64], zs: &[f64], flags: Triangle3DFlags, )
Convenience: plot triangles from interleaved xyz arrays (f64)
pub fn plot_triangles_f64_raw<S: AsRef<str>>( &self, label: S, xs: &[f64], ys: &[f64], zs: &[f64], flags: Triangle3DFlags, offset: i32, stride: i32, )
Sourcepub fn plot_quads_f64<S: AsRef<str>>(
&self,
label: S,
xs: &[f64],
ys: &[f64],
zs: &[f64],
flags: Quad3DFlags,
)
pub fn plot_quads_f64<S: AsRef<str>>( &self, label: S, xs: &[f64], ys: &[f64], zs: &[f64], flags: Quad3DFlags, )
Convenience: plot quads from interleaved xyz arrays (f64)
pub fn plot_quads_f64_raw<S: AsRef<str>>( &self, label: S, xs: &[f64], ys: &[f64], zs: &[f64], flags: Quad3DFlags, offset: i32, stride: i32, )
Source§impl<'ui> Plot3DUi<'ui>
impl<'ui> Plot3DUi<'ui>
Sourcepub fn surface_f32(
&'ui self,
label: impl Into<Cow<'ui, str>>,
xs: &'ui [f32],
ys: &'ui [f32],
zs: &'ui [f32],
) -> Surface3DBuilder<'ui>
pub fn surface_f32( &'ui self, label: impl Into<Cow<'ui, str>>, xs: &'ui [f32], ys: &'ui [f32], zs: &'ui [f32], ) -> Surface3DBuilder<'ui>
Start a surface plot (f32)
Sourcepub fn surface_f32_raw<S: AsRef<str>>(
&self,
label: S,
xs: &[f32],
ys: &[f32],
zs: &[f32],
scale_min: f64,
scale_max: f64,
flags: Surface3DFlags,
offset: i32,
stride: i32,
)
pub fn surface_f32_raw<S: AsRef<str>>( &self, label: S, xs: &[f32], ys: &[f32], zs: &[f32], scale_min: f64, scale_max: f64, flags: Surface3DFlags, offset: i32, stride: i32, )
Raw surface plot (f32) with offset/stride
Sourcepub fn surface_f32_flat<S: AsRef<str>>(
&self,
label: S,
xs_flat: &[f32],
ys_flat: &[f32],
zs: &[f32],
x_count: i32,
y_count: i32,
scale_min: f64,
scale_max: f64,
flags: Surface3DFlags,
offset: i32,
stride: i32,
)
pub fn surface_f32_flat<S: AsRef<str>>( &self, label: S, xs_flat: &[f32], ys_flat: &[f32], zs: &[f32], x_count: i32, y_count: i32, scale_min: f64, scale_max: f64, flags: Surface3DFlags, offset: i32, stride: i32, )
Plot a surface with already flattened per-vertex X/Y arrays (no internal allocation)
Use this when you already have per-vertex xs_flat and ys_flat of length x_count * y_count,
matching the layout of zs. This avoids per-frame allocations for large dynamic grids.
Source§impl<'ui> Plot3DUi<'ui>
impl<'ui> Plot3DUi<'ui>
Sourcepub fn image_by_axes<T: Into<TextureRef>>(
&'ui self,
label: impl Into<Cow<'ui, str>>,
tex: T,
center: [f32; 3],
axis_u: [f32; 3],
axis_v: [f32; 3],
) -> Image3DByAxesBuilder<'ui>
pub fn image_by_axes<T: Into<TextureRef>>( &'ui self, label: impl Into<Cow<'ui, str>>, tex: T, center: [f32; 3], axis_u: [f32; 3], axis_v: [f32; 3], ) -> Image3DByAxesBuilder<'ui>
Image oriented by center and axes
Source§impl<'ui> Plot3DUi<'ui>
Axis helpers
impl<'ui> Plot3DUi<'ui>
Axis helpers
pub fn setup_axes( &self, x_label: &str, y_label: &str, z_label: &str, x_flags: Axis3DFlags, y_flags: Axis3DFlags, z_flags: Axis3DFlags, )
pub fn setup_axis(&self, axis: Axis3D, label: &str, flags: Axis3DFlags)
pub fn setup_axis_limits( &self, axis: Axis3D, min: f64, max: f64, cond: Plot3DCond, )
pub fn setup_axes_limits( &self, x_min: f64, x_max: f64, y_min: f64, y_max: f64, z_min: f64, z_max: f64, cond: Plot3DCond, )
pub fn setup_axis_limits_constraints( &self, axis: Axis3D, v_min: f64, v_max: f64, )
pub fn setup_axis_zoom_constraints(&self, axis: Axis3D, z_min: f64, z_max: f64)
Sourcepub fn setup_axis_ticks_values(
&self,
axis: Axis3D,
values: &[f64],
labels: Option<&[&str]>,
keep_default: bool,
)
pub fn setup_axis_ticks_values( &self, axis: Axis3D, values: &[f64], labels: Option<&[&str]>, keep_default: bool, )
Setup axis ticks using explicit positions and optional labels.
If labels is provided, it must have the same length as values.