![]() |
RaidZeroLib
Coroutine robot framework for VEX V5
|
Immutable sequence of 2D waypoints with unit-safe geometry. More...
#include <DiscretePath.hpp>
Public Types | |
| using | value_type = Point |
| using | const_reference = const Point& |
| using | container_type = std::vector<Point> |
| using | size_type = std::size_t |
| using | const_iterator = std::vector<Point>::const_iterator |
| using | const_reverse_iterator = std::vector<Point>::const_reverse_iterator |
Public Member Functions | |
| DiscretePath (std::initializer_list< Point > waypoints) | |
| Constructs a path from a brace-initialized list of points. | |
| template<std::ranges::input_range Range> requires (!std::same_as<std::remove_cvref_t<Range>, DiscretePath> && std::convertible_to<std::ranges::range_reference_t<Range>, Point>) | |
| DiscretePath (Range &&range) | |
| Constructs a path from any C++20 input range of points. | |
| DiscretePath | operator+ (const DiscretePath &rhs) const |
Concatenates two paths (this followed by rhs). | |
| DiscretePath | operator+ (const Point &rhs) const |
| Appends a single waypoint to the end of the path. | |
| const_iterator | begin () const noexcept |
| Forward begin iterator. | |
| const_iterator | end () const noexcept |
| Forward end iterator (one past the last). | |
| const_reverse_iterator | rbegin () const noexcept |
| Reverse begin iterator (last element). | |
| const_reverse_iterator | rend () const noexcept |
| Reverse end iterator (one before the first). | |
| const_reference | operator[] (size_type index) const noexcept |
| Random access without bounds checking. | |
| const_reference | front () const noexcept |
| First waypoint. | |
| const_reference | back () const noexcept |
| Last waypoint. | |
| Curvature | getCurvature (std::size_t index) const noexcept |
Signed curvature at vertex index using the circumcircle of three consecutive points. | |
| size_type | size () const noexcept |
| Number of waypoints. | |
Immutable sequence of 2D waypoints with unit-safe geometry.
DiscretePath stores a read-only ordered list of Point (meters). It supports:
| using rz::DiscretePath::const_iterator = std::vector<Point>::const_iterator |
| using rz::DiscretePath::const_reference = const Point& |
| using rz::DiscretePath::const_reverse_iterator = std::vector<Point>::const_reverse_iterator |
| using rz::DiscretePath::container_type = std::vector<Point> |
| using rz::DiscretePath::size_type = std::size_t |
| using rz::DiscretePath::value_type = Point |
|
explicit |
Constructs a path from a brace-initialized list of points.
| waypoints | Non-empty list of waypoints (meters). |
|
inlineexplicit |
Constructs a path from any C++20 input range of points.
Accepts containers and views whose element/reference type is convertible to Point, e.g. std::vector<Point>, std::list<Point>, raw arrays, or range pipelines like points | std::views::filter(...).
| Range | A std::ranges::input_range whose reference is convertible to Point. |
| range | Non-empty range of waypoints (meters). |
|
noexcept |
Last waypoint.
|
noexcept |
Forward begin iterator.
|
noexcept |
Forward end iterator (one past the last).
|
noexcept |
First waypoint.
|
noexcept |
Signed curvature at vertex index using the circumcircle of three consecutive points.
For an interior index i (i.e. 1 ≤ i ≤ size()-2), let R = circumradius(P[i-1], P[i], P[i+1]). The unsigned curvature is κ = 1/R. The sign follows the triangle orientation (left turn positive, right turn negative). Endpoints and collinear triples yield 0.
| index | Vertex index at which to evaluate curvature. |
| DiscretePath rz::DiscretePath::operator+ | ( | const DiscretePath & | rhs | ) | const |
Concatenates two paths (this followed by rhs).
| rhs | Path to append. |
| DiscretePath rz::DiscretePath::operator+ | ( | const Point & | rhs | ) | const |
Appends a single waypoint to the end of the path.
| rhs | Point to append (meters). |
rhs appended.
|
noexcept |
Random access without bounds checking.
| index | Zero-based index in [0, size()). |
|
noexcept |
Reverse begin iterator (last element).
|
noexcept |
Reverse end iterator (one before the first).
|
noexcept |
Number of waypoints.