qCC_db version 2.13.alpha (Qt) - 31 May 2022
CloudCompare 3D entities
Classes | Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
ccPointCloud Class Reference

A 3D cloud and its associated features (color, normals, scalar fields, etc.) More...

#include <ccPointCloud.h>

Inheritance diagram for ccPointCloud:
Inheritance graph
[legend]
Collaboration diagram for ccPointCloud:
Collaboration graph
[legend]

Classes

struct  Grid
 Grid structure. More...
 
struct  UnrollBaseParams
 
struct  UnrollConeParams
 
struct  UnrollCylinderParams
 
class  VBO
 
struct  vboSet
 VBO set. More...
 

Public Types

enum  CLONE_WARNINGS { WRN_OUT_OF_MEM_FOR_COLORS = 1 , WRN_OUT_OF_MEM_FOR_NORMALS = 2 , WRN_OUT_OF_MEM_FOR_SFS = 4 , WRN_OUT_OF_MEM_FOR_FWF = 8 }
 Warnings for the partialClone method (bit flags)
 
enum  UnrollMode { CYLINDER = 0 , CONE = 1 , STRAIGHTENED_CONE = 2 , STRAIGHTENED_CONE2 = 3 }
 
using BaseClass = CCCoreLib::PointCloudTpl< ccGenericPointCloud, QString >
 Base class (shortcut)
 
using FWFDescriptorSet = QMap< uint8_t, WaveformDescriptor >
 Waveform descriptors set.
 
using FWFDataContainer = std::vector< uint8_t >
 Waveform data container.
 
using SharedFWFDataContainer = QSharedPointer< const FWFDataContainer >
 

Public Member Functions

 ccPointCloud (QString name=QString(), unsigned uniqueID=ccUniqueIDGenerator::InvalidUniqueID) throw ()
 Default constructor. More...
 
 ~ccPointCloud () override
 Default destructor.
 
CC_CLASS_ENUM getClassID () const override
 Returns class ID.
 
ccPointCloudpartialClone (const CCCoreLib::ReferenceCloud *selection, int *warnings=nullptr) const
 Creates a new point cloud object from a ReferenceCloud (selection) More...
 
ccPointCloudcloneThis (ccPointCloud *destCloud=nullptr, bool ignoreChildren=false)
 Clones this entity. More...
 
ccGenericPointCloudclone (ccGenericPointCloud *destCloud=nullptr, bool ignoreChildren=false) override
 
const ccPointCloudoperator+= (ccPointCloud *)
 Fuses another 3D entity with this one. More...
 
void clear () override
 Clears the entity from all its points and features. More...
 
void unallocatePoints ()
 Erases the cloud points. More...
 
void unallocateColors ()
 Erases the cloud colors.
 
void unallocateNorms ()
 Erases the cloud normals.
 
void colorsHaveChanged ()
 Notify a modification of color / scalar field display parameters or contents.
 
void normalsHaveChanged ()
 Notify a modification of normals display parameters or contents.
 
void pointsHaveChanged ()
 Notify a modification of points display parameters or contents.
 
bool reserveThePointsTable (unsigned _numberOfPoints)
 Reserves memory to store the points coordinates. More...
 
bool reserveTheRGBTable ()
 Reserves memory to store the RGB colors. More...
 
bool resizeTheRGBTable (bool fillWithWhite=false)
 Resizes the RGB colors array. More...
 
bool reserveTheNormsTable ()
 Reserves memory to store the compressed normals. More...
 
bool resizeTheNormsTable ()
 Resizes the compressed normals array. More...
 
bool reserve (unsigned numberOfPoints) override
 Reserves memory for all the active features. More...
 
bool resize (unsigned numberOfPoints) override
 Resizes all the active features arrays. More...
 
void shrinkToFit ()
 Removes unused capacity.
 
ccScalarFieldgetCurrentDisplayedScalarField () const
 Returns the currently displayed scalar (or 0 if none)
 
int getCurrentDisplayedScalarFieldIndex () const
 Returns the currently displayed scalar field index (or -1 if none)
 
void setCurrentDisplayedScalarField (int index)
 Sets the currently displayed scalar field. More...
 
void deleteScalarField (int index) override
 
void deleteAllScalarFields () override
 
int addScalarField (const char *uniqueName) override
 
bool sfColorScaleShown () const
 Returns whether color scale should be displayed or not.
 
void showSFColorsScale (bool state)
 Sets whether color scale should be displayed or not.
 
size_t gridCount () const
 Returns the number of associated grids.
 
Grid::Sharedgrid (size_t gridIndex)
 Returns an associated grid.
 
const Grid::Sharedgrid (size_t gridIndex) const
 Returns an associated grid (const version)
 
bool addGrid (Grid::Shared grid)
 Adds an associated grid.
 
void removeGrids ()
 Remove all associated grids.
 
ccMeshtriangulateGrid (const Grid &grid, double minTriangleAngle_deg=0.0) const
 Meshes a scan grid. More...
 
bool computeNormalsWithGrids (double minTriangleAngle_deg=1.0, ccProgressDialog *pDlg=nullptr)
 Compute the normals with the associated grid structure(s) More...
 
bool orientNormalsWithGrids (ccProgressDialog *pDlg=nullptr)
 Orient the normals with the associated grid structure(s)
 
bool orientNormalsTowardViewPoint (CCVector3 &VP, ccProgressDialog *pDlg=nullptr)
 Normals are forced to point to O.
 
bool computeNormalsWithOctree (CCCoreLib::LOCAL_MODEL_TYPES model, ccNormalVectors::Orientation preferredOrientation, PointCoordinateType defaultRadius, ccProgressDialog *pDlg=nullptr)
 Compute the normals by approximating the local surface around each point.
 
bool orientNormalsWithMST (unsigned kNN=6, ccProgressDialog *pDlg=nullptr)
 Orient the normals with a Minimum Spanning Tree.
 
bool orientNormalsWithFM (unsigned char level, ccProgressDialog *pDlg=nullptr)
 Orient normals with Fast Marching.
 
bool hasFWF () const
 Returns whether the cloud has associated Full WaveForm data.
 
ccWaveformProxy waveformProxy (unsigned index) const
 Returns a proxy on a given waveform.
 
FWFDescriptorSetfwfDescriptors ()
 Gives access to the FWF descriptors.
 
const FWFDescriptorSetfwfDescriptors () const
 Gives access to the FWF descriptors (const version)
 
std::vector< ccWaveform > & waveforms ()
 Gives access to the associated FWF data.
 
const std::vector< ccWaveform > & waveforms () const
 Gives access to the associated FWF data (const version)
 
bool reserveTheFWFTable ()
 Reserves the FWF table.
 
bool resizeTheFWFTable ()
 Resizes the FWF table.
 
SharedFWFDataContainer & fwfData ()
 Gives access to the associated FWF data container.
 
const SharedFWFDataContainer & fwfData () const
 Gives access to the associated FWF data container (const version)
 
bool compressFWFData ()
 Compresses the associated FWF data container. More...
 
bool computeFWFAmplitude (double &minVal, double &maxVal, ccProgressDialog *pDlg=nullptr) const
 Computes the maximum amplitude of all associated waveforms.
 
void clearFWFData ()
 Clears all associated FWF data.
 
CCVector3 computeGravityCenter ()
 Returns the cloud gravity center. More...
 
void invalidateBoundingBox () override
 
void getDrawingParameters (glDrawParams &params) const override
 
unsigned getUniqueIDForDisplay () const override
 
bool hasColors () const override
 
bool hasNormals () const override
 
bool hasScalarFields () const override
 
bool hasDisplayedScalarField () const override
 
void removeFromDisplay (const ccGenericGLDisplay *win) override
 
void setDisplay (ccGenericGLDisplay *win) override
 
unsigned char testVisibility (const CCVector3 &P) const override
 
bool normalsAvailable () const override
 
const CCVector3 * getNormal (unsigned pointIndex) const override
 
const ccColor::RgbgeScalarValueColor (ScalarType d) const override
 
const ccColor::RgbgetPointScalarValueColor (unsigned pointIndex) const override
 
ScalarType getPointDisplayedDistance (unsigned pointIndex) const override
 
const ccColor::RgbagetPointColor (unsigned pointIndex) const override
 
const CompressedNormType & getPointNormalIndex (unsigned pointIndex) const override
 
const CCVector3 & getPointNormal (unsigned pointIndex) const override
 
CCCoreLib::ReferenceCloud * crop (const ccBBox &box, bool inside=true) override
 
void scale (PointCoordinateType fx, PointCoordinateType fy, PointCoordinateType fz, CCVector3 center=CCVector3(0, 0, 0)) override
 
ccGenericPointCloudcreateNewCloudFromVisibilitySelection (bool removeSelectedPoints=false, VisibilityTableType *visTable=nullptr, bool silent=false) override
 
void applyRigidTransformation (const ccGLMatrix &trans) override
 
void refreshBB () override
 
void enableVisibilityCheck (bool state)
 Sets whether visibility check is enabled or not (e.g. during distances computation) More...
 
bool hasSensor () const
 Returns whether the mesh as an associated sensor or not.
 
QSharedPointer< CCCoreLib::ReferenceCloud > computeCPSet (ccGenericPointCloud &otherCloud, CCCoreLib::GenericProgressCallback *progressCb=nullptr, unsigned char octreeLevel=0)
 Comptes the closest point of this cloud relatively to another cloud. More...
 
bool interpolateColorsFrom (ccGenericPointCloud *cloud, CCCoreLib::GenericProgressCallback *progressCb=nullptr, unsigned char octreeLevel=0)
 Interpolate colors from another cloud (nearest neighbor only)
 
void setPointColor (unsigned pointIndex, const ccColor::Rgba &col)
 Sets a particular point color. More...
 
void setPointColor (unsigned pointIndex, const ccColor::Rgb &col)
 Sets a particular point color. More...
 
void setPointNormalIndex (unsigned pointIndex, CompressedNormType norm)
 Sets a particular point compressed normal. More...
 
void setPointNormal (unsigned pointIndex, const CCVector3 &N)
 Sets a particular point normal (shortcut) More...
 
void addNormIndex (CompressedNormType index)
 Pushes a compressed normal vector. More...
 
void addNorm (const CCVector3 &N)
 Pushes a normal vector on stack (shortcut) More...
 
void addNormAtIndex (const PointCoordinateType *N, unsigned index)
 Adds a normal vector to the one at a specific index. More...
 
void setNormsTable (NormsIndexesTableType *norms)
 Sets the (compressed) normals table.
 
bool convertNormalToRGB ()
 Converts normals to RGB colors. More...
 
bool convertNormalToDipDirSFs (ccScalarField *dipSF, ccScalarField *dipDirSF)
 Converts normals to two scalar fields: 'dip' and 'dip direction'. More...
 
void addColor (const ccColor::Rgba &C)
 Pushes an RGBA color on stack. More...
 
void addColor (const ccColor::Rgb &C)
 Pushes an RGB color on stack. More...
 
void addColor (ColorCompType r, ColorCompType g, ColorCompType b, ColorCompType a=ccColor::MAX)
 Pushes an RGB color on stack (shortcut) More...
 
void addGreyColor (ColorCompType g)
 Pushes a grey color on stack (shortcut) More...
 
bool convertRGBToGreyScale ()
 Converts RGB to grey scale colors. More...
 
bool colorize (float r, float g, float b, float a=1.0f)
 Multiplies all color components of all points by coefficients. More...
 
bool setRGBColorByHeight (unsigned char heightDim, ccColorScale::Shared colorScale)
 Assigns color to points proportionally to their 'height'. More...
 
bool setRGBColorByBanding (unsigned char dim, double freq)
 Assigns color to points by 'banding'. More...
 
bool convertCurrentScalarFieldToColors (bool mixWithExistingColor=false)
 Converts current scalar field (values & display parameters) to RGB colors. More...
 
bool setColor (ColorCompType r, ColorCompType g, ColorCompType b, ColorCompType a=ccColor::MAX)
 Set a unique color for the whole cloud (shortcut) More...
 
bool setColor (const ccColor::Rgb &col)
 Set a unique color for the whole cloud (RGB version) More...
 
bool setColor (const ccColor::Rgba &col)
 Set a unique color for the whole cloud (RGBA version) More...
 
void invertNormals ()
 Inverts normals (if any)
 
void translate (const CCVector3 &T)
 Translates cloud. More...
 
ccPointCloudfilterPointsByScalarValue (ScalarType minVal, ScalarType maxVal, bool outside=false)
 Filters out points whose scalar values falls into an interval. More...
 
void hidePointsByScalarValue (ScalarType minVal, ScalarType maxVal)
 Hides points whose scalar values falls into an interval. More...
 
ccPointCloudunroll (UnrollMode mode, UnrollBaseParams *params, bool exportDeviationSF=false, double startAngle_deg=0.0, double stopAngle_deg=360.0, CCCoreLib::GenericProgressCallback *progressCb=nullptr) const
 Unrolls the cloud and its normals on a cylinder or a cone. More...
 
void addColorRampInfo (CC_DRAW_CONTEXT &context)
 Adds associated SF color ramp info to current GL context.
 
int addScalarField (ccScalarField *sf)
 Adds an existing scalar field to this cloud. More...
 
RGBAColorsTableTypergbaColors () const
 Returns pointer on RGBA colors table.
 
NormsIndexesTableTypenormals () const
 Returns pointer on compressed normals indexes table.
 
CCCoreLib::ReferenceCloud * crop2D (const ccPolyline *poly, unsigned char orthoDim, bool inside=true)
 Crops the cloud inside (or outside) a 2D polyline. More...
 
const ccPointCloudappend (ccPointCloud *cloud, unsigned pointCountBefore, bool ignoreChildren=false)
 Appends a cloud to this one. More...
 
bool enhanceRGBWithIntensitySF (int sfIdx, bool useCustomIntensityRange=false, double minI=0.0, double maxI=1.0)
 Enhances the RGB colors with the current scalar field (assuming it's intensities)
 
bool exportCoordToSF (bool exportDims[3])
 Exports the specified coordinate dimension(s) to scalar field(s)
 
bool exportNormalToSF (bool exportDims[3])
 Exports the specified normal dimension(s) to scalar field(s)
 
void releaseVBOs ()
 Release VBOs.
 
size_t vboSize () const
 Returns the VBOs size (if any)
 
bool initLOD ()
 Initializes the LOD structure. More...
 
void clearLOD ()
 Clears the LOD structure.
 

Static Public Member Functions

static ccPointCloudFrom (const CCCoreLib::GenericIndexedCloud *cloud, const ccGenericPointCloud *sourceCloud=nullptr)
 Creates a new point cloud object from a GenericIndexedCloud. More...
 
static ccPointCloudFrom (CCCoreLib::GenericCloud *cloud, const ccGenericPointCloud *sourceCloud=nullptr)
 Creates a new point cloud object from a GenericCloud. More...
 

Protected Member Functions

void drawMeOnly (CC_DRAW_CONTEXT &context) override
 
void applyGLTransformation (const ccGLMatrix &trans) override
 
bool toFile_MeOnly (QFile &out) const override
 
bool fromFile_MeOnly (QFile &in, short dataVersion, int flags, LoadedIDMap &oldToNewIDMap) override
 
void notifyGeometryUpdate () override
 
void swapPoints (unsigned firstIndex, unsigned secondIndex) override
 
bool updateVBOs (const CC_DRAW_CONTEXT &context, const glDrawParams &glParams)
 Init/updates VBOs.
 
void glChunkVertexPointer (const CC_DRAW_CONTEXT &context, size_t chunkIndex, unsigned decimStep, bool useVBOs)
 
void glChunkColorPointer (const CC_DRAW_CONTEXT &context, size_t chunkIndex, unsigned decimStep, bool useVBOs)
 
void glChunkSFPointer (const CC_DRAW_CONTEXT &context, size_t chunkIndex, unsigned decimStep, bool useVBOs)
 
void glChunkNormalPointer (const CC_DRAW_CONTEXT &context, size_t chunkIndex, unsigned decimStep, bool useVBOs)
 

Protected Attributes

RGBAColorsTableTypem_rgbaColors
 Colors.
 
NormsIndexesTableTypem_normals
 Normals (compressed)
 
bool m_sfColorScaleDisplayed
 Specifies whether current scalar field color scale should be displayed or not.
 
ccScalarFieldm_currentDisplayedScalarField
 Currently displayed scalar field.
 
int m_currentDisplayedScalarFieldIndex
 Currently displayed scalar field index.
 
std::vector< Grid::Sharedm_grids
 Associated grid structure.
 
bool m_visibilityCheckEnabled
 Whether visibility check is available or not (during comparison) More...
 
vboSet m_vboManager
 Set of VBOs attached to this cloud.
 
ccPointCloudLODm_lod
 L.O.D. structure.
 
FWFDescriptorSet m_fwfDescriptors
 General waveform descriptors.
 
std::vector< ccWaveformm_fwfWaveforms
 Per-point waveform accessors.
 
SharedFWFDataContainer m_fwfData
 Waveforms raw data storage.
 

Detailed Description

A 3D cloud and its associated features (color, normals, scalar fields, etc.)

A point cloud can have multiple features:

Constructor & Destructor Documentation

◆ ccPointCloud()

ccPointCloud::ccPointCloud ( QString  name = QString(),
unsigned  uniqueID = ccUniqueIDGenerator::InvalidUniqueID 
)
throw (
)

Default constructor.

Creates an empty cloud without any feature. Each of them should be specifically instantiated/created (once the points have been added to this cloud, at least partially).

Parameters
namecloud name (optional)
uniqueIDunique ID (handle with care)

Member Function Documentation

◆ addColor() [1/3]

void ccPointCloud::addColor ( ColorCompType  r,
ColorCompType  g,
ColorCompType  b,
ColorCompType  a = ccColor::MAX 
)
inline

Pushes an RGB color on stack (shortcut)

Parameters
rred component
ggreen component
bblue component
aalpha component

◆ addColor() [2/3]

void ccPointCloud::addColor ( const ccColor::Rgb C)
inline

Pushes an RGB color on stack.

Will be converted to an RGBA color automatically.

Parameters
CRGB color

◆ addColor() [3/3]

void ccPointCloud::addColor ( const ccColor::Rgba C)

Pushes an RGBA color on stack.

Parameters
CRGBA color

◆ addGreyColor()

void ccPointCloud::addGreyColor ( ColorCompType  g)
inline

Pushes a grey color on stack (shortcut)

Shortcut: color is converted to RGB(g, g, g)

Parameters
ggrey component

◆ addNorm()

void ccPointCloud::addNorm ( const CCVector3 &  N)

Pushes a normal vector on stack (shortcut)

Parameters
Nnormal vector

◆ addNormAtIndex()

void ccPointCloud::addNormAtIndex ( const PointCoordinateType *  N,
unsigned  index 
)

Adds a normal vector to the one at a specific index.

The resulting sum is automatically normalized and compressed.

Parameters
Nnormal vector to add (size: 3)
indexnormal index to modify

◆ addNormIndex()

void ccPointCloud::addNormIndex ( CompressedNormType  index)

Pushes a compressed normal vector.

Parameters
indexcompressed normal vector

◆ addScalarField()

int ccPointCloud::addScalarField ( ccScalarField sf)

Adds an existing scalar field to this cloud.

Warning: the cloud takes ownership of it!

Parameters
sfexisting scalar field
Returns
index of added scalar field (or -1 if an error occurred)

◆ append()

const ccPointCloud & ccPointCloud::append ( ccPointCloud cloud,
unsigned  pointCountBefore,
bool  ignoreChildren = false 
)

Appends a cloud to this one.

Same as the += operator with pointCountBefore == size()

Parameters
cloudcloud to be added
pointCountBeforethe number of points previously contained in this cloud
ignoreChildrenwhether to copy input cloud's children or not
Returns
the resulting point cloud

◆ clear()

void ccPointCloud::clear ( )
override

Clears the entity from all its points and features.

Display parameters are also reset to their default values.

◆ cloneThis()

ccPointCloud * ccPointCloud::cloneThis ( ccPointCloud destCloud = nullptr,
bool  ignoreChildren = false 
)

Clones this entity.

All the main features of the entity are cloned, except from the octree and the points visibility information.

Parameters
destCloud[optional] the destination cloud can be provided here
ignoreChildren[optional] whether to ignore the cloud's children or not (in which case they will be cloned as well)
Returns
a copy of this entity

◆ colorize()

bool ccPointCloud::colorize ( float  r,
float  g,
float  b,
float  a = 1.0f 
)

Multiplies all color components of all points by coefficients.

If the cloud has no color, all points are considered white and the color array is automatically allocated.

Parameters
rred component
ggreen component
bblue component
aalpha component
Returns
success

◆ compressFWFData()

bool ccPointCloud::compressFWFData ( )

Compresses the associated FWF data container.

As the container is shared, the compressed version will be potentially added to the memory resulting in a decrease of the available memory...

◆ computeCPSet()

QSharedPointer< CCCoreLib::ReferenceCloud > ccPointCloud::computeCPSet ( ccGenericPointCloud otherCloud,
CCCoreLib::GenericProgressCallback *  progressCb = nullptr,
unsigned char  octreeLevel = 0 
)

Comptes the closest point of this cloud relatively to another cloud.

The output (reference) clouds will have as many points as this cloud (with the indexes pointing on the closest point in the other cloud)

◆ computeGravityCenter()

CCVector3 ccPointCloud::computeGravityCenter ( )

Returns the cloud gravity center.

Returns
gravity center

◆ computeNormalsWithGrids()

bool ccPointCloud::computeNormalsWithGrids ( double  minTriangleAngle_deg = 1.0,
ccProgressDialog pDlg = nullptr 
)

Compute the normals with the associated grid structure(s)

Can also orient the normals in the same run.

◆ convertCurrentScalarFieldToColors()

bool ccPointCloud::convertCurrentScalarFieldToColors ( bool  mixWithExistingColor = false)

Converts current scalar field (values & display parameters) to RGB colors.

Returns
success

◆ convertNormalToDipDirSFs()

bool ccPointCloud::convertNormalToDipDirSFs ( ccScalarField dipSF,
ccScalarField dipDirSF 
)

Converts normals to two scalar fields: 'dip' and 'dip direction'.

One input scalar field may be empty if the corresponding value is not required

Parameters
[out]dipSFdip values
[out]dipDirSFdip direction values
Returns
success

◆ convertNormalToRGB()

bool ccPointCloud::convertNormalToRGB ( )

Converts normals to RGB colors.

See ccNormalVectors::ConvertNormalToRGB

Returns
success

◆ convertRGBToGreyScale()

bool ccPointCloud::convertRGBToGreyScale ( )

Converts RGB to grey scale colors.

Returns
success

◆ createNewCloudFromVisibilitySelection()

ccGenericPointCloud * ccPointCloud::createNewCloudFromVisibilitySelection ( bool  removeSelectedPoints = false,
VisibilityTableType *  visTable = nullptr,
bool  silent = false 
)
override
Warning
if removeSelectedPoints is true, any attached octree will be deleted.

◆ crop2D()

CCCoreLib::ReferenceCloud * ccPointCloud::crop2D ( const ccPolyline poly,
unsigned char  orthoDim,
bool  inside = true 
)

Crops the cloud inside (or outside) a 2D polyline.

Warning
Always returns a selection (potentially empty) if successful.
Parameters
polycropping polyline
orthoDimdimension orthogonal to the plane in which the segmentation should occur (X=0, Y=1, Z=2)
insidewhether selected points are inside or outside the polyline
Returns
points falling inside (or outside) as a selection

◆ enableVisibilityCheck()

void ccPointCloud::enableVisibilityCheck ( bool  state)
inline

Sets whether visibility check is enabled or not (e.g. during distances computation)

See ccPointCloud::testVisibility.

◆ filterPointsByScalarValue()

ccPointCloud * ccPointCloud::filterPointsByScalarValue ( ScalarType  minVal,
ScalarType  maxVal,
bool  outside = false 
)

Filters out points whose scalar values falls into an interval.

Threshold values should be expressed relatively to the current displayed scalar field.

Parameters
minValminimum value
maxValmaximum value
outsidewhether to select the points inside or outside of the specified interval
Returns
resulting cloud (remaining points)

◆ From() [1/2]

ccPointCloud * ccPointCloud::From ( CCCoreLib::GenericCloud *  cloud,
const ccGenericPointCloud sourceCloud = nullptr 
)
static

Creates a new point cloud object from a GenericCloud.

"GenericCloud" is a very simple and light interface from CCCoreLib. It is meant to give access to points coordinates of any cloud (on the condition it implements the GenericCloud interface of course). See CClib documentation for more information about GenericClouds. As the GenericCloud interface is very simple, only points are imported. Note: throws an 'int' exception in case of error (see CTOR_ERRORS)

Parameters
clouda GenericCloud structure
sourceCloudcloud from which main parameters will be imported (optional)

◆ From() [2/2]

ccPointCloud * ccPointCloud::From ( const CCCoreLib::GenericIndexedCloud *  cloud,
const ccGenericPointCloud sourceCloud = nullptr 
)
static

Creates a new point cloud object from a GenericIndexedCloud.

"GenericIndexedCloud" is an extension of GenericCloud (from CCCoreLib) which provides a const random accessor to points. See CClib documentation for more information about GenericIndexedCloud. As the GenericIndexedCloud interface is very simple, only points are imported. Note: throws an 'int' exception in case of error (see CTOR_ERRORS)

Parameters
clouda GenericIndexedCloud structure
sourceCloudcloud from which main parameters will be imported (optional)

◆ hidePointsByScalarValue()

void ccPointCloud::hidePointsByScalarValue ( ScalarType  minVal,
ScalarType  maxVal 
)

Hides points whose scalar values falls into an interval.

Values are taken from the current OUTPUT scalar field.

Parameters
minValminimum value (below, points are hidden)
maxValmaximum value (above, points are hidden)

◆ initLOD()

bool ccPointCloud::initLOD ( )

Initializes the LOD structure.

Returns
success

◆ operator+=()

const ccPointCloud & ccPointCloud::operator+= ( ccPointCloud addedCloud)

Fuses another 3D entity with this one.

All the main features of the given entity are added, except from the octree and the points visibility information. Those features are deleted on this cloud.

◆ partialClone()

ccPointCloud * ccPointCloud::partialClone ( const CCCoreLib::ReferenceCloud *  selection,
int *  warnings = nullptr 
) const

Creates a new point cloud object from a ReferenceCloud (selection)

"Reference clouds" are a set of indexes referring to a real point cloud. See CClib documentation for more information about ReferenceClouds. Warning: the ReferenceCloud structure must refer to this cloud.

Parameters
selectiona ReferenceCloud structure (pointing to source)
[out]warnings[optional] to determine if warnings (CTOR_ERRORS) occurred during the duplication process

◆ reserve()

bool ccPointCloud::reserve ( unsigned  numberOfPoints)
override

Reserves memory for all the active features.

This method is meant to be called before increasing the cloud population. Only the already allocated features will be re-reserved.

Returns
true if ok, false if there's not enough memory

◆ reserveTheNormsTable()

bool ccPointCloud::reserveTheNormsTable ( )

Reserves memory to store the compressed normals.

Before adding normals to the cloud (with addNorm()) be sure to reserve the necessary amount of memory with this method. This method reserves memory for as many normals as the number of points in the cloud (effectively stored or reserved).

Returns
true if ok, false if there's not enough memory

◆ reserveThePointsTable()

bool ccPointCloud::reserveThePointsTable ( unsigned  _numberOfPoints)

Reserves memory to store the points coordinates.

Before adding points to the cloud (with addPoint()) be sure to reserve the necessary amount of memory with this method. If the number of new elements is smaller than the actual one, nothing will happen.

Parameters
_numberOfPointsnumber of points to reserve the memory for
Returns
true if ok, false if there's not enough memory

◆ reserveTheRGBTable()

bool ccPointCloud::reserveTheRGBTable ( )

Reserves memory to store the RGB colors.

Before adding colors to the cloud (with addColor()) be sure to reserve the necessary amount of memory with this method. This method reserves memory for as many colors as the number of points in the cloud (effectively stored or reserved).

Returns
true if ok, false if there's not enough memory

◆ resize()

bool ccPointCloud::resize ( unsigned  numberOfPoints)
override

Resizes all the active features arrays.

This method is meant to be called after having increased the cloud population (if the final number of inserted point is lower than the reserved size). Otherwise, it fills all new elements with blank values.

Returns
true if ok, false if there's not enough memory

◆ resizeTheNormsTable()

bool ccPointCloud::resizeTheNormsTable ( )

Resizes the compressed normals array.

If possible, the normals array is resized to fit exactly the number of points in the cloud (effectively stored or reserved). If the new size is inferior to the actual one, the last elements will be deleted. Otherwise, the array is filled with blank elements.

Warning
don't try to "add" any element on a resized array...
Returns
true if ok, false if there's not enough memory

◆ resizeTheRGBTable()

bool ccPointCloud::resizeTheRGBTable ( bool  fillWithWhite = false)

Resizes the RGB colors array.

If possible, the colors array is resized to fit exactly the number of points in the cloud (effectively stored or reserved). If the new size is inferior to the actual one, the last elements will be deleted. Otherwise, the array is filled with zeros (default behavior) or "white" colors (is fillWithWhite).

Warning
don't try to "add" any element on a resized array...
Parameters
fillWithWhitewhether to fill new array elements with zeros (false) or white color (true)
Returns
true if ok, false if there's not enough memory

◆ setColor() [1/3]

bool ccPointCloud::setColor ( ColorCompType  r,
ColorCompType  g,
ColorCompType  b,
ColorCompType  a = ccColor::MAX 
)
inline

Set a unique color for the whole cloud (shortcut)

Color array is automatically allocated if necessary.

Parameters
rred component
ggreen component
bblue component
aalpha component
Returns
success

◆ setColor() [2/3]

bool ccPointCloud::setColor ( const ccColor::Rgb col)
inline

Set a unique color for the whole cloud (RGB version)

Color array is automatically allocated if necessary.

Parameters
colRGB color
Returns
success

◆ setColor() [3/3]

bool ccPointCloud::setColor ( const ccColor::Rgba col)

Set a unique color for the whole cloud (RGBA version)

Color array is automatically allocated if necessary.

Parameters
colRGBA color
Returns
success

◆ setCurrentDisplayedScalarField()

void ccPointCloud::setCurrentDisplayedScalarField ( int  index)

Sets the currently displayed scalar field.

Warning: this scalar field will automatically be set as the OUTPUT one!

◆ setPointColor() [1/2]

void ccPointCloud::setPointColor ( unsigned  pointIndex,
const ccColor::Rgb col 
)
inline

Sets a particular point color.

Warning
colors must be enabled.

◆ setPointColor() [2/2]

void ccPointCloud::setPointColor ( unsigned  pointIndex,
const ccColor::Rgba col 
)

Sets a particular point color.

Warning
colors must be enabled.

◆ setPointNormal()

void ccPointCloud::setPointNormal ( unsigned  pointIndex,
const CCVector3 &  N 
)

Sets a particular point normal (shortcut)

Warning
normals must be enabled. Normal is automatically compressed before storage.

◆ setPointNormalIndex()

void ccPointCloud::setPointNormalIndex ( unsigned  pointIndex,
CompressedNormType  norm 
)

Sets a particular point compressed normal.

Warning
normals must be enabled.

◆ setRGBColorByBanding()

bool ccPointCloud::setRGBColorByBanding ( unsigned char  dim,
double  freq 
)

Assigns color to points by 'banding'.

Banding is performed along the specified dimension Color array is automatically allocated if necessary.

Parameters
dimbanding dimension (0:X, 1:Y, 2:Z)
freqbanding frequency
Returns
success

◆ setRGBColorByHeight()

bool ccPointCloud::setRGBColorByHeight ( unsigned char  heightDim,
ccColorScale::Shared  colorScale 
)

Assigns color to points proportionally to their 'height'.

Height is defined wrt to the specified dimension (heightDim). Color array is automatically allocated if necessary.

Parameters
heightDimramp dimension (0:X, 1:Y, 2:Z)
colorScalecolor scale to use
Returns
success

◆ swapPoints()

void ccPointCloud::swapPoints ( unsigned  firstIndex,
unsigned  secondIndex 
)
overrideprotected
Warning
Doesn't handle scan grids!

◆ translate()

void ccPointCloud::translate ( const CCVector3 &  T)

Translates cloud.

Parameters
Ttranslation vector

◆ triangulateGrid()

ccMesh * ccPointCloud::triangulateGrid ( const Grid grid,
double  minTriangleAngle_deg = 0.0 
) const

Meshes a scan grid.

Warning
The mesh vertices will be this cloud instance!

◆ unallocatePoints()

void ccPointCloud::unallocatePoints ( )

Erases the cloud points.

Prefer ccPointCloud::clear by default.

Warning
DANGEROUS

◆ unroll()

ccPointCloud * ccPointCloud::unroll ( UnrollMode  mode,
UnrollBaseParams params,
bool  exportDeviationSF = false,
double  startAngle_deg = 0.0,
double  stopAngle_deg = 360.0,
CCCoreLib::GenericProgressCallback *  progressCb = nullptr 
) const

Unrolls the cloud and its normals on a cylinder or a cone.

This method is redundant with the "developCloudOnCylinder" method of CCCoreLib, apart that it can also handle the cloud normals.

Parameters
modeunrolling mode
paramsunrolling parameters (must match the unrolling mode)
exportDeviationSFto export the deviation fro the ideal cone as a scalar field
startAngle_degstart angle (in degrees) - 0 corresponds to +X (east)
stopAngle_degstop angle (in degrees)
progressCbfor progress notification
Returns
the unrolled point cloud

Member Data Documentation

◆ m_visibilityCheckEnabled

bool ccPointCloud::m_visibilityCheckEnabled
protected

Whether visibility check is available or not (during comparison)

See ccPointCloud::testVisibility


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