Template Function lanelet::geometry::offset

Function Documentation

template<typename LineString2dT>
BasicLineString2d lanelet::geometry::offset(const LineString2dT &lineString, double distance)

create a linestring that is offset to the original one. Guarantees no self-intersections and no inversions in the result.

The offset is generated by shifting points of the line string and making a new line string from them. The distance of any points on the generated line string is guaranteed to be between 1 and sqrt(2) times the specified offset distance. Notice that the reversed case is not true. On angles exceeding 90 degrees, a new point is introduced to the resulting line string to fulfill this guarantee.

Parameters:
  • lineString – linestring to offset

  • distance – offset distance (left = positive)

Throws:
  • InvalidInpuError – if the linestring has less than 2 points

  • GeometryError – if the linestring is partially inverted after applying offset