a-b-street / abstreet

Transportation planning and traffic simulation software for creating cities friendlier to walking, biking, and public transit
https://a-b-street.github.io/docs/
Apache License 2.0
7.37k stars 332 forks source link

avoid duplication for series #1137

Closed AnonimAnonim2245 closed 5 months ago

AnonimAnonim2245 commented 5 months ago

I did a refactoring for Series vec! from LinePlot, I avoided the duplication from the original code. For |s| s I used the variable F, because it is a closure which takes the argument s and returns the operation done on the argument. In this case, it was necessary because we were mapping the multiple seconds from 0 to the self.elapsed.inner_second() in the 2d space. In this context s is used as usize so that's why we are using Fn(usize) -> usize.