Skip to main content

Module lower

Module lower 

Source
Expand description

Lowering plot samples to scene geometry.

A plot’s data marks render by reusing the scene GPU pipelines (the plan’s decision 1), so a mark’s f64 samples must become the scene’s logical geometry: LineData (segments) and PointData (markers / join discs), positioned in scale space at z = 0.

§Coordinates

Each sample (x, y) maps through the axis Scales, relative to a per-axis origin subtracted before the cast to f32, so large absolute coordinates — epoch timestamps especially — keep precision on the GPU (the plan’s decision 7). The orthographic plot camera then maps the visible scale-space window to the data rect.

§Line joins (the reuse-the-pipelines decision)

The scene line pipeline draws each segment as an anti-aliased quad with butt caps, which leave wedge-gaps at angled joins. lower_line fills those by also emitting a round disc (the scene point pipeline draws anti-aliased circles) at every vertex, so joins and end-caps read as clean rounds with no new GPU pipeline. The disc diameter equals the line width and is applied as the PointStyle size by the caller (see docs/PLOT2D_PLAN.md, the resolved polyline risk).

Structs§

LoweredLine
The lowered geometry of a line mark: the connecting segments plus the round join/cap discs that clean up the butt-cap joins.

Functions§

lower_line
Lower a line mark’s samples to connecting LineData plus round join/cap discs (PointData), all in scale space relative to origin. color is applied to every segment and disc.
lower_scatter
Lower a scatter mark’s samples to PointData in scale space relative to origin, each marker coloured color.