Module function_plane
Expand description
FunctionPlane — the world ↔ screen mapping and grid of a pannable,
zoomable function plot (a grapher’s y = f(x) canvas).
Unlike crate::widget::CartesianPlot, whose domain is fitted to its
data, a function plane is an unbounded world the user pans and zooms: the
axes run through the world origin wherever it lands, and the grid steps
follow a 1-2-5 progression so a label never reads 0.30000000000000004.
The host samples its own curves through FunctionPlane::to_screen and
paints them over FunctionPlane::paint_grid.
Structs§
- Function
Plane - A function plot’s viewport:
centeris the world point under the canvas centre andscalethe pixels per world unit (y up in world space).
Functions§
- format_
tick - A tick value at the precision its
stepimplies, without trailing zeros:0.5,2,-0.25, and exactly0at the origin. - nice_
step - The 1-2-5 “nice” step nearest above
rawworld units. Non-finite or non-positive input falls back to1.0. - nice_
ticks - Axis ticks on a 1-2-5 step inside
[min, max]: at mostmax_count, at least two, every one a round number at its step’s precision, so an axis reads 0, 10, 20, 30 instead of 0, 11.5, 23, 34.5. A range too narrow or too odd for two round ticks gets its two ends.