CCCoreLib 31 May 2022
CloudCompare Core algorithms
|
A storage-efficient point cloud structure that can also handle an unlimited number of scalar fields. More...
#include <PointCloudTpl.h>
Public Member Functions | |
PointCloudTpl () | |
Default constructor. | |
PointCloudTpl (StringType name, unsigned ID) | |
Alternate constructor with a name and ID. | |
PointCloudTpl (const PointCloudTpl &rhs) | |
Copy Constructor. | |
virtual | ~PointCloudTpl () |
Default destructor. | |
PointCloudTpl & | operator= (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 CCVector3 * | getNextPoint () override |
bool | enableScalarField () override |
bool | isScalarFieldEnabled () const override |
void | setPointScalarValue (unsigned pointIndex, ScalarType value) override |
ScalarType | getPointScalarValue (unsigned pointIndex) const override |
const CCVector3 * | getPoint (unsigned index) const override |
void | getPoint (unsigned index, CCVector3 &P) const override |
const CCVector3 * | getPointPersistentPtr (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... | |
ScalarField * | getScalarField (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... | |
ScalarField * | getCurrentInScalarField () const |
Returns the scalar field currently associated to the cloud input. More... | |
ScalarField * | getCurrentOutScalarField () 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) | |
Protected Member Functions | |
virtual void | swapPoints (unsigned firstIndex, unsigned secondIndex) |
Swaps two points (and their associated scalar values!) | |
CCVector3 * | point (unsigned index) |
Returns non const access to a given point. More... | |
const CCVector3 * | point (unsigned index) const |
Returns const access to a given point. More... | |
Protected Attributes | |
std::vector< CCVector3 > | m_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. | |
A storage-efficient point cloud structure that can also handle an unlimited number of scalar fields.
|
inline |
Adds a 3D point to the database.
To ensure the best efficiency, the database memory must have already been reserved (with PointCloud::reserve). Otherwise nothing happens.
P | a 3D point |
|
inline |
Adds a scalar values to the active 'in' scalar field.
value | a scalar value |
|
inlinevirtual |
Creates a new scalar field and registers it.
Warnings:
uniqueName | scalar field name (must be unique) |
|
inlinevirtual |
Deletes a specific scalar field.
WARNING: this operation may modify the scalar fields order (especially if the deleted SF is not the last one). However current IN & OUT scalar fields will stay up-to-date (while their index may change).
index | index of scalar field to be deleted |
|
inline |
Returns the scalar field currently associated to the cloud input.
See PointCloud::setPointScalarValue.
|
inline |
Returns the scalar field currently associated to the cloud output.
See PointCloud::getPointScalarValue.
|
inline |
Returns the number of associated (and active) scalar fields.
|
inline |
Returns a pointer to a specific scalar field.
index | a scalar field index |
|
inline |
Returns the index of a scalar field represented by its name.
name | a scalar field name |
|
inline |
Returns the name of a specific scalar field.
index | a scalar field index |
|
inlinevirtual |
Invalidates bounding box.
Bounding box will be recomputed next time a request is made to 'getBoundingBox'.
|
inlineprotected |
Returns non const access to a given point.
WARNING: index must be valid
index | point index |
|
inlineprotected |
Returns const access to a given point.
WARNING: index must be valid
index | point index |
|
inline |
Renames a specific scalar field.
Warning: name must not be already given to another SF!
index | scalar field index |
newName | new name |
|
inlinevirtual |
Reserves memory for the point database.
This method tries to reserve some memory to store points that will be inserted later (with PointCloud::addPoint). If the new number of points is smaller than the actual one, nothing happens.
newCapacity | the new capacity |
|
inline |
Clears the cloud database.
Equivalent to resize(0).
|
inlinevirtual |
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).
newNumberOfPoints | the new number of points |
Reimplemented in CCCoreLib::PointCloud.
|
inline |
Sets the INPUT scalar field.
This scalar field will be used by the PointCloud::setPointScalarValue method.
index | a scalar field index (or -1 if none) |
|
inline |
Sets the OUTPUT scalar field.
This scalar field will be used by the PointCloud::getPointScalarValue method.
index | a scalar field index (or -1 if none) |
|
inline |
Sets both the INPUT & OUTPUT scalar field.
This scalar field will be used by both PointCloud::getPointScalarValue and PointCloud::setPointScalarValue methods.
index | a scalar field index |