Downsample points on a line-series plot for drawing. Otherwise, the arrivals plot on a border intersection in downtown winds up with more than 2^16 points.

This commit is contained in:
Dustin Carlino 2021-02-04 11:27:57 -08:00
parent 634dc4fad1
commit 3a7f39a6da

View File

@ -151,7 +151,9 @@ impl<T: Yvalue<T>> LinePlot<T> {
(1.0 - percent_y) * height, (1.0 - percent_y) * height,
)); ));
} }
pts.dedup(); // Downsample to avoid creating polygons with a huge number of points. 1m is untuned,
// and here "meters" is really pixels.
pts = Pt2D::approx_dedupe(pts, Distance::meters(1.0));
if pts.len() >= 2 { if pts.len() >= 2 {
closest.add(s.label.clone(), &pts); closest.add(s.label.clone(), &pts);
batch.push(s.color, thick_lineseries(pts, Distance::meters(5.0))); batch.push(s.color, thick_lineseries(pts, Distance::meters(5.0)));