23 m_actual_num_paths(0),
24 m_k_a2d(.0), m_k_d2a(.0)
29 mrpt::opengl::CMesh &mesh,
double min_x,
double max_x,
double min_y,
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;
47 for (
int iX = 0; iX < nX; iX++)
49 const double x = min_x + dx*(0.5+ iX);
50 for (
int iY = 0; iY < nY; iY++)
52 const double y = min_y + dy*(0.5 + iY);
54 double clear_val = .0;
57 const double alpha = ::atan2(
y,
x);
59 const double dist = std::hypot(
x,
y);
60 clear_val = this->
getClearance(actual_k, dist, integrate_over_path);
62 Z(iX, iY) = clear_val;
81 in.ReadAsAndCastTo<
uint32_t,
size_t>(m_actual_num_paths);
83 this->resize(m_actual_num_paths, decim_num);
84 in >> m_raw_clearances;
97 out << m_raw_clearances;
112 ASSERT_(m_actual_num_paths>0 && !m_raw_clearances.empty());
114 ASSERT_(ret<m_raw_clearances.size());
120 ASSERT_(m_actual_num_paths>0 && !m_raw_clearances.empty());
122 ASSERT_(ret<m_actual_num_paths);
139 for (
const auto &e : rc_k)
141 if (integrate_over_path)
156 res = rc_k.begin()->second;
172 if (decimated_num_paths == 0)
179 m_actual_num_paths = actual_num_paths;
180 m_raw_clearances.resize(decimated_num_paths);
182 m_k_d2a = double(m_actual_num_paths-1) / (m_raw_clearances.size()-1);
183 m_k_a2d = double(m_raw_clearances.size()-1) / (m_actual_num_paths-1);
GLclampf GLclampf GLclampf alpha
unsigned __int16 uint16_t
void setZ(const mrpt::math::CMatrixTemplateNumeric< float > &in_Z)
This method sets the matrix of heights for each position (cell) in the mesh grid. ...
void enableTransparency(bool v)
#define ASSERT_BELOW_(__A, __B)
void clear()
Reset to default, empty state.
std::vector< dist2clearance_t > m_raw_clearances
Container: [decimated_path_k][TPS_distance] => normalized_clearance_for_exactly_that_robot_pose.
void enableWireFrame(bool v)
ClearanceDiagram()
default ctor
void clear()
Clear the contents of this container.
void writeToStream(mrpt::utils::CStream &out) const
dist2clearance_t & get_path_clearance(size_t actual_k)
size_t m_actual_num_paths
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: ...
This base class is used to provide a unified interface to files,memory buffers,..Please see the deriv...
size_t decimated_k_to_real_k(size_t k) const
std::map< double, double > dist2clearance_t
[TPS_distance] => normalized_clearance_for_exactly_that_robot_pose */
size_t real_k_to_decimated_k(size_t k) const
#define MRPT_THROW_UNKNOWN_SERIALIZATION_VERSION(__V)
For use in CSerializable implementations.
void setYBounds(const float min, const float max)
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...
void readFromStream(mrpt::utils::CStream &in)
#define ASSERT_ABOVEEQ_(__A, __B)
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
void enableColorFromZ(bool v, mrpt::utils::TColormap colorMap=mrpt::utils::cmHOT)
A matrix of dynamic size.
int round(const T value)
Returns the closer integer (int) to x.
void setXBounds(const float min, const float max)
A planar (XY) grid where each cell has an associated height and, optionally, a texture map...
unsigned __int32 uint32_t
CRenderizable & setColorA_u8(const uint8_t a) MRPT_OVERRIDE
Color components in the range [0,255].
uint16_t alpha2index(double alpha) const
Discrete index value for the corresponding alpha value.