mirror of
https://github.com/a-b-street/abstreet.git
synced 2024-12-24 23:15:24 +03:00
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:
parent
634dc4fad1
commit
3a7f39a6da
@ -151,7 +151,9 @@ impl<T: Yvalue<T>> LinePlot<T> {
|
||||
(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 {
|
||||
closest.add(s.label.clone(), &pts);
|
||||
batch.push(s.color, thick_lineseries(pts, Distance::meters(5.0)));
|
||||
|
Loading…
Reference in New Issue
Block a user