Main MRPT website > C++ reference
MRPT logo
Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes | Private Member Functions | Private Attributes

mrpt::opengl::CPointCloud Class Reference


Detailed Description

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

See also:
opengl::CPlanarLaserScan, opengl::COpenGLScene, opengl::CPointCloudColoured, mrpt::slam::CPointsMap
mrpt::opengl::CPointCloud
preview_CPointCloud.png

Definition at line 62 of file CPointCloud.h.

#include <mrpt/opengl/CPointCloud.h>

Inheritance diagram for mrpt::opengl::CPointCloud:
Inheritance graph
[legend]

List of all members.

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,...)

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::CObjectduplicate () const
 Returns a copy of the object, indepently of its class.
static mrpt::utils::CObjectCreateObject ()
static CPointCloudPtr Create ()

Member Typedef Documentation

A typedef for the associated smart pointer

Definition at line 66 of file CPointCloud.h.


Member Enumeration Documentation

Enumerator:
None 
Z 
Y 
X 

Definition at line 68 of file CPointCloud.h.


Constructor & Destructor Documentation

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 214 of file CPointCloud.h.


Member Function Documentation

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]
static mrpt::utils::CObject* mrpt::opengl::CPointCloud::CreateObject ( ) [static]
void mrpt::opengl::CPointCloud::disablePointSmooth ( ) [inline]

Definition at line 194 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 186 of file CPointCloud.h.

References None, and X.

void mrpt::opengl::CPointCloud::enableColorFromY ( bool  v = true) [inline]

Definition at line 187 of file CPointCloud.h.

References None, and Y.

void mrpt::opengl::CPointCloud::enableColorFromZ ( bool  v = true) [inline]

Definition at line 188 of file CPointCloud.h.

References None, and Z.

void mrpt::opengl::CPointCloud::enablePointSmooth ( bool  enable = true) [inline]

Definition at line 193 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 179 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 109 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 110 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 111 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 127 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 135 of file CPointCloud.h.

References ASSERT_BELOW_, and mrpt::math::size().

float mrpt::opengl::CPointCloud::getPointSize ( ) const [inline]

Definition at line 191 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 195 of file CPointCloud.h.

template<class LISTOFPOINTS >
void mrpt::opengl::CPointCloud::loadFromPointsList ( LISTOFPOINTS &  pointsList) [inline]

Load the points from a list of TPoint3D.

Definition at line 157 of file CPointCloud.h.

References MRPT_END, and MRPT_START.

template<class POINTSMAP >
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 150 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 119 of file CPointCloud.h.

References ASSERT_BELOW_, and mrpt::math::size().

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 88 of file CPointCloud.h.

void mrpt::opengl::CPointCloud::resize ( size_t  N) [inline]

Set the number of points (with contents undefined)

Definition at line 85 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 91 of file CPointCloud.h.

References 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 100 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 190 of file CPointCloud.h.

size_t mrpt::opengl::CPointCloud::size ( ) const [inline]

Definition at line 82 of file CPointCloud.h.


Member Data Documentation

Definition at line 66 of file CPointCloud.h.

Definition at line 66 of file CPointCloud.h.

Definition at line 66 of file CPointCloud.h.

Definition at line 217 of file CPointCloud.h.

Color linear function slope.

Definition at line 217 of file CPointCloud.h.

The colors used to interpolate when m_colorFromDepth is true.

Definition at line 220 of file CPointCloud.h.

Definition at line 220 of file CPointCloud.h.

volatile size_t mrpt::opengl::CPointCloud::m_last_rendered_count [mutable, protected]

Definition at line 73 of file CPointCloud.h.

volatile size_t mrpt::opengl::CPointCloud::m_last_rendered_count_ongoing [mutable, protected]

Definition at line 73 of file CPointCloud.h.

float mrpt::opengl::CPointCloud::m_max [mutable, private]

Definition at line 216 of file CPointCloud.h.

float mrpt::opengl::CPointCloud::m_max_m_min [mutable, private]

Definition at line 216 of file CPointCloud.h.

Buffer for min/max coords when m_colorFromDepth is true.

Definition at line 216 of file CPointCloud.h.

float mrpt::opengl::CPointCloud::m_min [mutable, private]

Definition at line 216 of file CPointCloud.h.

Definition at line 218 of file CPointCloud.h.

By default is 1.0.

Definition at line 70 of file CPointCloud.h.

Default: false.

Definition at line 71 of file CPointCloud.h.

std::vector<float> mrpt::opengl::CPointCloud::m_xs [protected]

Definition at line 69 of file CPointCloud.h.

std::vector<float> mrpt::opengl::CPointCloud::m_ys [protected]

Definition at line 69 of file CPointCloud.h.

std::vector<float> mrpt::opengl::CPointCloud::m_zs [protected]

Definition at line 69 of file CPointCloud.h.




Page generated by Doxygen 1.7.3 for MRPT 0.9.4 SVN: at Sat Mar 26 06:40:17 UTC 2011