maliput_sparse
|
Defines a polyline in the CoordinateT
domain composed of at least 2 points.
CoordinateT | The coordinate point type to be used. |
DistanceFunction | The function to compute the distance with. By default, the Euclidean distance is used. |
#include <include/maliput_sparse/geometry/line_string.h>
Classes | |
class | Point |
Extends the CoordinateT class with information about the index of the coordinate in the LineString and the \( p \) value up-to the coordinate in the parametrized LineString. More... | |
struct | Segment |
A segment of a LineString. More... | |
Public Types | |
using | iterator = typename std::vector< CoordinateT >::iterator |
using | const_iterator = typename std::vector< CoordinateT >::const_iterator |
using | Segments = std::map< typename Segment::Interval, Segment > |
using | KDTree = maliput::math::KDTree< Point, CoordinateT::kDimension > |
Public Member Functions | |
LineString (const std::vector< CoordinateT > &coordinates) | |
Constructs a LineString from a std::vector. More... | |
LineString (std::initializer_list< CoordinateT > coordinates) | |
Constructs a LineString form an initializer list. More... | |
template<typename Iterator > | |
LineString (Iterator begin, Iterator end) | |
Constructs a LineString form the begin and end iterators. More... | |
const CoordinateT & | first () const |
const CoordinateT & | last () const |
const CoordinateT & | at (size_t i) const |
size_t | size () const |
double | length () const |
const Segments & | segments () const |
Return the segments of this LineString. More... | |
const std::vector< Point > & | points () const |
Return the points of this LineString. More... | |
const KDTree * | kd_tree () const |
Get KD Tree of the LineString. More... | |
iterator | begin () |
const_iterator | begin () const |
iterator | end () |
const_iterator | end () const |
const CoordinateT & | operator[] (std::size_t index) const |
CoordinateT & | operator[] (std::size_t index) |
bool | operator== (const LineString< CoordinateT, DistanceFunction > &other) const |
Equality operator. More... | |
using const_iterator = typename std::vector<CoordinateT>::const_iterator |
using Segments = std::map<typename Segment::Interval, Segment> |
|
explicit |
Constructs a LineString from a std::vector.
This function calls LineString(coordinates.begin, coordinates.end)
coordinates | A vector of CoordinateT to define this LineString. |
|
explicit |
Constructs a LineString form an initializer list.
This function calls LineString(coordinates.begin, coordinates.end)
coordinates | An initializer list to define this LineString. |
LineString | ( | Iterator | begin, |
Iterator | end | ||
) |
Constructs a LineString form the begin and end iterators.
After loading the coordinates, this iterates through the list of points and computes the total length. This operation is O(n) in the list size.
begin | The initial iterator. |
end | The final iterator. |
Iterator | the iterator type. |
maliput::common::assertion_error | When there are less than two points. |
const CoordinateT& at | ( | size_t | i | ) | const |
i
index in the LineString. std::out_of_range | When i is not in [0, size()) bounds. |
iterator begin | ( | ) |
const_iterator begin | ( | ) | const |
iterator end | ( | ) |
const_iterator end | ( | ) | const |
const CoordinateT& first | ( | ) | const |
const KDTree* kd_tree | ( | ) | const |
Get KD Tree of the LineString.
const CoordinateT& last | ( | ) | const |
double length | ( | ) | const |
bool operator== | ( | const LineString< CoordinateT, DistanceFunction > & | other | ) | const |
Equality operator.
CoordinateT& operator[] | ( | std::size_t | index | ) |
const CoordinateT& operator[] | ( | std::size_t | index | ) | const |
const std::vector<Point>& points | ( | ) | const |
Return the points of this LineString.
const Segments& segments | ( | ) | const |
Return the segments of this LineString.
size_t size | ( | ) | const |