averbraeck / opentrafficsim

Open Source Multi-Level Traffic Simulator
BSD 3-Clause "New" or "Revised" License
29 stars 11 forks source link

`Function<Length, Length>` vs. `Function<Double, Double>` for offset and width #170

Closed WJSchakel closed 3 hours ago

WJSchakel commented 3 hours ago

Cross-section slices used to be defined in Length, for position and the value of offset and width. Therefore a Function<Length, Length> was chosen to replace it in function style. However, the position value is not clear. Is it position along the design line of the link, along the continuous center line of the cross-section element, along the flattened design line of the link, or along the flattened center line of the cross-section element?

To avoid confusion, a fractional double position is more clear. For simplicity, we will use Function<Double, Double> rather than Function<Double, Length>. Note that with this change, all geometry in CrossSectionGeometry is double-valued (including also OtsLine2d and Polygon2d).

WJSchakel commented 3 hours ago

This change has simplified temporary code. Now there is only temporary interface ContinuousLine.ContinuousDoubleFunction which FractionalLengthData implements. This changes conclusions mentioned in #169.