2. Points Clouds
2.1. ccPointCloud
All the inherited members are given here for convenience. Most of the time, this class is used rather than the bases classes.
- class cloudComPy.ccPointCloud
Bases:
PointCloudTpl_ccGenericPointCloud_QString
A 3D cloud and its associated features ( normals, scalar fields, etc.)
A point cloud can have multiple features:
normals (compressed) (TODO)
scalar fields
an octree structure
other children objects (meshes, calibrated pictures, etc.) (TODO)
- addChild(self: _cloudComPy.ccHObject, child: _cloudComPy.ccHObject, dependencyFlags: int = <DEPENDENCY_FLAGS.DP_NONE: 0>, insertIndex: int = -1) bool
Adds a child.
warning the C++ default for DEPENDENCY_FLAGS (DP_PARENT_OF_OTHER) is replaced by DP_NONE in Python: The other values may induce a delete of the original child object in C++, not handled correctly on the Python side.
- Parameters
child (ccHObject) – child instance to append to the child list
dependencyFlags (DEPENDENCY_FLAGS,optional) – dependency flags, default DP_NONE
insertIndex (int,optional) – insertion index, default -1: if <0, child is simply appended to the children list.
- Returns
success
- Return type
bool
- addPoint(self: _cloudComPy.PointCloudTpl_ccGenericPointCloud_QString, arg0: Vector3Tpl<T>) None
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.
- Parameters
P (tuple) – a 3D point
- addScalarField(self: _cloudComPy.ccPointCloud, arg0: str) int
Creates a new scalar field and registers it.
Warnings:
the name must be unique (the method will fail if a SF with the same name already exists)
this method DOES resize the scalar field to match the current cloud size
- Parameters
uniqueName (str) – scalar field name (must be unique)
- Returns
index of this new scalar field (or -1 if an error occurred)
- Return type
int
- applyRigidTransformation(*args, **kwargs)
Overloaded function.
applyRigidTransformation(self: _cloudComPy.ccPointCloud, arg0: ccGLMatrix) -> None
Applies a GL transformation to the entity:
this = rotMat*(this-rotCenter)+(rotCenter+trans)
- Parameters
trans (ccGLMatrix) – a ccGLMatrix structure
applyRigidTransformation(self: _cloudComPy.ccPointCloud, arg0: ccGLMatrixTpl<float>) -> None
Applies a GL transformation to the entity:
this = rotMat*(this-rotCenter)+(rotCenter+trans)
- Parameters
trans (ccGLMatrix) – a ccGLMatrix structure
- changeColorLevels(self: _cloudComPy.ccPointCloud, arg0: int, arg1: int, arg2: int, arg3: int, arg4: bool, arg5: bool, arg6: bool) bool
Linear transformation of color components levels between boundaries: the input levels are defined by a lower and an upper bound, and similarly at the output. The transformation can be applied on one or more color component (red, green, blue)
- Parameters
in0 (int) – input lower bound in range [0..255]
in1 (int) – input upper bound in range [0..255]
out0 (int) – output lower bound in range [0..255]
out1 (int) – output upper bound in range [0..255]
onRed (bool) – whether to apply the transformation on the red component
onGreen (bool) – whether to apply the transformation on the green component
onBlue (bool) – whether to apply the transformation on the blue component
- Returns
success
- Return type
bool
- cloneThis(self: _cloudComPy.ccPointCloud, destCloud: _cloudComPy.ccPointCloud = None, ignoreChildren: bool = False) _cloudComPy.ccPointCloud
Clones this entity.
All the main features of the entity are cloned, except from the octree and the points visibility information.
- Parameters
destCloud (ccPointCloud,optional) – the destination cloud can be provided here
ignoreChildren (bool,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
- Return type
- colorize(self: _cloudComPy.ccPointCloud, r: float, g: float, b: float, a: float = 1.0) bool
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
r (float) – red component (normalized value in [0., 1.])
g (float) – green component (normalized value in [0., 1.])
b (float) – blue component (normalized value in [0., 1.])
a (float,optional) – alpha component default 1.0, (normalized value in [0., 1.])
- Returns
success
- Return type
bool
- colorsFromNPArray_copy(self: _cloudComPy.ccPointCloud, arg0: numpy.ndarray[numpy.uint8]) None
Set cloud color from a Numpy array (nbPoints,4).
Each row is (r,g,b,alpha) of type uint8 (unsigned char). Color memory is reserved automatically in the cloud.
- Parameters
array (ndarray) – a Numpy array (nbPoints,4).
- colorsShown(self: _cloudComPy.ccHObject) bool
Returns True if the colors are shown, False otherwise. It is used to prepare the state of the entity when it is saved in a .bin format, for reopening in the GUI in a predefined state (colors, normal, scalarFields).
- Returns
whether the colors are shown.
- Return type
bool
- colorsToNpArray(self: _cloudComPy.ccPointCloud) numpy.ndarray
Wrap the PointCloud colors into a numpy Array, without copy.
Returns a numpy Array of shape (number of Points, 4) (r, g ,b, a). Data type np.uint8. Data is not copied, the numpy Array object does not own the data.
WARNING No automatic action on the Python side on the variables referencing the C++ object in case of destruction!
- Returns
numpy Array of shape (number of Points, 4) dtype uint8
- Return type
ndarray
- colorsToNpArrayCopy(self: _cloudComPy.ccPointCloud) numpy.ndarray
Wrap the PointCloud colors into a numpy Array, with copy.
Returns a numpy Array of shape (number of Points, 4) (r, g ,b, a). Data type np.uint8. Data is copied, the numpy Array object owns its data. Ownership is transfered to Python: the numpy Array object and its data will be handled by the Python Garbage Collector
- Returns
numpy Array of shape (number of Points, 4) dtype uint8
- Return type
ndarray
- computeGravityCenter(self: _cloudComPy.ccPointCloud) Vector3Tpl<T>
Return a tuple of the 3 coordinates of the gravity center of the cloud.
- Returns
gravity center coordinates
- Return type
tuple of float
- computeOctree(self: _cloudComPy.ccGenericPointCloud, progressCb: CCCoreLib::GenericProgressCallback = None, autoAddChild: bool = True) CCCoreLib::DgmOctree
Computes the cloud octree.
The octree bounding-box is automatically defined as the smallest 3D cube that totally encloses the cloud.
WARNING: any previously attached octree will be deleted, even if the new octree computation failed.
- Parameters
progressCb,optional – (default None), use None
autoAddChild (bool,optional) – (default True) whether to automatically add the computed octree as child of this cloud or not
- Returns
the computed octree
- Return type
ccOctree
- computeScalarFieldGradient(self: _cloudComPy.ccPointCloud, SFindex: int, radius: float, euclideanDistances: bool, theOctree: _cloudComPy.DgmOctree = None) bool
Computes the geometrical gradient of a scalar field associated to a point cloud.
The gradient is a new scalar field. See Daniel Girardeau-Montaut’s PhD manuscript (Chapter 3, section 3.3.2) for more information. As explained in this section, if the scalar field corresponds to (euclidean) distances between the points and another entity, then it is possible to filter out aberrant values.
- Parameters
SFindex (int) – The scalar Field index in the Point Cloud.
radius (double) – spherical neighborhood size (or 0 for automatic size)
euclideanDistances (bool) – indicates if the scalar values are euclidean distances
theOctree (DgmOctree,optional) – the octree, if it has already been computed
- Returns
success
- Return type
bool
- convertCurrentScalarFieldToColors(self: _cloudComPy.ccPointCloud, mixWithExistingColor: bool = False) bool
Converts current scalar field to RGB colors.
Requires a current “displayed” scalar field: see
setCurrentDisplayedScalarField()
.- Parameters
mixWithExistingColor (bool,optional) – whether to mix with an existing color, default False
- Returns
success
- Return type
bool
- convertNormalToDipDirSFs(self: _cloudComPy.ccPointCloud) bool
Converts normals to two scalar fields: ‘dip’ and ‘dip direction’.
See Strike and dip. Angles are in degrees.
- Returns
success
- Return type
bool
- convertNormalToRGB(self: _cloudComPy.ccPointCloud) bool
Converts normals to color.
- Returns
success
- Return type
bool
- convertRGBToGreyScale(self: _cloudComPy.ccPointCloud) bool
Converts RGB to grey scale colors.
- Returns
success
- Return type
bool
- coordsFromNPArray_copy(self: _cloudComPy.ccPointCloud, arg0: numpy.ndarray[numpy.float32]) None
Set cloud coordinates from a Numpy array (nbPoints,3).
WARNING Be sure to have an array data in C-style contiguous order, for instance, a transpose operation do not reorder the data in memory. Check the boolean
array.flags['C_CONTIGUOUS']
and, ifFalse
, reorder witharray.copy(order='C')
.Cloud memory is reserved /resized automatically
- Parameters
array (ndarray) – a Numpy array (nbPoints,3).
- countRef(self: object) int
Get the value of the Python reference counter. Do not use, for debug and tests only.
- crop2D(self: _cloudComPy.ccPointCloud, arg0: _cloudComPy.ccPolyline, arg1: int, arg2: bool) _cloudComPy.ccPointCloud
Crop the point cloud using a 2D polyline.
- Parameters
poly (ccPolyline) – polyline object
orthoDim (int) – normal plane, value in (0, 1, 2) 0 = oY, 1 = oX, 2 = oZ
inside (bool) – boolean
- Returns
the cropped cloud. Points are copied, the original cloud is not modified.
- Return type
- decRef(self: handle) None
Decrement the Python reference counter. Do not use, for debug and tests only.
- deleteAllScalarFields(self: _cloudComPy.ccPointCloud) None
Deletes all scalar fields associated to this cloud
- deleteOctree(self: _cloudComPy.ccGenericPointCloud) None
Erases the octree
- deleteScalarField(self: _cloudComPy.ccPointCloud, arg0: int) None
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).
- Parameters
index (int) – index of scalar field to be deleted
- enhanceRGBWithIntensitySF(self: _cloudComPy.ccPointCloud, sfIdx: int, useCustomIntensityRange: bool = False, minI: float = 0.0, maxI: float = 1.0) bool
Enhances the RGB colors with a scalar field (assuming it’s intensities)
- Parameters
sfIdx (int) – scalarField index
useCustomIntensityRange (bool,optional) – whether to set a custom range for intensity, default False
minI (float,optional) – min value for the custom range, default 0.
maxI (float,optional) – max value for the custom range, default 1.
- Returns
status
- Return type
bool
- exportCoordToSF(self: _cloudComPy.ccPointCloud, arg0: bool, arg1: bool, arg2: bool) bool
Export coordinates to ScalarFields.
- Parameters
isXexported (bool) – export X coordinates
isYexported (bool) – export Y coordinates
isZexported (bool) – export Z coordinates
- Returns
status
- Return type
bool
- exportNormalToSF(self: _cloudComPy.ccPointCloud, arg0: bool, arg1: bool, arg2: bool) bool
Export normals to ScalarFields.
- Parameters
isXexported (bool) – export X normals coordinate
isYexported (bool) – export Y normals coordinate
isZexported (bool) – export Z normals coordinate
- Returns
status
- Return type
bool
- filterPointsByScalarValue(self: _cloudComPy.ccPointCloud, minVal: float, maxVal: float, outside: bool = False) _cloudComPy.ccPointCloud
Filters out points whose scalar values falls into an interval.
Threshold values should be expressed relatively to the current displayed scalar field. See
setCurrentDisplayedScalarField()
method.- Parameters
minVal (float) – minimum value
maxVal (float) – maximum value
outside (bool,optional) – default False, whether to select the points inside or outside of the specified interval
- Returns
resulting cloud (remaining points)
- Return type
- fuse(self: _cloudComPy.ccPointCloud, arg0: _cloudComPy.ccPointCloud) None
Append in place another cloud.
No return.
- Parameters
other (ccPointCloud) – cloud to fuse with this one, modification in place.
- getChild(self: _cloudComPy.ccHObject, arg0: int) _cloudComPy.ccHObject
Get child by index.
- Parameters
index (int) – index of child, see
getChildrenNumber()
.- Returns
child object
- Return type
- getChildCountRecursive(self: _cloudComPy.ccHObject) int
Get the number of children of this object, recursively.
- Returns
number of children, recursively
- Return type
int
- getChildrenNumber(self: _cloudComPy.ccHObject) int
Get the number of direct children of this object.
- Returns
number of direct children
- Return type
int
- getClassID(self: _cloudComPy.ccHObject) int
Get the type of this object.
- Returns
type
- Return type
CC_TYPE
- getCurrentDisplayedScalarField(self: _cloudComPy.ccPointCloud) _cloudComPy.ccScalarField
Returns the currently displayed scalar (or None if none)
Current displayed scalar field is used in some methods such as
filterPointsByScalarValue()
- Returns
currently displayed scalar field
- Return type
ScalarField or None
- getCurrentDisplayedScalarFieldIndex(self: _cloudComPy.ccPointCloud) int
Returns the currently displayed scalar field index (or -1 if none)
Current displayed scalar field is used in some methods such as
filterPointsByScalarValue()
- Returns
currently displayed scalar field index
- Return type
int
- getCurrentInScalarField(self: _cloudComPy.ccPointCloud) _cloudComPy.ScalarField
Return the current ‘in’ ScalarField if there is one, otherwise None.
- Returns
current ‘in’ ScalarField
- Return type
ScalarField or None
- getCurrentOutScalarField(self: _cloudComPy.ccPointCloud) _cloudComPy.ScalarField
Return the current ‘out’ ScalarField if there is one, otherwise None.
- Returns
current ‘out’ ScalarField
- Return type
ScalarField or None
- getGlobalScale(self: _cloudComPy.ccShiftedObject) float
Returns the scale applied to original coordinates.
- Returns
the scale applied to original coordinates.
- Return type
double
- getGlobalShift(self: _cloudComPy.ccShiftedObject) Vector3Tpl<T>
Returns the shift applied to original coordinates.
Original coordinates are equal to ‘(P/scale - shift)’ The shift is typically used when saving to a file.
- Returns
applied shift (x, y, z)
- Return type
tuple
- getName(self: _cloudComPy.ccHObject) QString
Get the name of the entity
- Returns
entity name
- Return type
str
- getNumberOfScalarFields(self: _cloudComPy.ccPointCloud) int
Return the number of scalar fields associated to the cloud.
- Returns
number of scalar fields
- Return type
int
- getOctree(self: _cloudComPy.ccGenericPointCloud) CCCoreLib::DgmOctree
Returns the associated octree (if any).
- Returns
octree
- Return type
ccOctree or None
- getOwnBB(self: _cloudComPy.ccGenericPointCloud) _cloudComPy.ccBBox
Returns the bounding box object.
- Returns
bounding box
- Return type
- getParent(self: _cloudComPy.ccHObject) _cloudComPy.ccHObject
Get the parent of this object.
- Returns
parent object
- Return type
- getPoint(self: _cloudComPy.PointCloudTpl_ccGenericPointCloud_QString, arg0: int) Vector3Tpl<T>
get the ith point in the cloud array.
- Returns
point coordinates
- Return type
tuple
- getScalarField(*args, **kwargs)
Overloaded function.
getScalarField(self: _cloudComPy.ccPointCloud, arg0: int) -> _cloudComPy.ScalarField
Find by index: return a ScalarField if index is valid, otherwise None.
- Parameters
index (int) – index of the ScalarField
- Returns
the ScalarField at index
- Return type
ScalarField or None
getScalarField(self: _cloudComPy.ccPointCloud, arg0: QString) -> _cloudComPy.ScalarField
Find by name: return a ScalarField if there is one with this name, otherwise None.
- Parameters
name (str) – name of the ScalarField
- Returns
ScalarField
- Return type
ScalarField or None
- getScalarFieldDic(self: _cloudComPy.ccPointCloud) Dict[QString, int]
Return a dictionary [ScalarField name] –> ScalarField index.
- Returns
a dictionary [name]->index
- Return type
dic
- getScalarFieldName(self: _cloudComPy.ccPointCloud, arg0: int) str
Return the ScalarField name if index is valid, otherwise None.
- Parameters
index (int) – index of the ScalarField
- Returns
ScalarField name at index
- Return type
str or None
- getSensors(self: _cloudComPy.ccPointCloud) List[ccSensor]
Returns a list of sensors if any, otherwise empty list.
- Returns
list of
ccSensor
- Return type
list
- hasColors(self: _cloudComPy.ccPointCloud) bool
Return whether the cloud has Colors.
- Returns
True or False
- Return type
bool
- hasNormals(self: _cloudComPy.ccPointCloud) bool
Return whether the cloud has Normals.
- Returns
True or False
- Return type
bool
- hasScalarFields(self: _cloudComPy.ccPointCloud) bool
Return whether the cloud has ScalarFields.
- Returns
True or False
- Return type
bool
- incRef(self: handle) None
Increment the Python reference counter. Do not use, for debug and tests only.
- interpolateColorsFrom(self: _cloudComPy.ccPointCloud, otherCloud: _cloudComPy.ccGenericPointCloud, octreeLevel: int = 0) bool
Interpolate colors from another cloud (nearest neighbor only).
- Parameters
other (ccGenericPointCloud) – source cloud with color
octreeLevel (int,optional) – octreeLevel, default 0
- Returns
success
- Return type
bool
- isA(self: _cloudComPy.ccHObject, arg0: int) bool
Check the type of object.
- Parameters
type (CC_TYPES) – type to check
- Returns
OK if object is of this type
- Return type
bool
- isKindOf(self: _cloudComPy.ccHObject, arg0: int) bool
Check the type of object.
- Parameters
type (CC_TYPES) – type to check
- Returns
OK if object is a kind of this type
- Return type
bool
- isShifted(self: _cloudComPy.ccShiftedObject) bool
Returns whether the cloud is shifted or not
- Returns
whether the cloud is shifted or not
- Return type
bool
- normalsShown(self: _cloudComPy.ccHObject) bool
Returns True if the normals are shown, False otherwise. It is used to prepare the state of the entity when it is saved in a .bin format, for reopening in the GUI in a predefined state (colors, normal, scalarFields).
- Returns
whether the normals are shown
- Return type
bool
- orientNormalsWithFM(self: _cloudComPy.ccPointCloud, octreeLevel: int = 6) bool
Orient normals with Fast Marching method.
See Fast marching method.
- Parameters
octreeLevel (int,optional) – octree level, default 6
- Returns
success
- Return type
bool
- orientNormalsWithMST(self: _cloudComPy.ccPointCloud, octreeLevel: int = 6) bool
Orient normals with Minimum Spanning Tree method.
- Parameters
octreeLevel (int,optional) – octree level, default 6
- Returns
success
- Return type
bool
- partialClone(self: _cloudComPy.ccPointCloud, arg0: _cloudComPy.ReferenceCloud) tuple
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
selection (ReferenceCloud) – a ReferenceCloud structure (pointing to source)
- Returns
a tuple(
ccPointCloud
,CLONE_WARNINGS
) warning status, if not 0, indicate out of memory errors (seeCLONE_WARNINGS
)- Return type
tuple
- renameScalarField(self: _cloudComPy.ccPointCloud, arg0: int, arg1: str) bool
Rename the ScalarField if index is valid.
Warning: the name should not be already used by other ScalarFields of the cloud! TODO: check the names in use.
- Parameters
index (int) – index of the ScalarField
name (str) – new name
- Returns
True in case of success
- Return type
bool
- reserve(self: _cloudComPy.ccPointCloud, arg0: int) bool
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.
- Parameters
nbPts (int) – number of points
- Returns
True if ok, False if there’s not enough memory
- Return type
bool
- resize(self: _cloudComPy.ccPointCloud, arg0: int) bool
Resizes all the active features arrays.
This method is meant to be called after having increased the cloud population (if the final number of insterted 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
- Return type
bool
- scale(self: _cloudComPy.ccPointCloud, fx: float, fy: float, fz: float, center: Vector3Tpl<T> = (0.0, 0.0, 0.0)) None
Scale the cloud with separate factors along the 3 directions x,y,z and an optional center (default: (0,0,0)).
- Parameters
fx (float) – scale x
fy (float) – scale y
fz (float) – scale z
center (tuple,optional) – (xc, yc, zc), default (0,0,0)
- setColor(self: _cloudComPy.ccPointCloud, arg0: _cloudComPy.QColor) bool
Set a unique color for the whole cloud (RGBA). Color array is automatically allocated if necessary.
- Parameters
color (QColor) – a unique color, alpha is taken into account.
- Returns
success
- Return type
bool
- setColorGradient(self: _cloudComPy.ccPointCloud, arg0: int, arg1: _cloudComPy.QColor, arg2: _cloudComPy.QColor) bool
Assigns color to points proportionally to their ‘height’.
Height is defined with regard to to the specified dimension (heightDim). Color array is defined by a two colors (QColor).
- setColorGradientBanded(self: _cloudComPy.ccPointCloud, arg0: int, arg1: float) bool
Assigns color to points by ‘banding’. Banding is performed along the specified dimension. Color array is automatically defined.
- Parameters
heightDim (int) – banding dimension (0:X, 1:Y, 2:Z)
freq (double) – banding frequency (size of the bands along the axis)
- Returns
success
- Return type
bool
- setColorGradientDefault(self: _cloudComPy.ccPointCloud, arg0: int) bool
Assigns color to points proportionally to their ‘height’.
Height is defined with regard to to the specified dimension (heightDim). Color array is defined by default.
- Parameters
heightDim (int) – ramp dimension (0:X, 1:Y, 2:Z)
- Returns
success
- Return type
bool
- setCurrentDisplayedScalarField(self: _cloudComPy.ccPointCloud, arg0: int) None
Sets the currently displayed scalar field.
Current displayed scalar field is used in some methods such as
filterPointsByScalarValue()
Warning: this scalar field will automatically be set as the OUTPUT one!
- Parameters
index (int) – index of the displayed ScalarField
- setCurrentInScalarField(self: _cloudComPy.ccPointCloud, arg0: int) None
Set the current ‘in’ ScalarField index. No validity check. Use -1 to set None.
- Parameters
index (int) – index of the ‘in’ ScalarField
- setCurrentOutScalarField(self: _cloudComPy.ccPointCloud, arg0: int) None
Set the current ‘out’ ScalarField index. No validity check. Use -1 to set None.
- Parameters
index (int) – index of the ‘out’ ScalarField
- setCurrentScalarField(self: _cloudComPy.ccPointCloud, arg0: int) None
Set the current ‘in’ and ‘out ScalarField index. No validity check. Use -1 to set None.
- Parameters
index (int) – index of the ‘in’ and ‘out’ ScalarField
- setGlobalScale(self: _cloudComPy.ccShiftedObject, arg0: float) None
Sets the scale applied to original coordinates (information storage only).
- Parameters
scale (double) – scale applied
- setGlobalShift(self: _cloudComPy.ccShiftedObject, arg0: float, arg1: float, arg2: float) None
Sets shift applied to original coordinates (information storage only)
Such a shift can typically be applied at loading time. Original coordinates are equal to ‘(P/scale - shift)’
- Parameters
x (double) – x shift
y (double) – y shift
z (double) – z shift
- setName(self: _cloudComPy.ccHObject, arg0: QString) None
Set the name of the entity
- Parameters
name (str) – entity name
- sfFromColor(self: _cloudComPy.ccPointCloud, arg0: bool, arg1: bool, arg2: bool, arg3: bool, arg4: bool) bool
Creates ScalarFields from color components.
- Parameters
exportR (bool) – whether to create a scalarField from red component
exportG (bool) – whether to create a scalarField from green component
exportB (bool) – whether to create a scalarField from blue component
exportAlpha (bool) – whether to create a scalarField from Alpha
exportComposite (bool) – whether to create a scalarField from (r+g+b)/3.
- Returns
success
- Return type
bool
- sfShown(self: _cloudComPy.ccHObject) bool
Returns True if the scalar fields are shown, False otherwise. It is used to prepare the state of the entity when it is saved in a .bin format, for reopening in the GUI in a predefined state (colors, normal, scalarFields).
- Returns
whether the scalar fields are shown
- Return type
bool
- showColors(self: _cloudComPy.ccHObject, arg0: bool) None
Prepare the state of the entity when it is saved in a .bin format, for reopening in the GUI in a predefined state (colors, normal, scalarFields).
- Parameters
isShown (bool) – whether to show or not the colors.
- showNormals(self: _cloudComPy.ccHObject, arg0: bool) None
Prepare the state of the entity when it is saved in a .bin format, for reopening in the GUI in a predefined state (colors, normal, scalarFields).
- Parameters
isShown (bool) – whether to show or not the normals.
- showSF(self: _cloudComPy.ccHObject, arg0: bool) None
Prepare the state of the entity when it is saved in a .bin format, for reopening in the GUI in a predefined state (colors, normal, scalarFields).
- Parameters
isShown (bool) – whether to show or not the ScalarFields.
- showSFColorsScale(self: _cloudComPy.ccPointCloud, arg0: bool) None
Display or not the Color Scale ramp when render to a file.
- Parameters
state (bool) – whether to display the Color Scale Ramp when render to a file
- shrinkToFit(self: _cloudComPy.ccPointCloud) None
Removes unused capacity
- size(self: _cloudComPy.ccPointCloud) int
Return the number of points in the cloud.
- Returns
number of points in the cloud
- Return type
int
- toNpArray(self: _cloudComPy.ccPointCloud) numpy.ndarray
Wrap the PointCloud coordinates into a numpy Array, without copy.
Returns a numpy Array of shape (number of Points, 3). Data is not copied, the numpy Array object does not own the data.
WARNING No automatic action on the Python side on the variables referencing the C++ object in case of destruction!
- Returns
numpy Array of shape (number of Points, 3)
- Return type
ndarray
- toNpArrayCopy(self: _cloudComPy.ccPointCloud) numpy.ndarray
Wrap the PointCloud coordinates into a numpy Array, with copy.
returns a numpy Array of shape (number of Points, 3) Data is copied, the numpy Array object owns its data. Ownership is transfered to Python: the numpy Array object and its data will be handled by the Python Garbage Collector
- Returns
numpy Array of shape (number of Points, 3)
- Return type
ndarray
- translate(self: _cloudComPy.ccPointCloud, arg0: Vector3Tpl<T>) None
translate the cloud of (x,y,z).
- Parameters
translation (tuple) – tuple: (x,y,z)
- unallocateColors(self: _cloudComPy.ccPointCloud) None
Erases the cloud colors.
- unallocateNorms(self: _cloudComPy.ccPointCloud) None
Erases the cloud normals.
2.2. bases classes for Points Clouds
The generic class ccHObject
is used when manipulating a list of points clouds and meshes,
for instance to save the list of objects on a file.
- class cloudComPy.PointCloudTpl_ccGenericPointCloud_QString
Bases:
ccGenericPointCloud
- addPoint(self: _cloudComPy.PointCloudTpl_ccGenericPointCloud_QString, arg0: Vector3Tpl<T>) None
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.
- Parameters
P (tuple) – a 3D point
- getPoint(self: _cloudComPy.PointCloudTpl_ccGenericPointCloud_QString, arg0: int) Vector3Tpl<T>
get the ith point in the cloud array.
- Returns
point coordinates
- Return type
tuple
- reserve(self: _cloudComPy.PointCloudTpl_ccGenericPointCloud_QString, arg0: int) bool
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.
- Parameters
newNumberOfPoints (int) – the new number of points
- Returns
true if the method succeeds, false otherwise
- Return type
bool
- resize(self: _cloudComPy.PointCloudTpl_ccGenericPointCloud_QString, arg0: int) bool
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
newNumberOfPoints (int) – the new number of points
- Returns
true if the method succeeds, false otherwise
- Return type
bool
- class cloudComPy.ccGenericPointCloud
Bases:
GenericIndexedCloudPersist
,ccShiftedObject
- computeOctree(self: _cloudComPy.ccGenericPointCloud, progressCb: CCCoreLib::GenericProgressCallback = None, autoAddChild: bool = True) CCCoreLib::DgmOctree
Computes the cloud octree.
The octree bounding-box is automatically defined as the smallest 3D cube that totally encloses the cloud.
WARNING: any previously attached octree will be deleted, even if the new octree computation failed.
- Parameters
progressCb,optional – (default None), use None
autoAddChild (bool,optional) – (default True) whether to automatically add the computed octree as child of this cloud or not
- Returns
the computed octree
- Return type
ccOctree
- deleteOctree(self: _cloudComPy.ccGenericPointCloud) None
Erases the octree
- getOctree(self: _cloudComPy.ccGenericPointCloud) CCCoreLib::DgmOctree
Returns the associated octree (if any).
- Returns
octree
- Return type
ccOctree or None
- getOwnBB(self: _cloudComPy.ccGenericPointCloud) _cloudComPy.ccBBox
Returns the bounding box object.
- Returns
bounding box
- Return type
- class cloudComPy.ReferenceCloud
Bases:
GenericIndexedCloudPersist
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.
Several methods provide a ReferenceCloud as a result, which can be seen as a selection on an original ccPointCloud (the associatedCloud). The ReferenceCloud can be transformed in a ccPointCloud, using the partialClone method of the associated ccPointCloud.
- addPointIndex(self: _cloudComPy.ReferenceCloud, arg0: int, arg1: int) bool
Point global index insertion mechanism (range), thread safe.
- Parameters
firstIndex (int) – first point global index of range
lastIndex (int) – last point global index of range (excluded)
- Returns
false if not enough memory
- Return type
bool
- addPointIndexGlobal(self: _cloudComPy.ReferenceCloud, arg0: int) bool
Point global index insertion mechanism, Thread safe.
- Parameters
globalIndex (int) – a point global index
- Returns
false if not enough memory
- Return type
bool
- enableScalarField(self: _cloudComPy.ReferenceCloud) bool
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.
Warning If the cloud is empty, the scalar field will be empty as well. The scalar field will be reserved with the same capacity as the cloud.
- Returns
success
- Return type
bool
- forwardIterator(self: _cloudComPy.ReferenceCloud) None
Forwards the local element iterator.
- getAssociatedCloud(self: _cloudComPy.ReferenceCloud) _cloudComPy.GenericIndexedCloudPersist
Returns the associated (source) cloud.
- Returns
the source cloud
- Return type
- getBoundingBox(self: _cloudComPy.ReferenceCloud) List[Vector3Tpl<T>]
Returns the octree bounding box.
Method to request the octree bounding box limits.
- Return limits
((Xmin,Ymin,Zmin), (Xmax,Ymax,Zmax))
- Return type
tuple
- getCurrentPointCoordinates(self: _cloudComPy.ReferenceCloud) Vector3Tpl<T>
Returns the coordinates of the point pointed by the current element.
- Returns
coordinates
- Return type
tuple
- getCurrentPointGlobalIndex(self: _cloudComPy.ReferenceCloud) int
Returns the global index of the point pointed by the current element.
- Returns
global index in the cloud
- Return type
int
- getCurrentPointScalarValue(self: _cloudComPy.ReferenceCloud) float
Returns the current point associated scalar value.
- Returns
scalar value
- Return type
float
- getNextPoint(self: _cloudComPy.ReferenceCloud) Vector3Tpl<T>
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:
the returned object may not be persistent!
THIS METHOD MAY NOT BE COMPATIBLE WITH PARALLEL STRATEGIES
(see the DgmOctree::executeFunctionForAllCellsAtLevel_MT and DgmOctree::executeFunctionForAllCellsAtStartingLevel_MT methods).
- Returns
coordinates of next point (TODO: what if no more?)
- Return type
tuple
- getPoint(self: _cloudComPy.ReferenceCloud, arg0: int) Vector3Tpl<T>
Returns the ith point.
Method to request a point with a specific index.
WARNINGS:
the returned object may not be persistent!
THIS METHOD MAY NOT BE COMPATIBLE WITH PARALLEL STRATEGIES
(see the DgmOctree::executeFunctionForAllCellsAtLevel_MT and DgmOctree::executeFunctionForAllCellsAtStartingLevel_MT methods). Consider the other version of getPoint instead or the GenericIndexedCloudPersist class.
- Parameters
index (int) – index of the requested point (between 0 and the cloud size minus 1)
- Returns
the requested point coordinates (undefined behavior if index is invalid)
- Return type
tuple
- getPointGlobalIndex(self: _cloudComPy.ReferenceCloud, arg0: int) int
Returns global index (i.e. relative to the associated cloud) of a given element.
- Parameters
localIndex (int) – local index (i.e. relative to the internal index container)
- Returns
global index
- Return type
int
- getPointScalarValue(self: _cloudComPy.ReferenceCloud, arg0: int) float
Returns the ith point associated scalar value.
- Parameters
index (int) – local index
- Returns
scalar value
- Return type
float
- isScalarFieldEnabled(self: _cloudComPy.ReferenceCloud) bool
Returns True if the scalar field is enabled, False otherwise
- Returns
is the ScalarField enabled?
- Return type
bool
- placeIteratorAtBeginning(self: _cloudComPy.ReferenceCloud) None
Sets the cloud iterator at the beginning.
Virtual method to handle the cloud global iterator
- setCurrentPointScalarValue(self: _cloudComPy.ReferenceCloud, arg0: float) None
Sets the current point associated scalar value.
- Parameters
value (float) – scalar value
- setPointScalarValue(self: _cloudComPy.ReferenceCloud, arg0: int, arg1: float) None
Sets the ith point associated scalar value.
- Parameters
index (int) – local index
value (float) – scalar value
- size(self: _cloudComPy.ReferenceCloud) int
Returns the number of points in the cloud
- Returns
number of points
- Return type
int
- class cloudComPy.GenericIndexedCloudPersist
Bases:
pybind11_object
- class cloudComPy.ccShiftedObject
Bases:
ccHObject
- getGlobalScale(self: _cloudComPy.ccShiftedObject) float
Returns the scale applied to original coordinates.
- Returns
the scale applied to original coordinates.
- Return type
double
- getGlobalShift(self: _cloudComPy.ccShiftedObject) Vector3Tpl<T>
Returns the shift applied to original coordinates.
Original coordinates are equal to ‘(P/scale - shift)’ The shift is typically used when saving to a file.
- Returns
applied shift (x, y, z)
- Return type
tuple
- isShifted(self: _cloudComPy.ccShiftedObject) bool
Returns whether the cloud is shifted or not
- Returns
whether the cloud is shifted or not
- Return type
bool
- setGlobalScale(self: _cloudComPy.ccShiftedObject, arg0: float) None
Sets the scale applied to original coordinates (information storage only).
- Parameters
scale (double) – scale applied
- setGlobalShift(self: _cloudComPy.ccShiftedObject, arg0: float, arg1: float, arg2: float) None
Sets shift applied to original coordinates (information storage only)
Such a shift can typically be applied at loading time. Original coordinates are equal to ‘(P/scale - shift)’
- Parameters
x (double) – x shift
y (double) – y shift
z (double) – z shift
- class cloudComPy.ccHObject
Bases:
pybind11_object
- addChild(self: _cloudComPy.ccHObject, child: _cloudComPy.ccHObject, dependencyFlags: int = <DEPENDENCY_FLAGS.DP_NONE: 0>, insertIndex: int = -1) bool
Adds a child.
warning the C++ default for DEPENDENCY_FLAGS (DP_PARENT_OF_OTHER) is replaced by DP_NONE in Python: The other values may induce a delete of the original child object in C++, not handled correctly on the Python side.
- Parameters
child (ccHObject) – child instance to append to the child list
dependencyFlags (DEPENDENCY_FLAGS,optional) – dependency flags, default DP_NONE
insertIndex (int,optional) – insertion index, default -1: if <0, child is simply appended to the children list.
- Returns
success
- Return type
bool
- colorsShown(self: _cloudComPy.ccHObject) bool
Returns True if the colors are shown, False otherwise. It is used to prepare the state of the entity when it is saved in a .bin format, for reopening in the GUI in a predefined state (colors, normal, scalarFields).
- Returns
whether the colors are shown.
- Return type
bool
- countRef(self: object) int
Get the value of the Python reference counter. Do not use, for debug and tests only.
- decRef(self: handle) None
Decrement the Python reference counter. Do not use, for debug and tests only.
- getChild(self: _cloudComPy.ccHObject, arg0: int) _cloudComPy.ccHObject
Get child by index.
- Parameters
index (int) – index of child, see
getChildrenNumber()
.- Returns
child object
- Return type
- getChildCountRecursive(self: _cloudComPy.ccHObject) int
Get the number of children of this object, recursively.
- Returns
number of children, recursively
- Return type
int
- getChildrenNumber(self: _cloudComPy.ccHObject) int
Get the number of direct children of this object.
- Returns
number of direct children
- Return type
int
- getClassID(self: _cloudComPy.ccHObject) int
Get the type of this object.
- Returns
type
- Return type
CC_TYPE
- getName(self: _cloudComPy.ccHObject) QString
Get the name of the entity
- Returns
entity name
- Return type
str
- getParent(self: _cloudComPy.ccHObject) _cloudComPy.ccHObject
Get the parent of this object.
- Returns
parent object
- Return type
- hasColors(self: _cloudComPy.ccHObject) bool
Returns True if the entity has colors, False otherwise.
- Returns
whether the entity has colors
- Return type
bool
- hasNormals(self: _cloudComPy.ccHObject) bool
Returns True if the entity has normals, False otherwise.
- Returns
whether the entity has normals
- Return type
bool
- hasScalarFields(self: _cloudComPy.ccHObject) bool
Returns True if the entity has ScalarFields, False otherwise.
- Returns
whether the entity has ScalarFields
- Return type
bool
- incRef(self: handle) None
Increment the Python reference counter. Do not use, for debug and tests only.
- isA(self: _cloudComPy.ccHObject, arg0: int) bool
Check the type of object.
- Parameters
type (CC_TYPES) – type to check
- Returns
OK if object is of this type
- Return type
bool
- isKindOf(self: _cloudComPy.ccHObject, arg0: int) bool
Check the type of object.
- Parameters
type (CC_TYPES) – type to check
- Returns
OK if object is a kind of this type
- Return type
bool
- normalsShown(self: _cloudComPy.ccHObject) bool
Returns True if the normals are shown, False otherwise. It is used to prepare the state of the entity when it is saved in a .bin format, for reopening in the GUI in a predefined state (colors, normal, scalarFields).
- Returns
whether the normals are shown
- Return type
bool
- setName(self: _cloudComPy.ccHObject, arg0: QString) None
Set the name of the entity
- Parameters
name (str) – entity name
- sfShown(self: _cloudComPy.ccHObject) bool
Returns True if the scalar fields are shown, False otherwise. It is used to prepare the state of the entity when it is saved in a .bin format, for reopening in the GUI in a predefined state (colors, normal, scalarFields).
- Returns
whether the scalar fields are shown
- Return type
bool
- showColors(self: _cloudComPy.ccHObject, arg0: bool) None
Prepare the state of the entity when it is saved in a .bin format, for reopening in the GUI in a predefined state (colors, normal, scalarFields).
- Parameters
isShown (bool) – whether to show or not the colors.
- showNormals(self: _cloudComPy.ccHObject, arg0: bool) None
Prepare the state of the entity when it is saved in a .bin format, for reopening in the GUI in a predefined state (colors, normal, scalarFields).
- Parameters
isShown (bool) – whether to show or not the normals.
- showSF(self: _cloudComPy.ccHObject, arg0: bool) None
Prepare the state of the entity when it is saved in a .bin format, for reopening in the GUI in a predefined state (colors, normal, scalarFields).
- Parameters
isShown (bool) – whether to show or not the ScalarFields.
- class cloudComPy.DEPENDENCY_FLAGS
Members:
DP_NONE
DP_NOTIFY_OTHER_ON_DELETE
DP_NOTIFY_OTHER_ON_UPDATE
DP_DELETE_OTHER
DP_PARENT_OF_OTHER
- DP_DELETE_OTHER = <DEPENDENCY_FLAGS.DP_DELETE_OTHER: 8>
- DP_NONE = <DEPENDENCY_FLAGS.DP_NONE: 0>
- DP_NOTIFY_OTHER_ON_DELETE = <DEPENDENCY_FLAGS.DP_NOTIFY_OTHER_ON_DELETE: 1>
- DP_NOTIFY_OTHER_ON_UPDATE = <DEPENDENCY_FLAGS.DP_NOTIFY_OTHER_ON_UPDATE: 2>
- DP_PARENT_OF_OTHER = <DEPENDENCY_FLAGS.DP_PARENT_OF_OTHER: 24>
- property name
- property value
- class cloudComPy.CLONE_WARNINGS
Members:
WRN_OUT_OF_MEM_FOR_COLORS
WRN_OUT_OF_MEM_FOR_NORMALS
WRN_OUT_OF_MEM_FOR_SFS
WRN_OUT_OF_MEM_FOR_FWF
- WRN_OUT_OF_MEM_FOR_COLORS = <CLONE_WARNINGS.WRN_OUT_OF_MEM_FOR_COLORS: 1>
- WRN_OUT_OF_MEM_FOR_FWF = <CLONE_WARNINGS.WRN_OUT_OF_MEM_FOR_FWF: 8>
- WRN_OUT_OF_MEM_FOR_NORMALS = <CLONE_WARNINGS.WRN_OUT_OF_MEM_FOR_NORMALS: 2>
- WRN_OUT_OF_MEM_FOR_SFS = <CLONE_WARNINGS.WRN_OUT_OF_MEM_FOR_SFS: 4>
- property name
- property value