Go to the documentation of this file.
23 : m_actual_num_paths(0), m_k_a2d(.0), m_k_d2a(.0)
29 double max_y,
double cell_res,
bool integrate_over_path)
const
37 const int nX = (int)::ceil((max_x - min_x) / cell_res);
38 const int nY = (int)::ceil((max_y - min_y) / cell_res);
39 const double dx = (max_x - min_x) / nX;
40 const double dy = (max_y - min_y) / nY;
46 for (
int iX = 0; iX < nX; iX++)
48 const double x = min_x + dx * (0.5 + iX);
49 for (
int iY = 0; iY < nY; iY++)
51 const double y = min_y + dy * (0.5 + iY);
53 double clear_val = .0;
56 const double alpha = ::atan2(
y,
x);
60 const double dist = std::hypot(
x,
y);
64 Z(iX, iY) = clear_val;
84 in.ReadAsAndCastTo<
uint32_t,
size_t>(m_actual_num_paths);
86 this->resize(m_actual_num_paths, decim_num);
87 in >> m_raw_clearances;
101 out << m_raw_clearances;
111 size_t actual_k)
const
118 ASSERT_(m_actual_num_paths > 0 && !m_raw_clearances.empty());
120 ASSERT_(ret < m_raw_clearances.size());
126 ASSERT_(m_actual_num_paths > 0 && !m_raw_clearances.empty());
128 ASSERT_(ret < m_actual_num_paths);
133 uint16_t actual_k,
double dist,
bool integrate_over_path)
const
148 for (
const auto& e : rc_k)
150 if (!integrate_over_path)
160 if (e.first > dist)
break;
165 res = rc_k.begin()->second;
182 size_t actual_num_paths,
size_t decimated_num_paths)
184 if (decimated_num_paths == 0)
191 m_actual_num_paths = actual_num_paths;
192 m_raw_clearances.resize(decimated_num_paths);
194 m_k_d2a = double(m_actual_num_paths - 1) / (m_raw_clearances.size() - 1);
195 m_k_a2d = double(m_raw_clearances.size() - 1) / (m_actual_num_paths - 1);
void writeToStream(mrpt::serialization::CArchive &out) const
void clear()
Clear the contents of this container.
unsigned __int16 uint16_t
void enableWireFrame(bool v)
size_t m_actual_num_paths
void enableTransparency(bool v)
double getClearance(uint16_t k, double TPS_query_distance, bool integrate_over_path) const
Gets the clearance for path k and distance TPS_query_distance in one of two modes:
void renderAs3DObject(mrpt::opengl::CMesh &mesh, double min_x, double max_x, double min_y, double max_y, double cell_res, bool integrate_over_path) const
CRenderizable & setColorA_u8(const uint8_t a) override
Color components in the range [0,255].
#define ASSERT_(f)
Defines an assertion mechanism.
GLclampf GLclampf GLclampf alpha
void setYBounds(const float min, const float max)
A planar (XY) grid where each cell has an associated height and, optionally, a texture map.
Virtual base class for "archives": classes abstracting I/O streams.
A matrix of dynamic size.
uint16_t alpha2index(double alpha) const
Discrete index value for the corresponding alpha value.
#define ASSERT_BELOW_(__A, __B)
void setZ(const mrpt::math::CMatrixTemplateNumeric< float > &in_Z)
This method sets the matrix of heights for each position (cell) in the mesh grid.
int round(const T value)
Returns the closer integer (int) to x.
void readFromStream(mrpt::serialization::CArchive &in)
std::map< double, double > dist2clearance_t
[TPS_distance] => normalized_clearance_for_exactly_that_robot_pose
dist2clearance_t & get_path_clearance(size_t actual_k)
size_t decimated_k_to_real_k(size_t k) const
#define ASSERT_ABOVEEQ_(__A, __B)
void clear()
Reset to default, empty state.
void setXBounds(const float min, const float max)
ClearanceDiagram()
default ctor
size_t real_k_to_decimated_k(size_t k) const
void resize(size_t actual_num_paths, size_t decimated_num_paths)
Initializes the container to allocate decimated_num_paths entries, as a decimated subset of a total o...
#define MRPT_THROW_UNKNOWN_SERIALIZATION_VERSION(__V)
For use in CSerializable implementations.
std::vector< dist2clearance_t > m_raw_clearances
Container: [decimated_path_k][TPS_distance] => normalized_clearance_for_exactly_that_robot_pose
void enableColorFromZ(bool v, mrpt::img::TColormap colorMap=mrpt::img::cmHOT)
unsigned __int32 uint32_t
Page generated by Doxygen 1.8.17 for MRPT 1.9.9 Git: ad3a9d8ae Tue May 1 23:10:22 2018 -0700 at miƩ 12 jul 2023 10:03:34 CEST | |