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.7k stars 342 forks source link

Avoid duplication for Series #1138

Closed AnonimAnonim2245 closed 8 months ago

AnonimAnonim2245 commented 8 months ago

I did a refactoring for vec! from the LIne Plot, 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 returnss the operations 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 by using a tuple. In addition tot this, context s is used as usize so that's why we F(usize) -> usize. Added for Series<Time, usize), because we need to specify the generics X and Y we are working on with for pts which a Vec<X,Y>.

dabreegster commented 8 months ago

Ah, I merged your PR without compiling locally or checking if it was ready for review -- oops! Thanks for the fix