A cloud of points, all with the same color or each depending on its value along a particular coordinate axis.
This class is just an OpenGL representation of a point cloud. For operating with maps of points, see mrpt::slam::CPointsMap and derived classes.
To load from a points-map, CPointCloud::loadFromPointsMap().
This class uses smart optimizations while rendering to efficiently draw clouds of millions of points, as described in this page: http://www.mrpt.org/Efficiently_rendering_point_clouds_of_millions_of_points
#include <mrpt/opengl/CPointCloud.h>

Public Member Functions | |
| void | render () const |
| Render. | |
| 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) | |
Read/Write of the list of points to render | |
| size_t | size () const |
| void | resize (size_t N) |
| Set the number of points (with contents undefined) | |
| void | reserve (size_t N) |
| Like STL std::vector's reserve. | |
| void | setAllPoints (const std::vector< float > &x, const std::vector< float > &y, const std::vector< float > &z) |
| Set the list of (X,Y,Z) point coordinates, all at once, from three vectors with their coordinates. | |
| void | setAllPointsFast (std::vector< float > &x, std::vector< float > &y, std::vector< float > &z) |
| Set the list of (X,Y,Z) point coordinates, DESTROYING the contents of the input vectors (via swap) | |
| const std::vector< float > & | getArrayX () const |
| Get a const reference to the internal array of X coordinates. | |
| const std::vector< float > & | getArrayY () const |
| Get a const reference to the internal array of Y coordinates. | |
| const std::vector< float > & | getArrayZ () const |
| Get a const reference to the internal array of Z coordinates. | |
| void | clear () |
| Empty the list of points. | |
| void | insertPoint (float x, float y, float z) |
| Adds a new point to the cloud. | |
| mrpt::math::TPoint3D | operator[] (size_t i) const |
| Read access to each individual point (checks for "i" in the valid range only in Debug). | |
| mrpt::math::TPoint3D | getPoint (size_t i) const |
| Read access to each individual point (checks for "i" in the valid range only in Debug). | |
| mrpt::math::TPoint3Df | getPointf (size_t i) const |
| Read access to each individual point (checks for "i" in the valid range only in Debug). | |
| 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). | |
| template<class POINTSMAP > | |
| void | loadFromPointsMap (const POINTSMAP *themap) |
| Load the points from a pointsMap (mrpt::slam::CPointsMap), passed as a pointer. | |
| template<class LISTOFPOINTS > | |
| void | loadFromPointsList (LISTOFPOINTS &pointsList) |
| Load the points from a list of TPoint3D. | |
| size_t | getActuallyRendered () const |
| Get the number of elements actually rendered in the last render event. | |
Modify the appearance of the rendered points | |
| void | enableColorFromX (bool v=true) |
| void | enableColorFromY (bool v=true) |
| void | enableColorFromZ (bool v=true) |
| void | setPointSize (float p) |
| By default is 1.0. | |
| float | getPointSize () const |
| void | enablePointSmooth (bool enable=true) |
| void | disablePointSmooth () |
| bool | isPointSmoothEnabled () const |
| void | setGradientColors (const mrpt::utils::TColorf &colorMin, const mrpt::utils::TColorf &colorMax) |
| Sets the colors used as extremes when colorFromDepth is enabled. | |
Protected Types | |
| enum | Axis { None = 0, Z, Y, X } |
Protected Member Functions | |
| void | markAllPointsAsNew () |
| Do needed internal work if all points are new (octree rebuilt,...) | |
PLY Import virtual methods to implement in base classes | |
| virtual void | PLY_import_set_vertex_count (const size_t N) |
| In a base class, reserve memory to prepare subsequent calls to PLY_import_set_vertex. | |
| virtual void | PLY_import_set_face_count (const size_t N) |
| In a base class, reserve memory to prepare subsequent calls to PLY_import_set_face. | |
| virtual void | PLY_import_set_vertex (const size_t idx, const mrpt::math::TPoint3Df &pt, const mrpt::utils::TColorf *pt_color=NULL) |
| In a base class, will be called after PLY_import_set_vertex_count() once for each loaded point. | |
PLY Export virtual methods to implement in base classes | |
| virtual size_t | PLY_export_get_vertex_count () const |
| In a base class, return the number of vertices. | |
| virtual size_t | PLY_export_get_face_count () const |
| In a base class, return the number of faces. | |
| virtual void | PLY_export_get_vertex (const size_t idx, mrpt::math::TPoint3Df &pt, bool &pt_has_color, mrpt::utils::TColorf &pt_color) const |
| In a base class, will be called after PLY_export_get_vertex_count() once for each exported point. | |
Protected Attributes | |
| enum mrpt::opengl::CPointCloud::Axis | m_colorFromDepth |
| std::vector< float > | m_xs |
| std::vector< float > | m_ys |
| std::vector< float > | m_zs |
| float | m_pointSize |
| By default is 1.0. | |
| bool | m_pointSmooth |
| Default: false. | |
| volatile size_t | m_last_rendered_count |
| volatile size_t | m_last_rendered_count_ongoing |
Private Member Functions | |
| CPointCloud () | |
| Constructor. | |
| virtual | ~CPointCloud () |
| Private, virtual destructor: only can be deleted from smart pointers. | |
| void | internal_render_one_point (size_t i) const |
Private Attributes | |
| float | m_min |
| float | m_max |
| float | m_max_m_min |
| float | m_max_m_min_inv |
| Buffer for min/max coords when m_colorFromDepth is true. | |
| mrpt::utils::TColorf | m_col_slop |
| mrpt::utils::TColorf | m_col_slop_inv |
| Color linear function slope. | |
| bool | m_minmax_valid |
| mrpt::utils::TColorf | m_colorFromDepth_min |
| mrpt::utils::TColorf | m_colorFromDepth_max |
| The colors used to interpolate when m_colorFromDepth is true. | |
RTTI stuff | |
| typedef CPointCloudPtr | SmartPtr |
| static mrpt::utils::CLASSINIT | _init_CPointCloud |
| static mrpt::utils::TRuntimeClassId | classCPointCloud |
| static const mrpt::utils::TRuntimeClassId * | classinfo |
| static const mrpt::utils::TRuntimeClassId * | _GetBaseClass () |
| virtual const mrpt::utils::TRuntimeClassId * | GetRuntimeClass () const |
| Returns information about the class of an object in runtime. | |
| virtual mrpt::utils::CObject * | duplicate () const |
| Returns a copy of the object, indepently of its class. | |
| static mrpt::utils::CObject * | CreateObject () |
| static CPointCloudPtr | Create () |
A typedef for the associated smart pointer
Definition at line 70 of file CPointCloud.h.
enum mrpt::opengl::CPointCloud::Axis [protected] |
Definition at line 72 of file CPointCloud.h.
| mrpt::opengl::CPointCloud::CPointCloud | ( | ) | [private] |
Constructor.
| virtual mrpt::opengl::CPointCloud::~CPointCloud | ( | ) | [inline, private, virtual] |
Private, virtual destructor: only can be deleted from smart pointers.
Definition at line 254 of file CPointCloud.h.
| static const mrpt::utils::TRuntimeClassId* mrpt::opengl::CPointCloud::_GetBaseClass | ( | ) | [static, protected] |
Reimplemented from mrpt::opengl::CRenderizable.
| void mrpt::opengl::CPointCloud::clear | ( | ) |
Empty the list of points.
| static CPointCloudPtr mrpt::opengl::CPointCloud::Create | ( | ) | [static] |
Referenced by mrpt::opengl::graph_tools::graph_visualize().
| static mrpt::utils::CObject* mrpt::opengl::CPointCloud::CreateObject | ( | ) | [static] |
| void mrpt::opengl::CPointCloud::disablePointSmooth | ( | ) | [inline] |
Definition at line 234 of file CPointCloud.h.
| virtual mrpt::utils::CObject* mrpt::opengl::CPointCloud::duplicate | ( | ) | const [virtual] |
Returns a copy of the object, indepently of its class.
Implements mrpt::utils::CObject.
| void mrpt::opengl::CPointCloud::enableColorFromX | ( | bool | v = true | ) | [inline] |
Definition at line 226 of file CPointCloud.h.
| void mrpt::opengl::CPointCloud::enableColorFromY | ( | bool | v = true | ) | [inline] |
Definition at line 227 of file CPointCloud.h.
| void mrpt::opengl::CPointCloud::enableColorFromZ | ( | bool | v = true | ) | [inline] |
Definition at line 228 of file CPointCloud.h.
| void mrpt::opengl::CPointCloud::enablePointSmooth | ( | bool | enable = true | ) | [inline] |
Definition at line 233 of file CPointCloud.h.
| size_t mrpt::opengl::CPointCloud::getActuallyRendered | ( | ) | const [inline] |
Get the number of elements actually rendered in the last render event.
Definition at line 219 of file CPointCloud.h.
| const std::vector<float>& mrpt::opengl::CPointCloud::getArrayX | ( | ) | const [inline] |
Get a const reference to the internal array of X coordinates.
Definition at line 149 of file CPointCloud.h.
| const std::vector<float>& mrpt::opengl::CPointCloud::getArrayY | ( | ) | const [inline] |
Get a const reference to the internal array of Y coordinates.
Definition at line 150 of file CPointCloud.h.
| const std::vector<float>& mrpt::opengl::CPointCloud::getArrayZ | ( | ) | const [inline] |
Get a const reference to the internal array of Z coordinates.
Definition at line 151 of file CPointCloud.h.
| mrpt::math::TPoint3D mrpt::opengl::CPointCloud::getPoint | ( | size_t | i | ) | const [inline] |
Read access to each individual point (checks for "i" in the valid range only in Debug).
Definition at line 167 of file CPointCloud.h.
References ASSERT_BELOW_, and mrpt::math::size().
| mrpt::math::TPoint3Df mrpt::opengl::CPointCloud::getPointf | ( | size_t | i | ) | const [inline] |
Read access to each individual point (checks for "i" in the valid range only in Debug).
Definition at line 175 of file CPointCloud.h.
References ASSERT_BELOW_, and mrpt::math::size().
| float mrpt::opengl::CPointCloud::getPointSize | ( | ) | const [inline] |
Definition at line 231 of file CPointCloud.h.
| virtual const mrpt::utils::TRuntimeClassId* mrpt::opengl::CPointCloud::GetRuntimeClass | ( | ) | const [virtual] |
Returns information about the class of an object in runtime.
Reimplemented from mrpt::opengl::CRenderizable.
| void mrpt::opengl::CPointCloud::insertPoint | ( | float | x, |
| float | y, | ||
| float | z | ||
| ) |
Adds a new point to the cloud.
| void mrpt::opengl::CPointCloud::internal_render_one_point | ( | size_t | i | ) | const [inline, private] |
| bool mrpt::opengl::CPointCloud::isPointSmoothEnabled | ( | ) | const [inline] |
Definition at line 235 of file CPointCloud.h.
| void mrpt::opengl::CPointCloud::loadFromPointsList | ( | LISTOFPOINTS & | pointsList | ) | [inline] |
Load the points from a list of TPoint3D.
Definition at line 197 of file CPointCloud.h.
References MRPT_START, and MRPT_END.
| void mrpt::opengl::CPointCloud::loadFromPointsMap | ( | const POINTSMAP * | themap | ) | [inline] |
Load the points from a pointsMap (mrpt::slam::CPointsMap), passed as a pointer.
Note that the method is a template since CPointsMap belongs to a different mrpt library.
Definition at line 190 of file CPointCloud.h.
| void mrpt::opengl::CPointCloud::markAllPointsAsNew | ( | ) | [protected] |
Do needed internal work if all points are new (octree rebuilt,...)
| mrpt::math::TPoint3D mrpt::opengl::CPointCloud::operator[] | ( | size_t | i | ) | const [inline] |
Read access to each individual point (checks for "i" in the valid range only in Debug).
Definition at line 159 of file CPointCloud.h.
References ASSERT_BELOW_, and mrpt::math::size().
| virtual size_t mrpt::opengl::CPointCloud::PLY_export_get_face_count | ( | ) | const [inline, protected, virtual] |
In a base class, return the number of faces.
Implements mrpt::utils::PLY_Exporter.
Definition at line 103 of file CPointCloud.h.
| virtual void mrpt::opengl::CPointCloud::PLY_export_get_vertex | ( | const size_t | idx, |
| mrpt::math::TPoint3Df & | pt, | ||
| bool & | pt_has_color, | ||
| mrpt::utils::TColorf & | pt_color | ||
| ) | const [protected, virtual] |
In a base class, will be called after PLY_export_get_vertex_count() once for each exported point.
| pt_color | Will be NULL if the loaded file does not provide color info. |
Implements mrpt::utils::PLY_Exporter.
| virtual size_t mrpt::opengl::CPointCloud::PLY_export_get_vertex_count | ( | ) | const [protected, virtual] |
In a base class, return the number of vertices.
Implements mrpt::utils::PLY_Exporter.
| virtual void mrpt::opengl::CPointCloud::PLY_import_set_face_count | ( | const size_t | N | ) | [inline, protected, virtual] |
In a base class, reserve memory to prepare subsequent calls to PLY_import_set_face.
Implements mrpt::utils::PLY_Importer.
Definition at line 88 of file CPointCloud.h.
| virtual void mrpt::opengl::CPointCloud::PLY_import_set_vertex | ( | const size_t | idx, |
| const mrpt::math::TPoint3Df & | pt, | ||
| const mrpt::utils::TColorf * | pt_color = NULL |
||
| ) | [protected, virtual] |
In a base class, will be called after PLY_import_set_vertex_count() once for each loaded point.
| pt_color | Will be NULL if the loaded file does not provide color info. |
Implements mrpt::utils::PLY_Importer.
| virtual void mrpt::opengl::CPointCloud::PLY_import_set_vertex_count | ( | const size_t | N | ) | [protected, virtual] |
In a base class, reserve memory to prepare subsequent calls to PLY_import_set_vertex.
Implements mrpt::utils::PLY_Importer.
| void mrpt::opengl::CPointCloud::render | ( | ) | const [virtual] |
Render.
Implements mrpt::opengl::CRenderizable.
| void mrpt::opengl::CPointCloud::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)
| void mrpt::opengl::CPointCloud::reserve | ( | size_t | N | ) | [inline] |
Like STL std::vector's reserve.
Definition at line 128 of file CPointCloud.h.
| void mrpt::opengl::CPointCloud::resize | ( | size_t | N | ) | [inline] |
Set the number of points (with contents undefined)
Definition at line 125 of file CPointCloud.h.
| void mrpt::opengl::CPointCloud::setAllPoints | ( | const std::vector< float > & | x, |
| const std::vector< float > & | y, | ||
| const std::vector< float > & | z | ||
| ) | [inline] |
Set the list of (X,Y,Z) point coordinates, all at once, from three vectors with their coordinates.
Definition at line 131 of file CPointCloud.h.
References Eigen::internal::y.
| void mrpt::opengl::CPointCloud::setAllPointsFast | ( | std::vector< float > & | x, |
| std::vector< float > & | y, | ||
| std::vector< float > & | z | ||
| ) | [inline] |
Set the list of (X,Y,Z) point coordinates, DESTROYING the contents of the input vectors (via swap)
Definition at line 140 of file CPointCloud.h.
| void mrpt::opengl::CPointCloud::setGradientColors | ( | const mrpt::utils::TColorf & | colorMin, |
| const mrpt::utils::TColorf & | colorMax | ||
| ) |
Sets the colors used as extremes when colorFromDepth is enabled.
| void mrpt::opengl::CPointCloud::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 mrpt::opengl::CPointCloud::setPointSize | ( | float | p | ) | [inline] |
By default is 1.0.
Definition at line 230 of file CPointCloud.h.
| size_t mrpt::opengl::CPointCloud::size | ( | ) | const [inline] |
Definition at line 122 of file CPointCloud.h.
mrpt::utils::CLASSINIT mrpt::opengl::CPointCloud::_init_CPointCloud [static, protected] |
Definition at line 70 of file CPointCloud.h.
Definition at line 70 of file CPointCloud.h.
const mrpt::utils::TRuntimeClassId* mrpt::opengl::CPointCloud::classinfo [static] |
Definition at line 70 of file CPointCloud.h.
mrpt::utils::TColorf mrpt::opengl::CPointCloud::m_col_slop [mutable, private] |
Definition at line 257 of file CPointCloud.h.
mrpt::utils::TColorf mrpt::opengl::CPointCloud::m_col_slop_inv [mutable, private] |
Color linear function slope.
Definition at line 257 of file CPointCloud.h.
The colors used to interpolate when m_colorFromDepth is true.
Definition at line 260 of file CPointCloud.h.
Definition at line 260 of file CPointCloud.h.
volatile size_t mrpt::opengl::CPointCloud::m_last_rendered_count [mutable, protected] |
Definition at line 77 of file CPointCloud.h.
volatile size_t mrpt::opengl::CPointCloud::m_last_rendered_count_ongoing [mutable, protected] |
Definition at line 77 of file CPointCloud.h.
float mrpt::opengl::CPointCloud::m_max [mutable, private] |
Definition at line 256 of file CPointCloud.h.
float mrpt::opengl::CPointCloud::m_max_m_min [mutable, private] |
Definition at line 256 of file CPointCloud.h.
float mrpt::opengl::CPointCloud::m_max_m_min_inv [mutable, private] |
Buffer for min/max coords when m_colorFromDepth is true.
Definition at line 256 of file CPointCloud.h.
float mrpt::opengl::CPointCloud::m_min [mutable, private] |
Definition at line 256 of file CPointCloud.h.
bool mrpt::opengl::CPointCloud::m_minmax_valid [mutable, private] |
Definition at line 258 of file CPointCloud.h.
float mrpt::opengl::CPointCloud::m_pointSize [protected] |
By default is 1.0.
Definition at line 74 of file CPointCloud.h.
bool mrpt::opengl::CPointCloud::m_pointSmooth [protected] |
Default: false.
Definition at line 75 of file CPointCloud.h.
std::vector<float> mrpt::opengl::CPointCloud::m_xs [protected] |
Definition at line 73 of file CPointCloud.h.
std::vector<float> mrpt::opengl::CPointCloud::m_ys [protected] |
Definition at line 73 of file CPointCloud.h.
std::vector<float> mrpt::opengl::CPointCloud::m_zs [protected] |
Definition at line 73 of file CPointCloud.h.
| Page generated by Doxygen 1.7.5 for MRPT 0.9.5 SVN: at Sun Oct 16 12:16:33 UTC 2011 |