DriveWorks SDK Reference

| 0.6.67 Release

Utilities

Detailed Description

Utility functions for map data.

Various utility functions to deal with map data, including coordinate transformation, helpers to create input structs, etc.

Functions

DW_API_PUBLIC dwStatus dwMaps_computeBearing (float64_t *bearingRadian, const dwMapsGeoPoint *position, const dwMapsGeoPoint *headingPoint)
 Compute bearing in radian from two points. More...
 
DW_API_PUBLIC dwStatus dwMaps_computeBounds (dwMapsBounds *bounds, const dwMapsGeoPoint *p, float32_t radiusMeter)
 Compute WGS84 query bounds from position and radius in meters. More...
 
DW_API_PUBLIC dwStatus dwMaps_computeDistance (float32_t *distance, const dwMapsGeoPoint *p1, const dwMapsGeoPoint *p2)
 Compute Euclidean distance bewteen two points. More...
 
DW_API_PUBLIC dwStatus dwMaps_computeLocalToENU (dwMatrix3d *localToENURotation33, float32_t bearingRadian)
 Create a rotation matrix that transfroms from a local coordinate system with x-axis pointing towards bearing into the ENU coordinate system. More...
 
DW_API_PUBLIC dwStatus dwMaps_computePolylineLength (float32_t *length, const dwMapsGeoPoint *points, uint32_t pointCount)
 Compute length of a polyline of wgs84 points in meters. More...
 
DW_API_PUBLIC dwStatus dwMaps_getNeighborLane (const dwMapsLane **otherLane, const dwMapsLane *currentLane, dwMapsSide side, uint32_t offset, dwBool sideRelativeToDrivingDirection)
 Get a neighbor lane on a given side. More...
 
DW_API_PUBLIC dwStatus dwMaps_getNeighborLaneCount (uint32_t *laneCount, uint32_t *laneCountAccessible, const dwMapsLane *lane, dwMapsSide side, dwBool sideRelativeToDrivingDirection)
 Get the number of lanes on the current road segment next to a given lane. More...
 
DW_API_PUBLIC dwStatus dwMaps_interpolatePolylines (uint32_t *srcStartIndex, uint32_t *targetEndIndex, dwMapsGeoPointBuffer *interpolatedPoints, const dwMapsGeoPoint *srcPoints, uint32_t srcPointCount, const dwMapsGeoPoint *targetPoints, uint32_t targetPointCount, float32_t start, float32_t end, float32_t stepSize, float32_t(*interpolationFn)(float32_t, void *), void *interpolationFnContext)
 Interpolate between 2 polylines. More...
 
DW_API_PUBLIC dwStatus dwMaps_stitchLaneGeometry (dwMapsGeoPointBuffer *polyline, const dwMapsLane *lanes, uint32_t laneCount, dwMapsLaneGeometry geometrySelection)
 Stitches the poylines of a list of lanes into a single polyline. More...
 
DW_API_PUBLIC dwStatus dwMaps_transformLaneDividersToLocalLines (dwMapsLaneDividerLineBuffer *lineSegments, const dwMapsLaneDividerBuffer *laneDividers, const dwMapsGeoPoint *localOrigin, const float64_t *localToENURotation33, const dwMapsLocalBounds *bounds, const dwVector3f *directionFilterVector, float32_t directionFilterAngleRadian, dwBool ignoreLaneDirection)
 Get line segments from the list of specified dividers, transformed into a local cartesian coordinate system defined by position 'localOrigin', rotation matrix 'localToENURotation33', optionally filtered by orientation and bounds in local coordinate. More...
 
DW_API_PUBLIC dwStatus dwMaps_transformPoint (dwVector3f *transformedPoint, const dwMapsGeoPoint *point, const dwMapsGeoPoint *localOrigin, const float64_t *localToENURotation33)
 Transform a WGS84 point into a point in a local coordinate system defined by position 'localOrigin' and ration matrix 'localToENURotation33'. More...
 
DW_API_PUBLIC dwStatus dwMaps_transformPolylines (dwMapsPointBuffer *transformedPoints, const dwMapsGeoPolyline *polylines, uint32_t polylineCount, const dwMapsGeoPoint *localOrigin, const float64_t *localToENURotation33)
 Transform polylines into points in a local coordinate system defined by position 'localOrigin' and rotation matrix 'localToENURotation33'. More...
 
DW_API_PUBLIC dwStatus dwMaps_transformRoadFeaturesToLocalSpace (dwMapsPolyline3fBuffer *localPolylines, dwMapsPointBuffer *pointBuffer, const dwMapsFeatureBuffer *features, const dwMapsGeoPoint *localOrigin, const float64_t *localToENURotation33, const dwMapsLocalBounds *localBounds)
 Get geometry from the list of specified road features, transformed into a local cartesian coordinate system defined by position 'localOrigin' and rotation matrix 'localToENURotation33', optionally filtered by bounds in local coordinate system. More...
 

Function Documentation

◆ dwMaps_computeBearing()

DW_API_PUBLIC dwStatus dwMaps_computeBearing ( float64_t bearingRadian,
const dwMapsGeoPoint position,
const dwMapsGeoPoint headingPoint 
)

Compute bearing in radian from two points.

'bearingRadian' is the angle relative to 'north' direction, increasing clockwise from 0 to 2*Pi.

Parameters
[out]bearingRadianBearing pointing towards 'headingPoint' at given 'position'.
[in]positionPosition at which the bearing is computed.
[in]headingPointSecond point that defines the direction bearing is pointing towards.
Returns
DW_SUCCESS Successfully computed bearing.
DW_INVALID_ARGUMENT One or more parameters is a nullptr.

◆ dwMaps_computeBounds()

DW_API_PUBLIC dwStatus dwMaps_computeBounds ( dwMapsBounds bounds,
const dwMapsGeoPoint p,
float32_t  radiusMeter 
)

Compute WGS84 query bounds from position and radius in meters.

Parameters
[out]boundsComputed bounds
[in]pCenter point of query circle
[in]radiusMeterRadius in meters that the bounds need to cover. The Radius is a geodesic system on the earth sphere surface.
Returns
DW_SUCCESS Successfully computed maps bounds for given circle on earth sphere.
DW_INVALID_ARGUMENT 'bounds' or 'p' is a nullptr.

◆ dwMaps_computeDistance()

DW_API_PUBLIC dwStatus dwMaps_computeDistance ( float32_t distance,
const dwMapsGeoPoint p1,
const dwMapsGeoPoint p2 
)

Compute Euclidean distance bewteen two points.

Parameters
[out]distanceEuclidean distance between the two points
[in]p1First point
[in]p2Second point
Returns
DW_SUCCESS Successfully computed distance DW_INVALID_ARGUMENT On or more parameters are a nullptr.

◆ dwMaps_computeLocalToENU()

DW_API_PUBLIC dwStatus dwMaps_computeLocalToENU ( dwMatrix3d localToENURotation33,
float32_t  bearingRadian 
)

Create a rotation matrix that transfroms from a local coordinate system with x-axis pointing towards bearing into the ENU coordinate system.

Parameters
[out]localToENURotation33Rotation matrix that transforms from a right-handed local coordinate system with x-axis pointing towards 'bearing' and z-axis pointing up, into a local cartesian coordinate system with x-axis pointing east and y-axis pointing north) (east-north-up, ENU).
[in]bearingRadianBearing in radian.
Returns
DW_SUCCESS Successfully computed rotation matrix.
DW_INVALID_ARGUMENT 'localToENURotation33 is a nullptr'.

◆ dwMaps_computePolylineLength()

DW_API_PUBLIC dwStatus dwMaps_computePolylineLength ( float32_t length,
const dwMapsGeoPoint points,
uint32_t  pointCount 
)

Compute length of a polyline of wgs84 points in meters.

Parameters
[out]lengthResulting polyline length.
[in]pointsPointer to polyline point array.
[in]pointCountNumber of points in polyline.
Returns
DW_SUCCESS Successfully computed polyline length DW_INVALID_ARGUMENT 'length' or 'points' is a nullptr.

◆ dwMaps_getNeighborLane()

DW_API_PUBLIC dwStatus dwMaps_getNeighborLane ( const dwMapsLane **  otherLane,
const dwMapsLane currentLane,
dwMapsSide  side,
uint32_t  offset,
dwBool  sideRelativeToDrivingDirection 
)

Get a neighbor lane on a given side.

Parameters
[out]otherLaneNeighbor lane.
[in]currentLaneQuery lane
[in]sideDW_MAPS_SIDE_LEFT or DW_MAPS_SIDE_RIGHT
[in]offsetOffset defines which neighbor lane is requested, e.g. offset 1 is the direct neighbor, offset 2 is the next one, etc.
[in]sideRelativeToDrivingDirectionIf true, the side is relative to the driving direction of the query lane. This means it is only defined if the lane has driving direction DW_MAPS_DIRECTION_FORWARD or DW_MAPS_DIRECTION_BACKWARD. Otherwise, the semantics of 'side' is relative to the geometry polyline direction.
Returns
DW_SUCCESS Neighbor lane has been successfully returned.
DW_INVALID_ARGUMENT 'side' may not be DW_MAPS_SIDE_NONE.
DW_NOT_AVAILABLE no neighbor has been found with the provided parameters.

◆ dwMaps_getNeighborLaneCount()

DW_API_PUBLIC dwStatus dwMaps_getNeighborLaneCount ( uint32_t *  laneCount,
uint32_t *  laneCountAccessible,
const dwMapsLane lane,
dwMapsSide  side,
dwBool  sideRelativeToDrivingDirection 
)

Get the number of lanes on the current road segment next to a given lane.

Parameters
[out]laneCountOptional. Total number of lanes on requested side.
[out]laneCountAccessibleOptional. Accessible number of lanes on requested side. A Lane is accessible when a lane change from the query lane to a neighbor lane is possible.
[in]laneQuery lane
[in]sideDW_MAPS_SIDE_LEFT or DW_MAPS_SIDE_RIGHT
[in]sideRelativeToDrivingDirectionIf true, the side is relative to the driving direction of the query lane. This means it is only defined if the lane has driving direction DW_MAPS_DIRECTION_FORWARD or DW_MAPS_DIRECTION_BACKWARD. Otherwise, the semantics of 'side' is relative to the geometry polyline direction.
Returns
DW_SUCCESS Lane counts have been returned successfully
DW_INVALID_ARGUMENT 'side' may not be DW_MAPS_SIDE_NONE

◆ dwMaps_interpolatePolylines()

DW_API_PUBLIC dwStatus dwMaps_interpolatePolylines ( uint32_t *  srcStartIndex,
uint32_t *  targetEndIndex,
dwMapsGeoPointBuffer interpolatedPoints,
const dwMapsGeoPoint srcPoints,
uint32_t  srcPointCount,
const dwMapsGeoPoint targetPoints,
uint32_t  targetPointCount,
float32_t  start,
float32_t  end,
float32_t  stepSize,
float32_t(*)(float32_t, void *)  interpolationFn,
void *  interpolationFnContext 
)

Interpolate between 2 polylines.

This function interpolates between two polylines, creating a smooth polyline that connects the source polyline to the target polyline. The interpolation starts at 'start' on the source polyline and ends at 'end' of the target polyline. These values are defined in meters along the source and target polylines. Between 'start' and 'end', at each step, defined by 'stepSize', a new interpolated point is added to the result polyline.

Parameters
[out]srcStartIndexIndex into the source polyline. First point before the interpolation.
[out]targetEndIndexindex into the target polyline. First point after the interpolation.
[in,out]interpolatedPointsUser buffer to store the interpolation result.
[in]srcPointsSource polyline.
[in]srcPointCountNumber of points in source polyline.
[in]targetPointsTarget polyline.
[in]targetPointCountNumber of points in the target polyline.
[in]startDefines where on the source polyline the interpolation starts. In meters.
[in]endDefines where on the target polyline the interpolation stops. In meters.
[in]stepSizeDefines the resolution of the resulting interpolation polyline. In meters.
[in]interpolationFnCallback to define the interpolation function. Argument to the function is a value between 0.0f and 1.0f that correspond to positions on the source and target lanes between 'start' and 'end'. The function should return a value between 0.0f and 1.0f, defining the weight of the source lane at that point. If nullptr, linear interpolation is applied.
[in]interpolationFnContextOptional user data that is passed on to the interpolation function callback.
Returns
DW_SUCCESS Successfully interpolated.
DW_INVALID_ARGUMENT Interpolation was not possible with given 'start' and 'end' values, or input polylines are invalid.

◆ dwMaps_stitchLaneGeometry()

DW_API_PUBLIC dwStatus dwMaps_stitchLaneGeometry ( dwMapsGeoPointBuffer polyline,
const dwMapsLane lanes,
uint32_t  laneCount,
dwMapsLaneGeometry  geometrySelection 
)

Stitches the poylines of a list of lanes into a single polyline.

Parameters
[in,out]polylineUser provided wgs84 point buffer that gets filled with the result.
[in]lanesList of connected lanes.
[in]laneCountNumber of connected lanes.
[in]geometrySelectionSelects geometry of the lane to be stitched.
Returns
DW_SUCCESS Successfully return a stitched polyline for the input lanes. DW_NOT_AVAILABLE Could not successfully stitch the geometry of all lanes in the provided list. This can happen if some lanes in the list don't refer to a lane divider. DW_INVALID_ARGUMENT polyline of lanes is a nullptr.

◆ dwMaps_transformLaneDividersToLocalLines()

DW_API_PUBLIC dwStatus dwMaps_transformLaneDividersToLocalLines ( dwMapsLaneDividerLineBuffer lineSegments,
const dwMapsLaneDividerBuffer laneDividers,
const dwMapsGeoPoint localOrigin,
const float64_t localToENURotation33,
const dwMapsLocalBounds bounds,
const dwVector3f directionFilterVector,
float32_t  directionFilterAngleRadian,
dwBool  ignoreLaneDirection 
)

Get line segments from the list of specified dividers, transformed into a local cartesian coordinate system defined by position 'localOrigin', rotation matrix 'localToENURotation33', optionally filtered by orientation and bounds in local coordinate.

Parameters
[in,out]lineSegmentsUser provided line segment buffer.
[in]laneDividersThe list of lane deviders to process.
[in]localOriginWGS84 coordinate point, origin of the local coordinate system.
[in]localToENURotation333x3 Rotation matrix that transforms from local coordinate system (x: forward, y: left, z: up) into ENU local cartesian coordinate system with origin at point 'localOrigin' (x: east, y: north, z: up). z coordinate of ENU is the normal of the earth spheroid at point 'localOrigin'. No rotation is applied if localToENURotation33 is nullptr, meaning x-axis points east.
[in]boundsOptional bounds in the local coordinate system. No filtering is applied when it is nullptr.
[in]directionFilterVectorOptional vector in local space coordinates that defines a direction to compare the line segments against.
[in]directionFilterAngleRadianA line segment is included if the angle between directionFilterVector and the line segment is smaller than given angle.
[in]ignoreLaneDirectionIf true, the angle check is applied on both sides of the line segment. Otherwise, the angle check on the line segment happens in driving direction of the corresponding lane only. Also, only lane dividers that correspond to drivable lanes are returned if ignoreLaneDirection is false.
Returns
DW_SUCCESS If the call was successful.
DW_INVALID_ARGUMENT 'lineSegments', 'localOrigin', 'laneDividers' is a nullptr,
or maxSize of 'lineSegments' is not big enough.
DW_INTERNAL_ERROR Unexpected internal sanity check failure.
DW_BAD_CAST Could not successfully cast handle to map object.

◆ dwMaps_transformPoint()

DW_API_PUBLIC dwStatus dwMaps_transformPoint ( dwVector3f transformedPoint,
const dwMapsGeoPoint point,
const dwMapsGeoPoint localOrigin,
const float64_t localToENURotation33 
)

Transform a WGS84 point into a point in a local coordinate system defined by position 'localOrigin' and ration matrix 'localToENURotation33'.

Parameters
[out]transformedPointResulting local space point.
[in]pointWGS84 point.
[in]localOriginWGS84 coordinate point, origin of the local coordinate system.
[in]localToENURotation333x3 Rotation matrix that transforms from local coordinate system (x: forward, y: left, z: up) into ENU local cartesian coordinate system with origin at point 'localOrigin' (x: east, y: north, z: up). z coordinate of ENU is the normal of the earth spheroid at point 'localOrigin'. No rotation is applied if localToENURotation33 is nullptr, meaning x-axis points east.
Returns
DW_SUCCESS Successfully transformed 'point' into euclidean local space.
DW_INVALID_ARGUMENT 'transformedPoint', 'point' or 'localOrigin' is a nullptr.

◆ dwMaps_transformPolylines()

DW_API_PUBLIC dwStatus dwMaps_transformPolylines ( dwMapsPointBuffer transformedPoints,
const dwMapsGeoPolyline polylines,
uint32_t  polylineCount,
const dwMapsGeoPoint localOrigin,
const float64_t localToENURotation33 
)

Transform polylines into points in a local coordinate system defined by position 'localOrigin' and rotation matrix 'localToENURotation33'.

Parameters
[in,out]transformedPointsUser provider point buffer for result
[in]polylinesStart of polyline array.
[in]polylineCountNumber of polylines in the array.
[in]localOriginWGS84 coordinate point, origin of the local coordinate system.
[in]localToENURotation333x3 Rotation matrix that transforms from local coordinate system (x: forward, y: left, z: up) into ENU local cartesian coordinate system with origin at point 'localOrigin' (x: east, y: north, z: up). z coordinate of ENU is the normal of the earth spheroid at point 'localOrigin'. No rotation is applied if localToENURotation33 is nullptr, meaning x-axis points east.
Returns
DW_SUCCESS Successfully transformed WGS84 polylines into euclidean local space.
DW_INVALID_ARGUMENT 'transformedPoints', 'polylines', or 'localOrigin' is a nullptr, or maxSize of 'transformedPoints' is not big enough.

◆ dwMaps_transformRoadFeaturesToLocalSpace()

DW_API_PUBLIC dwStatus dwMaps_transformRoadFeaturesToLocalSpace ( dwMapsPolyline3fBuffer localPolylines,
dwMapsPointBuffer pointBuffer,
const dwMapsFeatureBuffer features,
const dwMapsGeoPoint localOrigin,
const float64_t localToENURotation33,
const dwMapsLocalBounds localBounds 
)

Get geometry from the list of specified road features, transformed into a local cartesian coordinate system defined by position 'localOrigin' and rotation matrix 'localToENURotation33', optionally filtered by bounds in local coordinate system.

Parameters
[in,out]localPolylinesUser provided buffer to store local geometry.
[in,out]pointBufferUser provided buffer holding the whole geometry.
[in]featuresThe list of road features to process.
[in]localOriginWGS84 coordinate point, origin of the local coordinate system.
[in]localToENURotation333x3 Rotation matrix that transforms from local coordinate system (x: forward, y: left, z: up) into ENU local cartesian coordinate system with origin at point 'localOrigin' (x: east, y: north, z: up). z coordinate of ENU is the normal of the earth spheroid at point 'localOrigin'. No rotation is applied if localToENURotation33 is nullptr, meaning x-axis points east.
[in]localBoundsOptional bounds in the local coordinate system. No filtering is applied when it is nullptr.
Returns
DW_SUCCESS If the call was successful.
DW_INVALID_ARGUMENT 'localPolylines', 'pointBuffer', 'features', 'localOrigin' is a nullptr,
or maxSize of 'localPolylines' or 'pointBuffer' is not big enough.
DW_INTERNAL_ERROR Unexpected internal sanity check failure.
DW_BAD_CAST Could not successfully cast handle to map object.