CCCoreLib 31 May 2022
CloudCompare Core algorithms
|
A very simple point cloud (no point duplication) More...
#include <ReferenceCloud.h>
Public Member Functions | |
ReferenceCloud (GenericIndexedCloudPersist *associatedCloud) | |
Default constructor. | |
ReferenceCloud (const ReferenceCloud &refCloud) | |
Copy constructor. | |
~ReferenceCloud () override=default | |
Destructor. | |
unsigned | size () const override |
Returns the number of points. More... | |
void | forEach (genericPointAction action) override |
Fast iteration mechanism. More... | |
void | getBoundingBox (CCVector3 &bbMin, CCVector3 &bbMax) override |
Returns the cloud bounding box. More... | |
unsigned char | testVisibility (const CCVector3 &P) const override |
Returns a given point visibility state (relatively to a sensor for instance) More... | |
void | placeIteratorAtBeginning () override |
Sets the cloud iterator at the beginning. More... | |
const CCVector3 * | getNextPoint () override |
Returns the next point (relatively to the global iterator position) More... | |
bool | enableScalarField () override |
Enables the scalar field associated to the cloud. More... | |
bool | isScalarFieldEnabled () const override |
Returns true if the scalar field is enabled, false otherwise. More... | |
void | setPointScalarValue (unsigned pointIndex, ScalarType value) override |
Sets the ith point associated scalar value. More... | |
ScalarType | getPointScalarValue (unsigned pointIndex) const override |
Returns the ith point associated scalar value. More... | |
const CCVector3 * | getPoint (unsigned index) const override |
Returns the ith point. More... | |
void | getPoint (unsigned index, CCVector3 &P) const override |
Returns the ith point. More... | |
bool | normalsAvailable () const override |
Returns whether normals are available. More... | |
const CCVector3 * | getNormal (unsigned index) const override |
If per-point normals are available, returns the one at a specific index. More... | |
const CCVector3 * | getPointPersistentPtr (unsigned index) const override |
Returns the ith point as a persistent pointer. More... | |
virtual unsigned | getPointGlobalIndex (unsigned localIndex) const |
Returns global index (i.e. relative to the associated cloud) of a given element. More... | |
virtual const CCVector3 * | getCurrentPointCoordinates () const |
Returns the coordinates of the point pointed by the current element. More... | |
virtual unsigned | getCurrentPointGlobalIndex () const |
Returns the global index of the point pointed by the current element. | |
virtual ScalarType | getCurrentPointScalarValue () const |
Returns the current point associated scalar value. | |
virtual void | setCurrentPointScalarValue (ScalarType value) |
Sets the current point associated scalar value. | |
virtual void | forwardIterator () |
Forwards the local element iterator. | |
virtual void | clear (bool releaseMemory=false) |
Clears the cloud. More... | |
virtual bool | addPointIndex (unsigned globalIndex) |
Point global index insertion mechanism. More... | |
virtual bool | addPointIndex (unsigned firstIndex, unsigned lastIndex) |
Point global index insertion mechanism (range) More... | |
virtual void | setPointIndex (unsigned localIndex, unsigned globalIndex) |
Sets global index for a given element. More... | |
virtual bool | reserve (unsigned n) |
Reserves some memory for hosting the point references. More... | |
virtual bool | resize (unsigned n) |
Presets the size of the vector used to store point references. More... | |
virtual unsigned | capacity () const |
Returns max capacity. | |
virtual void | swap (unsigned i, unsigned j) |
Swaps two point references. More... | |
virtual void | removeCurrentPointGlobalIndex () |
Removes current element. More... | |
virtual void | removePointGlobalIndex (unsigned localIndex) |
Removes a given element. More... | |
virtual GenericIndexedCloudPersist * | getAssociatedCloud () |
Returns the associated (source) cloud. | |
virtual const GenericIndexedCloudPersist * | getAssociatedCloud () const |
Returns the associated (source) cloud (const version) | |
virtual void | setAssociatedCloud (GenericIndexedCloudPersist *cloud) |
Sets the associated (source) cloud. | |
bool | add (const ReferenceCloud &cloud) |
Add another reference cloud. More... | |
void | invalidateBoundingBox () |
Invalidates the bounding-box. | |
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 CCVector3 * | getPointPersistentPtr (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 CCVector3 * | getPoint (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 CCVector3 * | getNormal (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 CCVector3 * | getNextPoint ()=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 Types | |
using | ReferencesContainer = std::vector< unsigned int > |
Container of 3D point indexes. | |
Protected Attributes | |
ReferencesContainer | m_theIndexes |
Indexes of (some of) the associated cloud points. | |
std::atomic< unsigned > | m_globalIterator |
Iterator on the point references container. | |
BoundingBox | m_bbox |
Bounding-box. | |
GenericIndexedCloudPersist * | m_theAssociatedCloud |
Associated cloud. More... | |
std::mutex | m_mutex |
For concurrent access. | |
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) | |
A very simple point cloud (no point duplication)
Implements the GenericIndexedCloudPersist interface. A simple point cloud that stores references to Generic3dPoint instances in a vector.
Partial thread safety for all methods that can change the size of the cloud or that change or rely on point ordering.
bool ReferenceCloud::add | ( | const ReferenceCloud & | cloud | ) |
Add another reference cloud.
|
virtual |
Point global index insertion mechanism (range)
firstIndex | first point global index of range |
lastIndex | last point global index of range (excluded) |
|
virtual |
Point global index insertion mechanism.
globalIndex | a point global index |
|
virtual |
|
inlineoverridevirtual |
Enables the scalar field associated to the cloud.
If the scalar field structure is not yet initialized/allocated, this method gives the signal for its creation. Otherwise, if possible the structure size should be pre-reserved with the same number of elements as the point cloud.
Implements CCCoreLib::GenericCloud.
|
overridevirtual |
Fast iteration mechanism.
Virtual method to apply a function to the whole cloud
action | the function to apply (see GenericCloud::genericPointAction) |
Implements CCCoreLib::GenericCloud.
Returns the cloud bounding box.
Virtual method to request the cloud bounding box limits
bbMin | lower bounding-box limits (Xmin,Ymin,Zmin) |
bbMax | higher bounding-box limits (Xmax,Ymax,Zmax) |
Implements CCCoreLib::GenericCloud.
|
virtual |
Returns the coordinates of the point pointed by the current element.
Returns a persistent pointer.
|
inlineoverridevirtual |
Returns the next point (relatively to the global iterator position)
Virtual method to handle the cloud global iterator. Global iterator position should be increased by one each time this method is called. Warning:
Implements CCCoreLib::GenericCloud.
|
inlineoverridevirtual |
If per-point normals are available, returns the one at a specific index.
Reimplemented from CCCoreLib::GenericIndexedCloud.
|
inlineoverridevirtual |
Returns the ith point.
Virtual method to request a point with a specific index. WARNINGS:
index | of the requested point (between 0 and the cloud size minus 1) |
Implements CCCoreLib::GenericIndexedCloud.
|
inlineoverridevirtual |
Returns the ith point.
Virtual method to request a point with a specific index. Index must be valid (undefined behavior if index is invalid)
index | of the requested point (between 0 and the cloud size minus 1) |
P | output point |
Implements CCCoreLib::GenericIndexedCloud.
|
inlinevirtual |
Returns global index (i.e. relative to the associated cloud) of a given element.
localIndex | local index (i.e. relative to the internal index container) |
|
inlineoverridevirtual |
Returns the ith point as a persistent pointer.
Virtual method to request a point with a specific index. WARNING: the returned object MUST be persistent in order to be compatible with parallel strategies!
index | of the requested point (between 0 and the cloud size minus 1) |
Implements CCCoreLib::GenericIndexedCloudPersist.
|
inlineoverridevirtual |
Returns the ith point associated scalar value.
Implements CCCoreLib::GenericCloud.
|
inlineoverridevirtual |
Returns true if the scalar field is enabled, false otherwise.
Implements CCCoreLib::GenericCloud.
|
inlineoverridevirtual |
Returns whether normals are available.
Reimplemented from CCCoreLib::GenericIndexedCloud.
|
inlineoverridevirtual |
Sets the cloud iterator at the beginning.
Virtual method to handle the cloud global iterator
Implements CCCoreLib::GenericCloud.
|
inlinevirtual |
Removes current element.
WARNING: this method changes the cloud size! Thread safe.
|
virtual |
Removes a given element.
WARNING: this method changes the cloud size! Thread safe.
|
virtual |
Reserves some memory for hosting the point references.
n | the number of points (references) Thread safe. |
|
virtual |
Presets the size of the vector used to store point references.
n | the number of points (references) Thread safe. |
|
virtual |
Sets global index for a given element.
localIndex | local index |
globalIndex | global index |
|
inlineoverridevirtual |
Sets the ith point associated scalar value.
Implements CCCoreLib::GenericCloud.
|
inlineoverridevirtual |
Returns the number of points.
Virtual method to request the cloud size
Implements CCCoreLib::GenericCloud.
|
inlinevirtual |
Swaps two point references.
the point references indexes should be smaller than the total number of "reserved" points (see ReferenceCloud::reserve).
i | the first point index |
j | the second point index Thread safe. |
|
inlineoverridevirtual |
Returns a given point visibility state (relatively to a sensor for instance)
Generic method to request a point visibility (should be overloaded if this functionality is required). The point visibility is such as defined in Daniel Girardeau-Montaut's PhD manuscript (see Chapter 2, section 2-3-3). In this case, a ground based laser sensor model should be used to determine it. This method is called before performing any point-to-cloud comparison. If the result is not POINT_VISIBLE, then the comparison won't be performed and the scalar field value associated to this point will be this visibility value.
P | the 3D point to test |
Reimplemented from CCCoreLib::GenericCloud.
|
protected |
Associated cloud.
The cloud from which references are referring to. WARNING: do not use the inner iterator as it is used to 'implement' the ReferenceCloud one.