![]() |
DriveWorks SDK Reference| 0.6.67 Release |
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... | |
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.
[out] | bearingRadian | Bearing pointing towards 'headingPoint' at given 'position'. |
[in] | position | Position at which the bearing is computed. |
[in] | headingPoint | Second point that defines the direction bearing is pointing towards. |
DW_API_PUBLIC dwStatus dwMaps_computeBounds | ( | dwMapsBounds * | bounds, |
const dwMapsGeoPoint * | p, | ||
float32_t | radiusMeter | ||
) |
Compute WGS84 query bounds from position and radius in meters.
[out] | bounds | Computed bounds |
[in] | p | Center point of query circle |
[in] | radiusMeter | Radius in meters that the bounds need to cover. The Radius is a geodesic system on the earth sphere surface. |
DW_API_PUBLIC dwStatus dwMaps_computeDistance | ( | float32_t * | distance, |
const dwMapsGeoPoint * | p1, | ||
const dwMapsGeoPoint * | p2 | ||
) |
Compute Euclidean distance bewteen two points.
[out] | distance | Euclidean distance between the two points |
[in] | p1 | First point |
[in] | p2 | Second point |
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.
[out] | localToENURotation33 | Rotation 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] | bearingRadian | Bearing in radian. |
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.
[out] | length | Resulting polyline length. |
[in] | points | Pointer to polyline point array. |
[in] | pointCount | Number of points in polyline. |
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.
[out] | otherLane | Neighbor lane. |
[in] | currentLane | Query lane |
[in] | side | DW_MAPS_SIDE_LEFT or DW_MAPS_SIDE_RIGHT |
[in] | offset | Offset defines which neighbor lane is requested, e.g. offset 1 is the direct neighbor, offset 2 is the next one, etc. |
[in] | sideRelativeToDrivingDirection | If 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. |
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.
[out] | laneCount | Optional. Total number of lanes on requested side. |
[out] | laneCountAccessible | Optional. 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] | lane | Query lane |
[in] | side | DW_MAPS_SIDE_LEFT or DW_MAPS_SIDE_RIGHT |
[in] | sideRelativeToDrivingDirection | If 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. |
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.
[out] | srcStartIndex | Index into the source polyline. First point before the interpolation. |
[out] | targetEndIndex | index into the target polyline. First point after the interpolation. |
[in,out] | interpolatedPoints | User buffer to store the interpolation result. |
[in] | srcPoints | Source polyline. |
[in] | srcPointCount | Number of points in source polyline. |
[in] | targetPoints | Target polyline. |
[in] | targetPointCount | Number of points in the target polyline. |
[in] | start | Defines where on the source polyline the interpolation starts. In meters. |
[in] | end | Defines where on the target polyline the interpolation stops. In meters. |
[in] | stepSize | Defines the resolution of the resulting interpolation polyline. In meters. |
[in] | interpolationFn | Callback 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] | interpolationFnContext | Optional user data that is passed on to the interpolation function callback. |
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.
[in,out] | polyline | User provided wgs84 point buffer that gets filled with the result. |
[in] | lanes | List of connected lanes. |
[in] | laneCount | Number of connected lanes. |
[in] | geometrySelection | Selects geometry of the lane to be stitched. |
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.
[in,out] | lineSegments | User provided line segment buffer. |
[in] | laneDividers | The list of lane deviders to process. |
[in] | localOrigin | WGS84 coordinate point, origin of the local coordinate system. |
[in] | localToENURotation33 | 3x3 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] | bounds | Optional bounds in the local coordinate system. No filtering is applied when it is nullptr. |
[in] | directionFilterVector | Optional vector in local space coordinates that defines a direction to compare the line segments against. |
[in] | directionFilterAngleRadian | A line segment is included if the angle between directionFilterVector and the line segment is smaller than given angle. |
[in] | ignoreLaneDirection | If 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. |
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'.
[out] | transformedPoint | Resulting local space point. |
[in] | point | WGS84 point. |
[in] | localOrigin | WGS84 coordinate point, origin of the local coordinate system. |
[in] | localToENURotation33 | 3x3 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. |
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'.
[in,out] | transformedPoints | User provider point buffer for result |
[in] | polylines | Start of polyline array. |
[in] | polylineCount | Number of polylines in the array. |
[in] | localOrigin | WGS84 coordinate point, origin of the local coordinate system. |
[in] | localToENURotation33 | 3x3 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. |
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.
[in,out] | localPolylines | User provided buffer to store local geometry. |
[in,out] | pointBuffer | User provided buffer holding the whole geometry. |
[in] | features | The list of road features to process. |
[in] | localOrigin | WGS84 coordinate point, origin of the local coordinate system. |
[in] | localToENURotation33 | 3x3 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] | localBounds | Optional bounds in the local coordinate system. No filtering is applied when it is nullptr. |