1#ifndef BITSIM_TRAJECTORY_WAYPOINT_TRAJECTORY_H
2#define BITSIM_TRAJECTORY_WAYPOINT_TRAJECTORY_H
23 static_assert(std::is_default_constructible<LinkType>::value,
24 "LinkType must have default constructor");
65 void clear() { links_.clear(); }
70 bool empty()
const {
return links_.empty(); }
108 std::vector<link_type> links_;
118template <
typename LinkType>
119std::pair<real_t, typename WaypointTrajectory<LinkType>::link_type>
124 real_t dist_ = std::numeric_limits<real_t>::max();
127 for (
const auto &link : links_)
130 auto dist = link.distance(p);
139 return std::make_pair(dist_, link_);
The basic types of bitsim. Code outside this file names Eigen's matrix and vector types only through ...
link_type & operator[](uint_t i)
Returns a read/write reference of the i-th link.
Definition waypoint_trajectory.h:80
bool empty() const
Returns true if the trajectory is empty.
Definition waypoint_trajectory.h:70
const_link_iterator end() const
Definition waypoint_trajectory.h:102
typename link_type::w_point_type w_point_type
Definition waypoint_trajectory.h:28
uint_t size() const
How many waypoints the pah has.
Definition waypoint_trajectory.h:55
LinkType link_type
Definition waypoint_trajectory.h:26
typename std::vector< link_type >::iterator link_iterator
point iteration
Definition waypoint_trajectory.h:33
std::pair< real_t, link_type > distance(const w_point_type &p) const
Computes the minimum distance of the given point from the trajectory.
Definition waypoint_trajectory.h:120
typename std::vector< link_type >::const_iterator const_link_iterator
Definition waypoint_trajectory.h:34
void reserve(uint_t n)
Reserve space for waypoints.
Definition waypoint_trajectory.h:60
void clear()
clear the memory allocated for points and edges
Definition waypoint_trajectory.h:65
void resize(uint_t n)
Resize the underlying links.
Definition waypoint_trajectory.h:90
const link_type & operator[](uint_t i) const
Returns a read reference of the i-th link.
Definition waypoint_trajectory.h:85
link_iterator begin()
Raw node iteration.
Definition waypoint_trajectory.h:95
WaypointTrajectory()
Constructor.
Definition waypoint_trajectory.h:111
const_link_iterator begin() const
Raw node iteration.
Definition waypoint_trajectory.h:101
void push(const link_type &link)
Push a new link.
Definition waypoint_trajectory.h:75
link_iterator end()
Definition waypoint_trajectory.h:96
Definition line_segment_link.h:11
Definition dc_motor_backend_base.h:9
std::size_t uint_t
uint_t
Definition bitsim_types.h:40
double real_t
real_t
Definition bitsim_types.h:20