58             &tst[1].x == (&tst[0].x + 3), 
"memory layout not as expected");
    60             &tst[1].y == (&tst[0].y + 3), 
"memory layout not as expected");
    62             &tst[1].z == (&tst[0].z + 3), 
"memory layout not as expected");
    65     const auto N = m_points.size();
    67     octree_assure_uptodate();  
    68     m_last_rendered_count_ongoing = 0;
    70     if (m_colorFromDepth != colNone)
    74             m_minmax_valid = 
true;
    75             if (!m_points.empty())
    82                 m_min = m_max = vs[0];
    83                 for (
size_t i = 1; i < N; i++)
    86                     if (v < m_min) m_min = v;
    87                     if (v > m_max) m_max = v;
    94         m_max_m_min = m_max - m_min;
    95         if (std::abs(m_max_m_min) < 1e-4)
    98             m_min = m_max - m_max_m_min * 1.01f;
    99         m_max_m_min_inv = 1.0f / m_max_m_min;
   103     m_col_slop.R = m_colorFromDepth_max.R - m_colorFromDepth_min.R;
   104     m_col_slop.G = m_colorFromDepth_max.G - m_colorFromDepth_min.G;
   105     m_col_slop.B = m_colorFromDepth_max.B - m_colorFromDepth_min.B;
   107     m_col_slop_inv.R = m_col_slop.R != 0 ? 1.0f / m_col_slop.R : 0;
   108     m_col_slop_inv.G = m_col_slop.G != 0 ? 1.0f / m_col_slop.G : 0;
   109     m_col_slop_inv.B = m_col_slop.B != 0 ? 1.0f / m_col_slop.B : 0;
   126     if (m_colorFromDepth != colNone && m_max_m_min > 0)
   128         for (
size_t i = 0; i < N; i++)
   130             const float depthCol =
   131                 (m_colorFromDepth == colX
   133                      : (m_colorFromDepth == colY ? m_points[i].y
   136             float f = (depthCol - m_min) * m_max_m_min_inv;
   137             f = std::max(0.0f, min(1.0f, f));
   139             cbd.push_back({
f2u8(m_colorFromDepth_min.R + f * m_col_slop_inv.R),
   140                            f2u8(m_colorFromDepth_min.G + f * m_col_slop_inv.G),
   141                            f2u8(m_colorFromDepth_min.B + f * m_col_slop_inv.B),
   148         cbd.assign(N, m_color);
   151     m_last_rendered_count = m_last_rendered_count_ongoing;
   155     [maybe_unused]] 
size_t i)
 const   157 #if MRPT_HAS_OPENGL_GLUT   163     [[maybe_unused]] 
const bool all,
   164     [[maybe_unused]] 
const std::vector<size_t>& idxs,
   165     [[maybe_unused]] 
const float render_area_sqpixels)
 const   167 #if 0 && MRPT_HAS_OPENGL_GLUT   170     const size_t N = (all ? m_xs.size() : idxs.size());
   174                        render_area_sqpixels))));
   176     m_last_rendered_count_ongoing += N / decimation;
   180         for (
size_t i = 0; i < N; i++) internal_render_one_point(i);
   184         const size_t Np = idxs.size();
   185         for (
size_t i = 0; i < Np; i += decimation)
   186             internal_render_one_point(idxs[i]);
   194     out[
"colorFromDepth"] = 
static_cast<int32_t
>(m_colorFromDepth);
   195     out[
"pointSize"] = m_pointSize;
   196     const auto N = m_points.size();
   197     out[
"N"] = 
static_cast<uint64_t
>(N);
   198     for (
size_t i = 0; i < N; i++)
   200         out[
"xs"][i] = m_points[i].x;
   201         out[
"ys"][i] = m_points[i].y;
   202         out[
"zs"][i] = m_points[i].z;
   204     out[
"colorFromDepth_min"][
"R"] = m_colorFromDepth_min.R;
   205     out[
"colorFromDepth_min"][
"G"] = m_colorFromDepth_min.G;
   206     out[
"colorFromDepth_min"][
"B"] = m_colorFromDepth_min.B;
   207     out[
"colorFromDepth_max"][
"R"] = m_colorFromDepth_max.R;
   208     out[
"colorFromDepth_max"][
"G"] = m_colorFromDepth_max.G;
   209     out[
"colorFromDepth_max"][
"B"] = m_colorFromDepth_max.B;
   210     out[
"pointSmooth"] = m_pointSmooth;
   225             m_pointSize = 
static_cast<float>(in[
"pointSize"]);
   226             const size_t N = 
static_cast<uint64_t
>(in[
"N"]);
   228             for (
size_t i = 0; i < N; i++)
   230                 m_points[i].x = 
static_cast<float>(in[
"xs"][i]);
   231                 m_points[i].y = 
static_cast<float>(in[
"ys"][i]);
   232                 m_points[i].z = 
static_cast<float>(in[
"zs"][i]);
   234             m_colorFromDepth_min.R =
   235                 static_cast<float>(in[
"colorFromDepth_min"][
"R"]);
   236             m_colorFromDepth_min.G =
   237                 static_cast<float>(in[
"colorFromDepth_min"][
"G"]);
   238             m_colorFromDepth_min.B =
   239                 static_cast<float>(in[
"colorFromDepth_min"][
"B"]);
   240             m_colorFromDepth_max.R =
   241                 static_cast<float>(in[
"colorFromDepth_max"][
"R"]);
   242             m_colorFromDepth_max.G =
   243                 static_cast<float>(in[
"colorFromDepth_max"][
"G"]);
   244             m_colorFromDepth_max.B =
   245                 static_cast<float>(in[
"colorFromDepth_max"][
"B"]);
   246             m_pointSmooth = 
static_cast<bool>(in[
"pointSmooth"]);
   256     writeToStreamRender(
out);
   258     out.WriteAs<int32_t>(m_colorFromDepth);
   261     out.WriteAs<uint32_t>(m_points.size());
   262     for (
const auto& pt : m_points) 
out << pt;
   265     out << m_colorFromDepth_min.R << m_colorFromDepth_min.G
   266         << m_colorFromDepth_min.B;
   267     out << m_colorFromDepth_max.R << m_colorFromDepth_max.G
   268         << m_colorFromDepth_max.B;
   271     out << m_pointSmooth;
   290             readFromStreamRender(in);
   295                 m_colorFromDepth = Axis(axis);
   306                 std::vector<float> xs, ys, zs;
   307                 in >> xs >> ys >> zs;
   308                 this->setAllPoints(xs, ys, zs);
   313                 auto N = in.
ReadAs<uint32_t>();
   315                 for (
auto& pt : m_points) in >> pt;
   318             if (version >= 1 && version < 6)
   325                 in >> m_colorFromDepth_min.R >> m_colorFromDepth_min.G >>
   326                     m_colorFromDepth_min.B;
   327                 in >> m_colorFromDepth_max.R >> m_colorFromDepth_max.G >>
   328                     m_colorFromDepth_max.B;
   332                 m_colorFromDepth_min = 
TColorf(0, 0, 0);
   333                 m_colorFromDepth_max.R = m_color.R * 255.f;
   334                 m_colorFromDepth_max.G = m_color.G * 255.f;
   335                 m_colorFromDepth_max.B = m_color.B * 255.f;
   341                 m_pointSmooth = 
false;
   350     markAllPointsAsNew();
   357     markAllPointsAsNew();
   363     m_points.emplace_back(x, y, z);
   365     m_minmax_valid = 
false;
   369     markAllPointsAsNew();
   377     size_t i, 
const float x, 
const float y, 
const float z)
   379     m_points.at(i) = {x, y, z};
   381     m_minmax_valid = 
false;
   385     markAllPointsAsNew();
   395     m_colorFromDepth_min = colorMin;
   396     m_colorFromDepth_max = colorMax;
   402     m_minmax_valid = 
false;
   403     octree_mark_as_outdated();
   421     this->setPoint(idx, pt.
x, pt.
y, pt.
z);
   434     pt_has_color = 
false;
   441     const auto N = pts.size();
   443     for (
size_t i = 0; i < N; i++) m_points[i] = pts[i];
   444     m_minmax_valid = 
false;
   445     markAllPointsAsNew();
 void insertPoint(float x, float y, float z)
Adds a new point to the cloud. 
 
float OCTREE_RENDER_MAX_DENSITY_POINTS_PER_SQPIXEL_value
 
void serializeFrom(mrpt::serialization::CArchive &in, uint8_t serial_version) override
Pure virtual method for reading (deserializing) from an abstract archive. 
 
size_t size(const MATRIXLIKE &m, const int dim)
 
#define IMPLEMENTS_SERIALIZABLE(class_name, base, NameSpace)
To be added to all CSerializable-classes implementation files. 
 
void notifyChange() const
Call to enable calling renderUpdateBuffers() before the next render() rendering iteration. 
 
size_t OCTREE_RENDER_MAX_POINTS_PER_NODE()
Default value = 1e5. 
 
This file implements several operations that operate element-wise on individual or pairs of container...
 
The base class of 3D objects that can be directly rendered through OpenGL. 
 
void setAllPoints(const std::vector< T > &x, const std::vector< T > &y, const std::vector< T > &z)
Set the list of (X,Y,Z) point coordinates, all at once, from three vectors with their coordinates...
 
void clear()
Empty the list of points. 
 
void setGradientColors(const mrpt::img::TColorf &colorMin, const mrpt::img::TColorf &colorMax)
Sets the colors used as extremes when colorFromDepth is enabled. 
 
Virtual base class for "schematic archives" (JSON, XML,...) 
 
#define MRPT_THROW_UNKNOWN_SERIALIZATION_VERSION(__V)
For use in CSerializable implementations. 
 
std::vector< mrpt::img::TColor > m_color_buffer_data
 
float d2f(const double d)
shortcut for static_cast<float>(double) 
 
void params_deserialize(mrpt::serialization::CArchive &in)
 
This base provides a set of functions for maths stuff. 
 
STORED_TYPE ReadAs()
De-serialize a variable and returns it by value. 
 
void OCTREE_RENDER_MAX_DENSITY_POINTS_PER_SQPIXEL(float value)
Default value = 0.01 points/px^2. 
 
#define ASSERTMSG_(f, __ERROR_MSG)
Defines an assertion mechanism. 
 
size_t OCTREE_RENDER_MAX_POINTS_PER_NODE_value
 
void internal_render_one_point(size_t i) const
 
void params_serialize(mrpt::serialization::CArchive &out) const
 
#define SCHEMA_DESERIALIZE_DATATYPE_VERSION()
For use inside serializeFrom(CSchemeArchiveBase) methods. 
 
void PLY_import_set_vertex_count(const size_t N) override
In a base class, reserve memory to prepare subsequent calls to PLY_import_set_vertex. 
 
void PLY_import_set_vertex(const size_t idx, const mrpt::math::TPoint3Df &pt, const mrpt::img::TColorf *pt_color=nullptr) override
In a base class, will be called after PLY_import_set_vertex_count() once for each loaded point...
 
uint8_t serializeGetVersion() const override
Must return the current versioning number of the object. 
 
uint8_t f2u8(const float f)
converts a float [0,1] into an uint8_t [0,255] (without checking for out of bounds) ...
 
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries. 
 
void render_subset(const bool all, const std::vector< size_t > &idxs, const float render_area_sqpixels) const
Render a subset of points (required by octree renderer) 
 
Virtual base class for "archives": classes abstracting I/O streams. 
 
void markAllPointsAsNew()
Do needed internal work if all points are new (octree rebuilt,...) 
 
mrpt::vision::TStereoCalibResults out
 
An RGBA color - floats in the range [0,1]. 
 
The namespace for 3D scene representation and rendering. 
 
size_t PLY_export_get_vertex_count() const override
In a base class, return the number of vertices. 
 
void PLY_export_get_vertex(const size_t idx, mrpt::math::TPoint3Df &pt, bool &pt_has_color, mrpt::img::TColorf &pt_color) const override
In a base class, will be called after PLY_export_get_vertex_count() once for each exported point...
 
void setPoint(size_t i, const float x, const float y, const float z)
Write an individual point (checks for "i" in the valid range only in Debug). 
 
void onUpdateBuffers_Points() override
Must be implemented in derived classes to update the geometric entities to be drawn in "m_*_buffer" f...
 
#define SCHEMA_SERIALIZE_DATATYPE_VERSION(ser_version)
For use inside all serializeTo(CSchemeArchiveBase) methods. 
 
A cloud of points, all with the same color or each depending on its value along a particular coordina...
 
void serializeTo(mrpt::serialization::CArchive &out) const override
Pure virtual method for writing (serializing) to an abstract archive. 
 
int round(const T value)
Returns the closer integer (int) to x.