BerkeleyLearnVerify / Scenic

A compiler and scenario generator for the Scenic scenario description language.
https://scenic-lang.org/
Other
271 stars 93 forks source link

LinearElement.flowFrom accuracy #154

Open abol-karimi opened 1 year ago

abol-karimi commented 1 year ago

The built-in function LinearElement.flowFrom does not have a good accuracy, especially for negative distances. I suggest implementing it using curvilinear coordinates. One quick way is to use PolylineRegion.project to project the points to the centerline and using PolylineRegion.poinAlongBy for advancing the point, then offsetting the point perpendicular to the tangent of the centerline with the original projection distance.

Eric-Vin commented 5 months ago

I definitely agree that the accuracy can be lacking in LinearElement.flowFrom (we use a forward Euler approximation as noted in the docstring). A short term solution may be to try using a smaller stepSize, though we'd also be happy to review a PR with a better implementation if you or someone else would like to contribute one.