ACloudViewer  3.9.4
A Modern Library for 3D Data Processing
cloudViewer::PointCloud Class Reference

#include <CVPointCloud.h>

Inheritance diagram for cloudViewer::PointCloud:
Collaboration diagram for cloudViewer::PointCloud:

Public Member Functions

 PointCloud ()=default
 Default constructor. More...
 
 ~PointCloud () override=default
 Default destructor. More...
 
bool reserveNormals (unsigned newCount)
 Reserves memory to store the normals. More...
 
bool resize (unsigned newCount) override
 Resizes the point database. More...
 
void addNormal (const CCVector3 &N)
 Adds a normal. More...
 
std::vector< CCVector3 > & normals ()
 Returns the set of normals. More...
 
const std::vector< CCVector3 > & normals () const
 Returns the set of normals (const version) More...
 
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 cloudViewer::PointCloudTpl< GenericIndexedCloudPersist >
 PointCloudTpl ()
 Default constructor. More...
 
virtual ~PointCloudTpl ()
 Default destructor. More...
 
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
 
void getPoint (unsigned index, double P[3]) const override
 
CCVector3getPointPtr (size_t index)
 
std::vector< CCVector3 > & getPoints ()
 
const std::vector< CCVector3 > & getPoints () const
 
const CCVector3getPointPersistentPtr (unsigned index) override
 
const CCVector3getPointPersistentPtr (unsigned index) const
 
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...
 
void addPoint (double x, double y, double z)
 
void addPoint (double xyz[3])
 
void setPoint (size_t index, const CCVector3 &P)
 
void setEigenPoint (size_t index, const Eigen::Vector3d &point)
 
void addEigenPoint (const Eigen::Vector3d &point)
 
void addPoints (const std::vector< CCVector3 > &points)
 
void addPoints (const std::vector< Eigen::Vector3d > &points)
 
Eigen::Vector3d getEigenPoint (size_t index) const
 
std::vector< Eigen::Vector3d > getEigenPoints () const
 
void setEigenPoints (const std::vector< Eigen::Vector3d > &points)
 
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) More...
 
void setCurrentOutScalarField (int index)
 Sets the OUTPUT scalar field. More...
 
int getCurrentOutScalarFieldIndex ()
 Returns current OUTPUT scalar field index (or -1 if none) More...
 
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. More...
 
unsigned capacity () const
 Returns cloud capacity (i.e. reserved size) More...
 
- Public Member Functions inherited from cloudViewer::GenericIndexedCloudPersist
 ~GenericIndexedCloudPersist () override=default
 Default destructor. More...
 
- Public Member Functions inherited from cloudViewer::GenericIndexedCloud
 ~GenericIndexedCloud () override=default
 Default destructor. More...
 
- Public Member Functions inherited from cloudViewer::GenericCloud
 GenericCloud ()=default
 Default constructor. More...
 
virtual ~GenericCloud ()=default
 Default destructor. More...
 
virtual bool hasPoints () const
 
virtual unsigned char testVisibility (const CCVector3 &P) const
 

Protected Attributes

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

Additional Inherited Members

- Public Types inherited from cloudViewer::GenericCloud
using genericPointAction = std::function< void(const CCVector3 &, ScalarType &)>
 Generic function applied to a point (used by foreach) More...
 
- Protected Member Functions inherited from cloudViewer::PointCloudTpl< GenericIndexedCloudPersist >
virtual void swapPoints (unsigned firstIndex, unsigned secondIndex)
 Swaps two points (and their associated scalar values!) More...
 
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

Definition at line 18 of file CVPointCloud.h.

Constructor & Destructor Documentation

◆ PointCloud()

cloudViewer::PointCloud::PointCloud ( )
default

Default constructor.

◆ ~PointCloud()

cloudViewer::PointCloud::~PointCloud ( )
overridedefault

Default destructor.

Member Function Documentation

◆ addNormal()

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

Adds a normal.

Parameters
Na 3D normal

Definition at line 61 of file CVPointCloud.h.

Referenced by cloudViewer::PointProjectionTools::applyTransformation().

◆ getNormal()

const CCVector3* cloudViewer::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 cloudViewer::GenericIndexedCloud.

Definition at line 76 of file CVPointCloud.h.

◆ normals() [1/2]

std::vector<CCVector3>& cloudViewer::PointCloud::normals ( )
inline

Returns the set of normals.

Definition at line 67 of file CVPointCloud.h.

◆ normals() [2/2]

const std::vector<CCVector3>& cloudViewer::PointCloud::normals ( ) const
inline

Returns the set of normals (const version)

Definition at line 70 of file CVPointCloud.h.

◆ normalsAvailable()

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

Returns whether normals are available.

Reimplemented from cloudViewer::GenericIndexedCloud.

Definition at line 73 of file CVPointCloud.h.

References size.

◆ reserveNormals()

bool cloudViewer::PointCloud::reserveNormals ( unsigned  newCount)
inline

Reserves memory to store the normals.

Definition at line 28 of file CVPointCloud.h.

Referenced by cloudViewer::PointProjectionTools::applyTransformation().

◆ resize()

bool cloudViewer::PointCloud::resize ( unsigned  newCount)
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 cloudViewer::PointCloudTpl< GenericIndexedCloudPersist >.

Definition at line 41 of file CVPointCloud.h.

Referenced by cloudViewer::FPCSRegistrationTools::FilterCandidates(), ImportSourceVertices(), MergeOldTriangles(), cloudViewer::ICPRegistrationTools::Register(), cloudViewer::MeshSamplingTools::samplePointsOnMesh(), and cloudViewer::ManualSegmentationTools::segmentMeshWithAABox().

Member Data Documentation

◆ m_normals

std::vector<CCVector3> cloudViewer::PointCloud::m_normals
protected

Point normals (if any)

Definition at line 82 of file CVPointCloud.h.


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