Skip to main content

Module decimate

Module decimate 

Source
Expand description

Fewer points with the same picture: thinning of unsorted lines, one marker per screen cell for dense scatter, and Ramer–Douglas–Peucker simplification of the screen polylines. The tolerances are below what a display can show.

Constants§

LINE_SPACING
Points of an unsorted line closer than this to the last drawn point are skipped.
MARKER_SPACING
Scatter markers keep one per square cell this fraction of their radius wide: a marker in an occupied cell overlaps the first one almost entirely, and the outline of a dense band of markers moves by at most 7 % of the radius.
SIMPLIFY_TOLERANCE
Vertices of a line closer than this (in points) to the straight path between their neighbors are dropped: invisible, and a smooth curve of thousands of samples tessellates as a few hundred vertices.

Functions§

one_per_cell
One marker per cell-sized square of the frame: the first point that lands in it. Unlike thin, a curve that retraces itself (the cycles of a voltammogram) draws its markers once. Points outside the frame (plus a cell) are skipped.
simplify
Ramer–Douglas–Peucker on screen positions: keep the ends and every vertex farther than tolerance from the chord of the stretch it lies in.
thin
Every point at least spacing points (on screen) from the last one kept, plus the last point. Non-finite points are kept, so they still break the line.