maliput_sparse
|
Classes | |
struct | BoundPointsResult |
Holds the result of GetBoundPointsAtP method. More... | |
struct | ClosestPointResult |
Holds the result of GetClosestPoint method. More... | |
struct | ClosestPointToSegmentResult |
Holds the result of GetClosestPointToSegment method. More... | |
Typedefs | |
using | ClosestPointResult3d = ClosestPointResult< maliput::math::Vector3 > |
using | ClosestPointResult2d = ClosestPointResult< maliput::math::Vector2 > |
using | ClosestPointToSegmentResult3d = ClosestPointToSegmentResult< maliput::math::Vector3 > |
using | ClosestPointToSegmentResult2d = ClosestPointToSegmentResult< maliput::math::Vector2 > |
using | OptDistance = std::optional< double > |
using | Segment3d = std::pair< Vector3, Vector3 > |
using | Segment2d = std::pair< Vector2, Vector2 > |
Functions | |
LineString3d | ComputeCenterline3d (const LineString3d &left, const LineString3d &right) |
Computes a 3-dimensional centerline out of the left and right line string. More... | |
template<typename CoordinateT = maliput::math::Vector3> | |
CoordinateT | InterpolatedPointAtP (const LineString< CoordinateT > &line_string, double p, double tolerance) |
Returns the piecewise linearly interpolated point at the given distance and the distance from the beginning to the first point. More... | |
double | GetSlopeAtP (const LineString3d &line_string, double p, double tolerance) |
Returns the slope of a line_string for a given p . More... | |
template<typename CoordinateT = maliput::math::Vector3> | |
BoundPointsResult | GetBoundPointsAtP (const LineString< CoordinateT > &line_string, double p, double tolerance) |
Obtains the points that confines p in the line_string . More... | |
double | Get2DHeadingAtP (const LineString3d &line_string, double p, double tolerance) |
Returns the heading of a line_string for a given p . More... | |
maliput::math::Vector2 | Get2DTangentAtP (const LineString3d &line_string, double p, double tolerance) |
Returns the 2d-tangent of a line_string for a given p . More... | |
maliput::math::Vector3 | GetTangentAtP (const LineString3d &line_string, double p, double tolerance) |
Returns the 3d-tangent of a line_string for a given p . More... | |
template<typename CoordinateT = maliput::math::Vector3> | |
ClosestPointToSegmentResult< CoordinateT > | GetClosestPointToSegment (const CoordinateT &start_segment_point, const CoordinateT &end_segment_point, const CoordinateT &coordinate, double tolerance) |
Gets the closest point in the segment to the given xyz point. More... | |
ClosestPointResult3d | GetClosestPoint (const LineString3d &line_string, const maliput::math::Vector3 &xyz, double tolerance) |
Gets the closest point in the line_string to the given xyz point. More... | |
ClosestPointResult3d | GetClosestPointUsing2dProjection (const LineString3d &line_string, const maliput::math::Vector3 &xyz, double tolerance) |
Gets the closest point in the line_string to the given xyz point. More... | |
double | ComputeDistance (const LineString3d &lhs, const LineString3d &rhs, double tolerance) |
Computes the distance between two LineString3d. More... | |
template maliput::math::Vector3 | InterpolatedPointAtP (const LineString3d &, double, double) |
template ClosestPointToSegmentResult3d | GetClosestPointToSegment (const maliput::math::Vector3 &, const maliput::math::Vector3 &, const maliput::math::Vector3 &, double) |
template ClosestPointToSegmentResult2d | GetClosestPointToSegment (const maliput::math::Vector2 &, const maliput::math::Vector2 &, const maliput::math::Vector2 &, double) |
template BoundPointsResult | GetBoundPointsAtP< maliput::math::Vector3 > (const LineString3d &, double, double) |
Variables | |
static constexpr bool | kLeft {true} |
static constexpr bool | kRight {false} |
static constexpr double | kEpsilon {1e-12} |
using ClosestPointResult2d = ClosestPointResult<maliput::math::Vector2> |
using ClosestPointResult3d = ClosestPointResult<maliput::math::Vector3> |
using ClosestPointToSegmentResult2d = ClosestPointToSegmentResult<maliput::math::Vector2> |
using ClosestPointToSegmentResult3d = ClosestPointToSegmentResult<maliput::math::Vector3> |
using OptDistance = std::optional<double> |
using Segment2d = std::pair<Vector2, Vector2> |
using Segment3d = std::pair<Vector3, Vector3> |
LineString3d ComputeCenterline3d | ( | const LineString3d & | left, |
const LineString3d & | right | ||
) |
Computes a 3-dimensional centerline out of the left
and right
line string.
Inspired on https://github.com/fzi-forschungszentrum-informatik/Lanelet2/blob/master/lanelet2_core/src/Lanelet.cpp
left | Left line string. |
right | Right line string. |
double ComputeDistance | ( | const LineString3d & | lhs, |
const LineString3d & | rhs, | ||
double | tolerance | ||
) |
Computes the distance between two LineString3d.
The distance is calculated as the sum of distances between corresponding points between both line strings divided by the number of points. Some notes: 1 - The evaluation points to be used are the ones from the line string with more points. 2 - If the line strings have the same number of points, the evaluation points are the ones from the first line string. 3 - The closest point is calculated for each point in the line string with less points using #ref GetClosestPoint method.
This algorithm is not the most precise one, but it is the most intuitive one and for the expected use cases it is good enough.
TODO(#CreateIssue): Use Frechet distance algorithm instead.
lhs | A LineString3d. |
rhs | A LineString3d. |
tolerance | tolerance. |
double Get2DHeadingAtP | ( | const LineString3d & | line_string, |
double | p, | ||
double | tolerance | ||
) |
Returns the heading of a line_string
for a given p
.
line_string | LineString to be computed the heading from. |
p | P parameter at which compute the heading. |
tolerance | tolerance. |
maliput::common::assertion_error | When p ∉ [0., line_string.length()] . |
Vector2 Get2DTangentAtP | ( | const LineString3d & | line_string, |
double | p, | ||
double | tolerance | ||
) |
Returns the 2d-tangent of a line_string
for a given p
.
The tangent is calculated from the line_string
projected on the xy plane.
line_string | LineString to be computed the 2d-tangent from. |
p | P parameter at which compute the 2d-tangent. |
tolerance | tolerance. |
maliput::common::assertion_error | When p ∉ [0., line_string.length()] . |
BoundPointsResult GetBoundPointsAtP | ( | const LineString< CoordinateT > & | line_string, |
double | p, | ||
double | tolerance | ||
) |
Obtains the points that confines p
in the line_string
.
CoordinateT | The coordinate type of the line_string . |
line_string | LineString. |
p | P parameter. |
tolerance | tolerance. |
maliput::common::assertion_error | When p ∉ [0., line_string.length()] . |
template BoundPointsResult maliput_sparse::geometry::utility::GetBoundPointsAtP< maliput::math::Vector3 > | ( | const LineString3d & | , |
double | , | ||
double | |||
) |
ClosestPointResult3d GetClosestPoint | ( | const LineString3d & | line_string, |
const maliput::math::Vector3 & | xyz, | ||
double | tolerance | ||
) |
Gets the closest point in the line_string
to the given xyz
point.
line_string | LineString3d to be computed the closest point from. |
xyz | Point to be computed the closest point to. |
tolerance | tolerance. |
xyz
and the p coordinate in the LineString3d matching the closest point. ClosestPointToSegmentResult< CoordinateT > GetClosestPointToSegment | ( | const CoordinateT & | start_segment_point, |
const CoordinateT & | end_segment_point, | ||
const CoordinateT & | coordinate, | ||
double | tolerance | ||
) |
Gets the closest point in the segment
to the given xyz
point.
CoordinateT | The coordinate type of the segment . |
start_segment_point | Start point of the segment. |
end_segment_point | End point of the segment. |
coordinate | Point to be computed the closest point to. |
tolerance | tolerance. |
xyz
and the p coordinate in the segment matching the closest point. template ClosestPointToSegmentResult2d maliput_sparse::geometry::utility::GetClosestPointToSegment | ( | const maliput::math::Vector2 & | , |
const maliput::math::Vector2 & | , | ||
const maliput::math::Vector2 & | , | ||
double | |||
) |
template ClosestPointToSegmentResult3d maliput_sparse::geometry::utility::GetClosestPointToSegment | ( | const maliput::math::Vector3 & | , |
const maliput::math::Vector3 & | , | ||
const maliput::math::Vector3 & | , | ||
double | |||
) |
ClosestPointResult3d GetClosestPointUsing2dProjection | ( | const LineString3d & | line_string, |
const maliput::math::Vector3 & | xyz, | ||
double | tolerance | ||
) |
Gets the closest point in the line_string
to the given xyz
point.
This method is similar to #ref GetClosestPoint, but it first projects the line_string
and the xyz
on the xy plane for finding the closest point. Once the closest point in the plane is found, the z coordinate is recovered from the line_string
and the rest of the ClosestPointResult3d struct is filled.
line_string | LineString3d to be computed the closest point from. |
xyz | Point to be computed the closest point to. |
tolerance | Tolerance. |
xyz
double GetSlopeAtP | ( | const LineString3d & | line_string, |
double | p, | ||
double | tolerance | ||
) |
Returns the slope of a line_string
for a given p
.
The slope is calculated as the variation in z
divided by the variation in the xy
plane. The result is expected to be contained within (-inf., inf.).
line_string | LineString to be computed the slope from. |
p | P parameter at which compute the slope. |
tolerance | tolerance. |
maliput::common::assertion_error | When p ∉ [0., line_string.length()] . |
maliput::common::assertion_error | When the points that confine p are equal. |
Vector3 GetTangentAtP | ( | const LineString3d & | line_string, |
double | p, | ||
double | tolerance | ||
) |
Returns the 3d-tangent of a line_string
for a given p
.
line_string | LineString to be computed the 3d-tangent from. |
p | P parameter at which compute the 3d-tangent. |
tolerance | tolerance. |
maliput::common::assertion_error | When p ∉ [0., line_string.length()] . |
template maliput::math::Vector2 InterpolatedPointAtP | ( | const LineString3d & | , |
double | , | ||
double | |||
) |
CoordinateT InterpolatedPointAtP | ( | const LineString< CoordinateT > & | line_string, |
double | p, | ||
double | tolerance | ||
) |
Returns the piecewise linearly interpolated point at the given distance and the distance from the beginning to the first point.
CoordinateT | The coordinate type of the line_string . |
line_string | the line_string to iterate. |
p | distance along line_string. |
tolerance | tolerance. |
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |