Polyline Utilities

py123d.geometry.utils.polyline_utils.get_linestring_yaws(linestring)[source]

Compute the heading of each coordinate to its successor coordinate. The last coordinate will have the same heading as the second last coordinate.

Parameters:

linestring (LineString) – linestring as a shapely LineString.

Return type:

ndarray[tuple[Any, ...], dtype[float64]]

Returns:

An array of headings associated to each starting coordinate.

py123d.geometry.utils.polyline_utils.get_points_2d_yaws(points_array)[source]

Compute the heading of each 2D point to its successor point. The last point will have the same heading as the second last point.

Parameters:

points_array (ndarray[tuple[Any, ...], dtype[float64]]) – Array of shape (…, 2) representing 2D points.

Return type:

ndarray[tuple[Any, ...], dtype[float64]]

Returns:

Array of shape (…,) representing the yaw angles of the points.

py123d.geometry.utils.polyline_utils.get_path_progress_2d(points_array)[source]

Compute the cumulative path progress along a series of 2D points.

Parameters:

points_array (ndarray[tuple[Any, ...], dtype[float64]]) – Array of shape (…, 2) representing 2D points.

Raises:

ValueError – If the input points_array is not valid.

Return type:

ndarray[tuple[Any, ...], dtype[float64]]

Returns:

Array of shape (…) representing the cumulative path progress.

py123d.geometry.utils.polyline_utils.get_path_progress_3d(points_array)[source]

Compute the cumulative path progress along a series of 3D points.

Parameters:

points_array (ndarray[tuple[Any, ...], dtype[float64]]) – Array of shape (…, 3) representing 3D points.

Raises:

ValueError – If the input points_array is not valid.

Return type:

ndarray[tuple[Any, ...], dtype[float64]]

Returns:

Array of shape (…) representing the cumulative path progress.

py123d.geometry.utils.polyline_utils.offset_points_perpendicular(points_array, offset)[source]

Offset 2D points or SE2 poses perpendicularly by a given offset.

Parameters:
  • points_array (ndarray[tuple[Any, ...], dtype[float64]]) – Array points of shape (…, 2) representing 2D points or shape (…, 3) representing SE2 poses.

  • offset (float) – Offset distance to apply perpendicularly.

Raises:

ValueError – If the input points_array is not valid.

Return type:

ndarray[tuple[Any, ...], dtype[float64]]

Returns:

Array of shape (…, 2) representing the offset points.