CCCoreLib 31 May 2022
CloudCompare Core algorithms
Public Member Functions | Protected Attributes | List of all members
CCCoreLib::PointCloud Class Reference

A storage-efficient point cloud structure that can also handle an unlimited number of scalar fields. More...

#include <PointCloud.h>

Inheritance diagram for CCCoreLib::PointCloud:
Inheritance graph
[legend]
Collaboration diagram for CCCoreLib::PointCloud:
Collaboration graph
[legend]

Public Member Functions

 PointCloud ()=default
 Default constructor.
 
 ~PointCloud () override=default
 Default destructor.
 
bool reserveNormals (unsigned newCount)
 Reserves memory to store the normals.
 
bool resize (unsigned newNumberOfPoints) override
 Resizes the point database. More...
 
void addNormal (const CCVector3 &N)
 Adds a normal. More...
 
std::vector< CCVector3 > & normals ()
 Returns the set of normals.
 
const std::vector< CCVector3 > & normals () const
 Returns the set of normals (const version)
 
bool normalsAvailable () const override
 Returns whether normals are available. More...
 
const CCVector3getNormal (unsigned pointIndex) const override
 If per-point normals are available, returns the one at a specific index. More...
 
- Public Member Functions inherited from CCCoreLib::PointCloudTpl< GenericIndexedCloudPersist >
 PointCloudTpl ()
 Default constructor.
 
 PointCloudTpl (const char * name, unsigned ID)
 Alternate constructor with a name and ID.
 
 PointCloudTpl (const PointCloudTpl &rhs)
 Copy Constructor.
 
virtual ~PointCloudTpl ()
 Default destructor.
 
PointCloudTploperator= (const PointCloudTpl &rhs)
 Copy Assignment.
 
unsigned size () const override
 
void forEach (GenericCloud::genericPointAction action) override
 
void getBoundingBox (CCVector3 &bbMin, CCVector3 &bbMax) override
 
void placeIteratorAtBeginning () override
 
const CCVector3getNextPoint () override
 
bool enableScalarField () override
 
bool isScalarFieldEnabled () const override
 
void setPointScalarValue (unsigned pointIndex, ScalarType value) override
 
ScalarType getPointScalarValue (unsigned pointIndex) const override
 
const CCVector3getPoint (unsigned index) const override
 
void getPoint (unsigned index, CCVector3 &P) const override
 
const CCVector3getPointPersistentPtr (unsigned index) const override
 
void addPointScalarValue (ScalarType value)
 Adds a scalar values to the active 'in' scalar field. More...
 
virtual bool resize (unsigned newNumberOfPoints)
 Resizes the point database. More...
 
virtual bool reserve (unsigned newCapacity)
 Reserves memory for the point database. More...
 
void reset ()
 Clears the cloud database. More...
 
void addPoint (const CCVector3 &P)
 Adds a 3D point to the database. More...
 
virtual void invalidateBoundingBox ()
 Invalidates bounding box. More...
 
unsigned getNumberOfScalarFields () const
 Returns the number of associated (and active) scalar fields. More...
 
ScalarFieldgetScalarField (int index) const
 Returns a pointer to a specific scalar field. More...
 
const char * getScalarFieldName (int index) const
 Returns the name of a specific scalar field. More...
 
int getScalarFieldIndexByName (const char *name) const
 Returns the index of a scalar field represented by its name. More...
 
ScalarFieldgetCurrentInScalarField () const
 Returns the scalar field currently associated to the cloud input. More...
 
ScalarFieldgetCurrentOutScalarField () const
 Returns the scalar field currently associated to the cloud output. More...
 
void setCurrentInScalarField (int index)
 Sets the INPUT scalar field. More...
 
int getCurrentInScalarFieldIndex ()
 Returns current INPUT scalar field index (or -1 if none)
 
void setCurrentOutScalarField (int index)
 Sets the OUTPUT scalar field. More...
 
int getCurrentOutScalarFieldIndex ()
 Returns current OUTPUT scalar field index (or -1 if none)
 
void setCurrentScalarField (int index)
 Sets both the INPUT & OUTPUT scalar field. More...
 
virtual int addScalarField (const char *uniqueName)
 Creates a new scalar field and registers it. More...
 
bool renameScalarField (int index, const char *newName)
 Renames a specific scalar field. More...
 
virtual void deleteScalarField (int index)
 Deletes a specific scalar field. More...
 
virtual void deleteAllScalarFields ()
 Deletes all scalar fields associated to this cloud.
 
unsigned capacity () const
 Returns cloud capacity (i.e. reserved size)
 
- Public Member Functions inherited from CCCoreLib::GenericIndexedCloudPersist
 GenericIndexedCloudPersist ()=default
 Default constructor.
 
 GenericIndexedCloudPersist (const char *name, unsigned ID)
 Mock constructor for compatibility with the PointCloudTpl interface. More...
 
 ~GenericIndexedCloudPersist () override=default
 Default destructor.
 
virtual const CCVector3getPointPersistentPtr (unsigned index) const =0
 Returns the ith point as a persistent pointer. More...
 
- Public Member Functions inherited from CCCoreLib::GenericIndexedCloud
 GenericIndexedCloud ()=default
 Default constructor.
 
 ~GenericIndexedCloud () override=default
 Default destructor.
 
virtual const CCVector3getPoint (unsigned index) const =0
 Returns the ith point. More...
 
virtual void getPoint (unsigned index, CCVector3 &P) const =0
 Returns the ith point. More...
 
virtual bool normalsAvailable () const
 Returns whether normals are available. More...
 
virtual const CCVector3getNormal (unsigned index) const
 If per-point normals are available, returns the one at a specific index. More...
 
- Public Member Functions inherited from CCCoreLib::GenericCloud
 GenericCloud ()=default
 Default constructor.
 
virtual ~GenericCloud ()=default
 Default destructor.
 
virtual unsigned size () const =0
 Returns the number of points. More...
 
virtual void forEach (genericPointAction action)=0
 Fast iteration mechanism. More...
 
virtual void getBoundingBox (CCVector3 &bbMin, CCVector3 &bbMax)=0
 Returns the cloud bounding box. More...
 
virtual unsigned char testVisibility (const CCVector3 &P) const
 Returns a given point visibility state (relatively to a sensor for instance) More...
 
virtual void placeIteratorAtBeginning ()=0
 Sets the cloud iterator at the beginning. More...
 
virtual const CCVector3getNextPoint ()=0
 Returns the next point (relatively to the global iterator position) More...
 
virtual bool enableScalarField ()=0
 Enables the scalar field associated to the cloud. More...
 
virtual bool isScalarFieldEnabled () const =0
 Returns true if the scalar field is enabled, false otherwise. More...
 
virtual void setPointScalarValue (unsigned pointIndex, ScalarType value)=0
 Sets the ith point associated scalar value. More...
 
virtual ScalarType getPointScalarValue (unsigned pointIndex) const =0
 Returns the ith point associated scalar value. More...
 

Protected Attributes

std::vector< CCVector3m_normals
 Point normals (if any)
 
- Protected Attributes inherited from CCCoreLib::PointCloudTpl< GenericIndexedCloudPersist >
std::vector< CCVector3m_points
 3D Points database
 
BoundingBox m_bbox
 Bounding-box.
 
unsigned m_currentPointIndex
 'Iterator' on the points db
 
std::vector< ScalarField * > m_scalarFields
 Associated scalar fields.
 
int m_currentInScalarFieldIndex
 Index of current scalar field used for input.
 
int m_currentOutScalarFieldIndex
 Index of current scalar field used for output.
 

Additional Inherited Members

- Public Types inherited from CCCoreLib::GenericCloud
using genericPointAction = std::function< void(const CCVector3 &, ScalarType &)>
 Generic function applied to a point (used by foreach)
 
- Protected Member Functions inherited from CCCoreLib::PointCloudTpl< GenericIndexedCloudPersist >
virtual void swapPoints (unsigned firstIndex, unsigned secondIndex)
 Swaps two points (and their associated scalar values!)
 
CCVector3point (unsigned index)
 Returns non const access to a given point. More...
 
const CCVector3point (unsigned index) const
 Returns const access to a given point. More...
 

Detailed Description

A storage-efficient point cloud structure that can also handle an unlimited number of scalar fields.

Member Function Documentation

◆ addNormal()

void CCCoreLib::PointCloud::addNormal ( const CCVector3 N)
inline

Adds a normal.

Parameters
Na 3D normal

◆ getNormal()

const CCVector3 * CCCoreLib::PointCloud::getNormal ( unsigned  index) const
inlineoverridevirtual

If per-point normals are available, returns the one at a specific index.

Warning
If overriden, this method should return a valid normal for all points

Reimplemented from CCCoreLib::GenericIndexedCloud.

◆ normalsAvailable()

bool CCCoreLib::PointCloud::normalsAvailable ( ) const
inlineoverridevirtual

Returns whether normals are available.

Reimplemented from CCCoreLib::GenericIndexedCloud.

◆ resize()

bool CCCoreLib::PointCloud::resize ( unsigned  newNumberOfPoints)
inlineoverridevirtual

Resizes the point database.

The cloud database is resized with the specified size. If the new size is smaller, the overflooding points will be deleted. If its greater, the database is filled with blank points (warning, the PointCloud::addPoint method will insert points after those ones).

Parameters
newNumberOfPointsthe new number of points
Returns
true if the method succeeds, false otherwise

Reimplemented from CCCoreLib::PointCloudTpl< GenericIndexedCloudPersist >.


The documentation for this class was generated from the following file: