Autoware.Auto
|
|
Namespaces | |
bounding_box | |
Functions and types for generating enclosing bounding boxes around a set of points. | |
details | |
Contains computation geometry functions not intended for the end user to directly use. | |
point_adapter | |
Temporary namespace for point adapter methods, for use with nonstandard point types. | |
spatial_hash | |
All objects related to the spatial hash data structure for efficient near neighbor lookup. | |
Classes | |
class | Interval |
Data structure to contain scalar interval bounds. More... | |
Typedefs | |
using | Point = geometry_msgs::msg::Point32 |
typedef Interval< autoware::common::types::float64_t > | Interval_d |
typedef Interval< autoware::common::types::float32_t > | Interval_f |
Functions | |
template<typename T1 , typename T2 , typename T3 > | |
auto | ccw (const T1 &pt, const T2 &q, const T3 &r) |
compute whether line segment rp is counter clockwise relative to line segment qp More... | |
template<typename T1 , typename T2 > | |
auto | cross_2d (const T1 &pt, const T2 &q) |
compute p x q = p1 * q2 - p2 * q1 More... | |
template<typename T1 , typename T2 > | |
auto | dot_2d (const T1 &pt, const T2 &q) |
compute p * q = p1 * q1 + p2 * q2 More... | |
template<typename T > | |
T | minus_2d (const T &p, const T &q) |
Compute the 2d difference between two points, p - q. More... | |
template<typename T > | |
T | minus_2d (const T &p) |
The unary minus or negation operator applied to a single point's 2d fields. More... | |
template<typename T > | |
T | plus_2d (const T &p, const T &q) |
The 2d addition operation, p + q. More... | |
template<typename T > | |
T | times_2d (const T &p, const float32_t a) |
The scalar multiplication operation, p * a. More... | |
template<typename T > | |
T | intersection_2d (const T &pt, const T &u, const T &q, const T &v) |
solve p + t * u = q + s * v Ref: https://stackoverflow.com/questions/563198/ whats-the-most-efficent-way-to-calculate-where-two-line-segments-intersect More... | |
template<typename T > | |
void | rotate_2d (T &pt, const float32_t cos_th, const float32_t sin_th) |
rotate point given precomputed sin and cos More... | |
template<typename T > | |
T | rotate_2d (const T &pt, const float32_t th_rad) |
rotate by radian angle th in z direction with ccw positive More... | |
template<typename T > | |
T | get_normal (const T &pt) |
compute q s.t. p T q, or p * q = 0 This is the equivalent of a 90 degree ccw rotation More... | |
template<typename T > | |
auto | norm_2d (const T &pt) |
get magnitude of x and y components: More... | |
template<typename T > | |
T | closest_segment_point_2d (const T &p, const T &q, const T &r) |
Compute the closest point on line segment p-q to point r Based on equations from https://stackoverflow.com/a/1501725 and http://paulbourke.net/geometry/pointlineplane/. More... | |
template<typename T > | |
T | closest_line_point_2d (const T &p, const T &q, const T &r) |
Compute the closest point on the line going through p-q to point r. More... | |
template<typename T > | |
auto | point_line_segment_distance_2d (const T &p, const T &q, const T &r) |
Compute the distance from line segment p-q to point r. More... | |
template<typename T > | |
T | make_unit_vector2d (float th) |
Make a 2D unit vector given an angle. More... | |
template<typename OUT = float32_t, typename T1 , typename T2 > | |
OUT | squared_distance_2d (const T1 &a, const T2 &b) |
Compute squared euclidean distance between two points. More... | |
template<typename OUT = float32_t, typename T1 , typename T2 > | |
OUT | distance_2d (const T1 &a, const T2 &b) |
Compute euclidean distance between two points. More... | |
template<typename T > | |
auto | check_point_position_to_line_2d (const T &p1, const T &p2, const T &q) |
Check the given point's position relative the infinite line passing from p1 to p2. Logic based on http://geomalgorithms.com/a01-_area.html#isLeft() More... | |
template<typename IT > | |
bool | all_ordered (const IT begin, const IT end) noexcept |
template<typename IT > | |
auto | area_2d (const IT begin, const IT end) noexcept |
template<typename IT > | |
auto | area_checked_2d (const IT begin, const IT end) |
template<typename IteratorType , typename PointType > | |
bool | is_point_inside_polygon_2d (const IteratorType &start_it, const IteratorType &end_it, const PointType &p) |
Check if the given point is inside or on the edge of the given polygon. More... | |
template<typename T1 , typename T2 > | |
auto | dot_3d (const T1 &pt, const T2 &q) |
compute p * q = p1 * q1 + p2 * q2 + p3 * 13 More... | |
template<typename OUT = float32_t, typename T1 , typename T2 > | |
OUT | squared_distance_3d (const T1 &a, const T2 &b) |
Compute 3D squared euclidean distance between two points. More... | |
template<typename OUT = float32_t, typename T1 , typename T2 > | |
OUT | distance_3d (const T1 &a, const T2 &b) |
Compute 3D euclidean distance between two points. More... | |
template<typename PointT > | |
std::list< PointT >::const_iterator | convex_hull (std::list< PointT > &list) |
A static memory implementation of convex hull computation. Shuffles points around the deque such that the points of the convex hull of the deque of points are first in the deque, with the internal points following in an unspecified order. More... | |
template<typename Iter1 , typename Iter2 > | |
std::vector< std::vector< typename std::iterator_traits< Iter1 >::value_type > > | hull_pockets (const Iter1 polygon_start, const Iter1 polygon_end, const Iter2 convex_hull_start, const Iter2 convex_hull_end) |
Compute a list of "pockets" of a simple polygon (https://en.wikipedia.org/wiki/Simple_polygon), that is, the areas that make up the difference between the polygon and its convex hull. This currently has a bug: More... | |
template<typename Iter > | |
bool | intersect (const Iter begin1, const Iter end1, const Iter begin2, const Iter end2) |
Check if polyhedra defined by two given sets of points intersect. More... | |
template<template< typename ... > class Iterable1T, template< typename ... > class Iterable2T, typename PointT > | |
std::list< PointT > | convex_polygon_intersection2d (const Iterable1T< PointT > &polygon1, const Iterable2T< PointT > &polygon2) |
Get the intersection between two polygons. The polygons should be provided in an identical format to the output of convex_hull function as in the corners should be ordered in a CCW fashion. The computation is done by: More... | |
template<template< typename ... > class Iterable1T, template< typename ... > class Iterable2T, typename PointT > | |
common::types::float32_t | convex_intersection_over_union_2d (const Iterable1T< PointT > &polygon1, const Iterable2T< PointT > &polygon2) |
Compute the intersection over union of two 2d convex polygons. If any of the polygons span a zero area, the result is 0.0. More... | |
using autoware::common::geometry::Point = typedef geometry_msgs::msg::Point32 |
|
noexcept |
Check if all points are ordered in x-y plane (in either clockwise or counter-clockwise direction): This function does not check for convexity
IT | Iterator type pointing to a point containing float x and float y |
[in] | begin | Beginning of point sequence |
[in] | end | One past the last of the point sequence |
|
noexcept |
Compute the area of a convex hull, points are assumed to be ordered (in either CW or CCW)
IT | Iterator type pointing to a point containing float x and float y |
[in] | begin | Iterator pointing to the beginning of the polygon points |
[in] | end | Iterator pointing to one past the last of the polygon points |
auto autoware::common::geometry::area_checked_2d | ( | const IT | begin, |
const IT | end | ||
) |
Compute area of convex hull, throw if points are not ordered (convexity check is not implemented)
std::domain_error | if points are not ordered either CW or CCW |
IT | Iterator type pointing to a point containing float x and float y |
[in] | begin | Iterator pointing to the beginning of the polygon points |
[in] | end | Iterator pointing to one past the last of the polygon points |
|
inline |
compute whether line segment rp is counter clockwise relative to line segment qp
T1,T2,T3 | point type. Must have point adapters defined or have float members x and y |
[in] | pt | shared point for both line segments |
[in] | r | point to check if it forms a ccw angle |
[in] | q | reference point |
|
inline |
Check the given point's position relative the infinite line passing from p1 to p2. Logic based on http://geomalgorithms.com/a01-_area.html#isLeft()
T | T point type. Must have point adapters defined or have float members x and y |
p1 | point 1 laying on the infinite line |
p2 | point 2 laying on the infinite line |
q | point to be checked against the line |
|
inline |
Compute the closest point on the line going through p-q to point r.
T | point type. Must have point adapters defined or have float members x and y |
[in] | p | First point defining the line |
[in] | q | Second point defining the line |
[in] | r | Reference point to find the closest point to |
std::runtime_error | if the two points coincide and hence don't uniquely |
|
inline |
Compute the closest point on line segment p-q to point r Based on equations from https://stackoverflow.com/a/1501725 and http://paulbourke.net/geometry/pointlineplane/.
T | point type. Must have point adapters defined or have float members x and y |
[in] | p | First point defining the line segment |
[in] | q | Second point defining the line segment |
[in] | r | Reference point to find the closest point to |
std::list<PointT>::const_iterator autoware::common::geometry::convex_hull | ( | std::list< PointT > & | list | ) |
A static memory implementation of convex hull computation. Shuffles points around the deque such that the points of the convex hull of the deque of points are first in the deque, with the internal points following in an unspecified order.
The head of the deque will be the point with the smallest x value, with the other points following in a counter-clockwise manner (from a top down view/facing -z direction). If the point list is 3 or smaller, nothing is done (e.g. the ordering result as previously stated does not hold).
[in,out] | list | A list of nodes that will be reordered into a ccw convex hull |
PointT | Type of a point, must have x and y float members |
common::types::float32_t autoware::common::geometry::convex_intersection_over_union_2d | ( | const Iterable1T< PointT > & | polygon1, |
const Iterable2T< PointT > & | polygon2 | ||
) |
Compute the intersection over union of two 2d convex polygons. If any of the polygons span a zero area, the result is 0.0.
Iterable1T | A container class that has stl style iterators defined. |
Iterable2T | A container class that has stl style iterators defined. |
Point1T | Point type that have the adapters for the x and y fields. |
Point2T | Point type that have the adapters for the x and y fields. |
polygon1 | A convex polygon |
polygon2 | A convex polygon |
std::domain_error | If there is any inconsistency on the undderlying geometrical computation. |
std::list<PointT> autoware::common::geometry::convex_polygon_intersection2d | ( | const Iterable1T< PointT > & | polygon1, |
const Iterable2T< PointT > & | polygon2 | ||
) |
Get the intersection between two polygons. The polygons should be provided in an identical format to the output of convex_hull
function as in the corners should be ordered in a CCW fashion. The computation is done by:
Iterable1T | A container class that has stl style iterators defined. |
Iterable2T | A container class that has stl style iterators defined. |
PointT | Point type that have the adapters for the x and y fields. set to Point1T |
polygon1 | A convex polygon |
polygon2 | A convex polygon |
|
inline |
compute p x q = p1 * q2 - p2 * q1
T1,T2 | point type. Must have point adapters defined or have float members x and y |
[in] | pt | first point |
[in] | q | second point |
|
inline |
Compute euclidean distance between two points.
OUT | return type. Type of the returned distance. |
T1 | point type. Must have point adapters defined or have float members x and y |
T2 | point type. Must have point adapters defined or have float members x and y |
a | point 1 |
b | point 2 |
|
inline |
Compute 3D euclidean distance between two points.
T1 | point type. Must have point adapters defined or have float members x y and z |
T2 | point type. Must have point adapters defined or have float members x y and z |
a | point 1 |
b | point 2 |
|
inline |
compute p * q = p1 * q1 + p2 * q2
T1,T2 | point type. Must have point adapters defined or have float members x and y |
[in] | pt | first point |
[in] | q | second point |
|
inline |
compute p * q = p1 * q1 + p2 * q2 + p3 * 13
T1,T2 | point type. Must have point adapters defined or have float members x, y and z |
[in] | pt | first point |
[in] | q | second point |
|
inline |
compute q s.t. p T q, or p * q = 0 This is the equivalent of a 90 degree ccw rotation
T | point type. Must have point adapters defined or have float members x and y |
[in] | pt | point to get normal point of |
std::vector<std::vector<typename std::iterator_traits<Iter1>::value_type> > autoware::common::geometry::hull_pockets | ( | const Iter1 | polygon_start, |
const Iter1 | polygon_end, | ||
const Iter2 | convex_hull_start, | ||
const Iter2 | convex_hull_end | ||
) |
Compute a list of "pockets" of a simple polygon (https://en.wikipedia.org/wiki/Simple_polygon), that is, the areas that make up the difference between the polygon and its convex hull. This currently has a bug:
[in] | polygon_start | Start iterator for the simple polygon (has to be on convex hull) |
[in] | polygon_end | End iterator for the simple polygon |
[in] | convex_hull_start | Start iterator for the convex hull of the simple polygon |
[in] | convex_hull_end | End iterator for the convex hull of the simple polygon |
Iter1 | Iterator to a point type |
Iter2 | Iterator to a point type (can be the same as Iter1, but does not need to be) |
bool autoware::common::geometry::intersect | ( | const Iter | begin1, |
const Iter | end1, | ||
const Iter | begin2, | ||
const Iter | end2 | ||
) |
Check if polyhedra defined by two given sets of points intersect.
Iter | Iterator over point-types that must have point adapters |
[in] | begin1 | Start iterator to first list of point types |
[in] | end1 | End iterator to first list of point types |
[in] | begin2 | Start iterator to first list of point types |
[in] | end2 | End iterator to first list of point types |
|
inline |
solve p + t * u = q + s * v Ref: https://stackoverflow.com/questions/563198/ whats-the-most-efficent-way-to-calculate-where-two-line-segments-intersect
T | point type. Must have point adapters defined or have float members x and y |
[in] | pt | anchor point of first line |
[in] | u | direction of first line |
[in] | q | anchor point of second line |
[in] | v | direction of second line |
std::runtime_error | if lines are (nearly) collinear or parallel |
bool autoware::common::geometry::is_point_inside_polygon_2d | ( | const IteratorType & | start_it, |
const IteratorType & | end_it, | ||
const PointType & | p | ||
) |
Check if the given point is inside or on the edge of the given polygon.
IteratorType | iterator type. The value pointed to by this must have point adapters defined or have float members x and y |
PointType | point type. Must have point adapters defined or have float members x and y |
start_it | iterator pointing to the first vertex of the polygon |
end_it | iterator pointing to the last vertex of the polygon. The vertices should be in order. |
p | point to be searched |
|
inline |
Make a 2D unit vector given an angle.
T | Point type. Must have point adapters defined or have float members x and y |
th | Angle in radians |
T autoware::common::geometry::minus_2d | ( | const T & | p | ) |
The unary minus or negation operator applied to a single point's 2d fields.
T | point type. Must have point adapters defined or have float members x and y |
[in] | p | The left hand side |
T autoware::common::geometry::minus_2d | ( | const T & | p, |
const T & | q | ||
) |
Compute the 2d difference between two points, p - q.
T | point type. Must have point adapters defined or have float members x and y |
[in] | p | The left hand side |
[in] | q | The right hand side |
|
inline |
get magnitude of x and y components:
T | point type. Must have point adapters defined or have float members x and y |
[in] | pt | point to get magnitude of |
T autoware::common::geometry::plus_2d | ( | const T & | p, |
const T & | q | ||
) |
The 2d addition operation, p + q.
T | point type. Must have point adapters defined or have float members x and y |
[in] | p | The left hand side |
[in] | q | The right hand side |
|
inline |
Compute the distance from line segment p-q to point r.
T | point type. Must have point adapters defined or have float members x and y |
[in] | p | First point defining the line segment |
[in] | q | Second point defining the line segment |
[in] | r | Reference point to find the distance from the line segment to |
|
inline |
rotate by radian angle th in z direction with ccw positive
T | point type. Must have point adapters defined or have float members x and y |
[in] | pt | reference point to rotate |
[in] | th_rad | angle by which to rotate point |
|
inline |
rotate point given precomputed sin and cos
T | point type. Must have point adapters defined or have float members x and y |
[in,out] | pt | point to rotate |
[in] | cos_th | precomputed cosine value |
[in] | sin_th | precompined sine value |
|
inline |
Compute squared euclidean distance between two points.
OUT | return type. Type of the returned distance. |
T1 | point type. Must have point adapters defined or have float members x and y |
T2 | point type. Must have point adapters defined or have float members x and y |
a | point 1 |
b | point 2 |
|
inline |
Compute 3D squared euclidean distance between two points.
OUT | return type. Type of the returned distance. |
T1 | point type. Must have point adapters defined or have float members x y and z |
T2 | point type. Must have point adapters defined or have float members x y and z |
a | point 1 |
b | point 2 |
T autoware::common::geometry::times_2d | ( | const T & | p, |
const float32_t | a | ||
) |
The scalar multiplication operation, p * a.
T | point type. Must have point adapters defined or have float members x and y |
[in] | p | The point value |
[in] | a | The scalar value |