Skip to content

types — Core Data Structures

Source: crates/fastdpplot-core/src/types.rs

All three structs are pub and re-exported from the crate root.


DotPoint

A single point in 2-D alignment space with an associated scalar value.

pub struct DotPoint {
    pub x: f64,
    pub y: f64,
    pub value: f32,
}
Field Type Description
x f64 Subject position (column index).
y f64 Query position (row index).
value f32 Identity score, count, expression level, or any per-point scalar.

Note

value is always f32 to keep memory usage half that of f64 — typical normalised scores fit comfortably in 32 bits.


BinGrid

A 2-D histogram grid produced by binning a set of DotPoints.

pub struct BinGrid {
    pub width: usize,
    pub height: usize,
    pub x_min: f64,
    pub x_max: f64,
    pub y_min: f64,
    pub y_max: f64,
    pub counts: Vec<u32>,  // row-major, length = height × width
    pub values: Vec<f32>,  // mean value per bin (0.0 where count == 0)
}
Field Type Description
width usize Number of columns in the grid.
height usize Number of rows in the grid.
x_min/x_max f64 Viewport bounds used for binning.
y_min/y_max f64 Viewport bounds used for binning.
counts Vec<u32> Flat row-major count array, length height × width.
values Vec<f32> Mean value per bin; 0.0 where count == 0.

TileRequest

Parameters for a single tile / viewport request sent from the interactive server.

pub struct TileRequest {
    pub zoom: u32,
    pub x_range: (f64, f64),
    pub y_range: (f64, f64),
    pub canvas_width: usize,
    pub canvas_height: usize,
}
Field Type Description
zoom u32 Zoom level (used by the pyramid builder).
x_range (f64, f64) (x_min, x_max) of the current viewport.
y_range (f64, f64) (y_min, y_max) of the current viewport.
canvas_width usize Pixel width of the rendering canvas.
canvas_height usize Pixel height of the rendering canvas.