Main MRPT website > C++ reference
MRPT logo
Classes | Public Member Functions | Private Types | Private Member Functions | Private Attributes
mrpt::opengl::CPointCloudColoured Class Reference

Detailed Description

A cloud of points, each one with an individual colour (R,G,B).

The alpha component is shared by all the points and is stored in the base member m_color_A.

To load from a points-map, CPointCloudColoured::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::COpenGLScene, opengl::CPointCloud
mrpt::opengl::CPointCloudColoured
preview_CPointCloudColoured.png

#include <mrpt/opengl/CPointCloudColoured.h>

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

List of all members.

Classes

struct  TPointColour

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
void push_back (float x, float y, float z, float R, float G, float B)
 Inserts a new point into the point cloud.
void resize (size_t N)
 Set the number of points, with undefined contents.
void reserve (size_t N)
 Like STL std::vector's reserve.
const TPointColour & operator[] (size_t i) const
 Read access to each individual point (checks for "i" in the valid range only in Debug).
const TPointColour & 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 TPointColour &p)
 Write an individual point (checks for "i" in the valid range only in Debug).
size_t size () const
 Return the number of points.
void clear ()
 Erase all the points.
template<class POINTSMAP >
void loadFromPointsMap (const POINTSMAP *m)
 Load the points from a points map (passed as a pointer), depending on the type of point map passed: for the case of a mrpt::slam::CColouredPointMap the colours of individual points will be also copied.
size_t getActuallyRendered () const
 Get the number of elements actually rendered in the last render event.
Modify the appearance of the rendered points
void setPointSize (float pointSize)
float getPointSize () const
void enablePointSmooth (bool enable=true)
void disablePointSmooth ()
bool isPointSmoothEnabled () const

Protected Member Functions

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.

Private Types

typedef std::vector< TPointColour > TListPointColour
typedef TListPointColour::iterator iterator
typedef
TListPointColour::const_iterator 
const_iterator

Private Member Functions

iterator begin ()
const_iterator begin () const
iterator end ()
const_iterator end () const
 CPointCloudColoured ()
 Constructor.
virtual ~CPointCloudColoured ()
 Private, virtual destructor: only can be deleted from smart pointers.
void markAllPointsAsNew ()
 Do needed internal work if all points are new (octree rebuilt,...)

Private Attributes

TListPointColour m_points
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

RTTI stuff

typedef CPointCloudColouredPtr SmartPtr
static mrpt::utils::CLASSINIT _init_CPointCloudColoured
static mrpt::utils::TRuntimeClassId classCPointCloudColoured
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 CPointCloudColouredPtr Create ()

Member Typedef Documentation

Definition at line 84 of file CPointCloudColoured.h.

Definition at line 83 of file CPointCloudColoured.h.

A typedef for the associated smart pointer

Definition at line 69 of file CPointCloudColoured.h.

Definition at line 80 of file CPointCloudColoured.h.


Constructor & Destructor Documentation

mrpt::opengl::CPointCloudColoured::CPointCloudColoured ( ) [inline, private]

Constructor.

Definition at line 97 of file CPointCloudColoured.h.

virtual mrpt::opengl::CPointCloudColoured::~CPointCloudColoured ( ) [inline, private, virtual]

Private, virtual destructor: only can be deleted from smart pointers.

Definition at line 106 of file CPointCloudColoured.h.


Member Function Documentation

static const mrpt::utils::TRuntimeClassId* mrpt::opengl::CPointCloudColoured::_GetBaseClass ( ) [static, protected]

Reimplemented from mrpt::opengl::CRenderizable.

iterator mrpt::opengl::CPointCloudColoured::begin ( ) [inline, private]

Definition at line 85 of file CPointCloudColoured.h.

const_iterator mrpt::opengl::CPointCloudColoured::begin ( ) const [inline, private]

Definition at line 86 of file CPointCloudColoured.h.

void mrpt::opengl::CPointCloudColoured::clear ( void  ) [inline]

Erase all the points.

Definition at line 153 of file CPointCloudColoured.h.

static CPointCloudColouredPtr mrpt::opengl::CPointCloudColoured::Create ( ) [static]
static mrpt::utils::CObject* mrpt::opengl::CPointCloudColoured::CreateObject ( ) [static]
void mrpt::opengl::CPointCloudColoured::disablePointSmooth ( ) [inline]

Definition at line 213 of file CPointCloudColoured.h.

virtual mrpt::utils::CObject* mrpt::opengl::CPointCloudColoured::duplicate ( ) const [virtual]

Returns a copy of the object, indepently of its class.

Implements mrpt::utils::CObject.

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

Definition at line 212 of file CPointCloudColoured.h.

iterator mrpt::opengl::CPointCloudColoured::end ( ) [inline, private]

Definition at line 87 of file CPointCloudColoured.h.

const_iterator mrpt::opengl::CPointCloudColoured::end ( ) const [inline, private]

Definition at line 88 of file CPointCloudColoured.h.

size_t mrpt::opengl::CPointCloudColoured::getActuallyRendered ( ) const [inline]

Get the number of elements actually rendered in the last render event.

Definition at line 201 of file CPointCloudColoured.h.

const TPointColour& mrpt::opengl::CPointCloudColoured::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 133 of file CPointCloudColoured.h.

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

mrpt::math::TPoint3Df mrpt::opengl::CPointCloudColoured::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 141 of file CPointCloudColoured.h.

References ASSERT_BELOW_, mrpt::math::size(), and Eigen::internal::y.

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

Definition at line 210 of file CPointCloudColoured.h.

virtual const mrpt::utils::TRuntimeClassId* mrpt::opengl::CPointCloudColoured::GetRuntimeClass ( ) const [virtual]

Returns information about the class of an object in runtime.

Reimplemented from mrpt::opengl::CRenderizable.

bool mrpt::opengl::CPointCloudColoured::isPointSmoothEnabled ( ) const [inline]

Definition at line 214 of file CPointCloudColoured.h.

template<class POINTSMAP >
void mrpt::opengl::CPointCloudColoured::loadFromPointsMap ( const POINTSMAP *  m) [inline]

Load the points from a points map (passed as a pointer), depending on the type of point map passed: for the case of a mrpt::slam::CColouredPointMap the colours of individual points will be also copied.

The possible classes accepted as arguments are: mrpt::slam::CColouredPointsMap, or in general any mrpt::slam::CPointsMap.

Note:
The method is a template since CPointsMap belongs to a different mrpt library.

Definition at line 161 of file CPointCloudColoured.h.

References Eigen::internal::y, mrpt::utils::TColorf::R, mrpt::utils::TColorf::G, and mrpt::utils::TColorf::B.

void mrpt::opengl::CPointCloudColoured::markAllPointsAsNew ( ) [private]

Do needed internal work if all points are new (octree rebuilt,...)

const TPointColour& mrpt::opengl::CPointCloudColoured::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 125 of file CPointCloudColoured.h.

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

virtual size_t mrpt::opengl::CPointCloudColoured::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 245 of file CPointCloudColoured.h.

virtual void mrpt::opengl::CPointCloudColoured::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.

Parameters:
pt_colorWill be NULL if the loaded file does not provide color info.

Implements mrpt::utils::PLY_Exporter.

virtual size_t mrpt::opengl::CPointCloudColoured::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::CPointCloudColoured::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 231 of file CPointCloudColoured.h.

virtual void mrpt::opengl::CPointCloudColoured::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.

Parameters:
pt_colorWill be NULL if the loaded file does not provide color info.

Implements mrpt::utils::PLY_Importer.

virtual void mrpt::opengl::CPointCloudColoured::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::CPointCloudColoured::push_back ( float  x,
float  y,
float  z,
float  R,
float  G,
float  B 
)

Inserts a new point into the point cloud.

void mrpt::opengl::CPointCloudColoured::render ( ) const [virtual]

Render.

Implements mrpt::opengl::CRenderizable.

void mrpt::opengl::CPointCloudColoured::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::CPointCloudColoured::reserve ( size_t  N) [inline]

Like STL std::vector's reserve.

Definition at line 122 of file CPointCloudColoured.h.

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

Set the number of points, with undefined contents.

Definition at line 119 of file CPointCloudColoured.h.

void mrpt::opengl::CPointCloudColoured::setPoint ( size_t  i,
const TPointColour &  p 
)

Write an individual point (checks for "i" in the valid range only in Debug).

void mrpt::opengl::CPointCloudColoured::setPointSize ( float  pointSize) [inline]

Definition at line 209 of file CPointCloudColoured.h.

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

Return the number of points.

Definition at line 151 of file CPointCloudColoured.h.


Member Data Documentation

Definition at line 69 of file CPointCloudColoured.h.

Definition at line 69 of file CPointCloudColoured.h.

Definition at line 69 of file CPointCloudColoured.h.

Definition at line 93 of file CPointCloudColoured.h.

Definition at line 93 of file CPointCloudColoured.h.

Definition at line 81 of file CPointCloudColoured.h.

By default is 1.0.

Definition at line 91 of file CPointCloudColoured.h.

Default: false.

Definition at line 92 of file CPointCloudColoured.h.




Page generated by Doxygen 1.7.5 for MRPT 0.9.5 SVN: at Sun Oct 16 12:16:33 UTC 2011