mosaic.operations.cluster#

cluster(geometry, method, drop_noise=False, use_points=True, use_normals=False, **kwargs)[source]#

Partitions points into clusters using the specified clustering algorithm.

Parameters:
geometrymosaic.geometry.Geometry

Input data.

methodstr

Clustering method to use. Options are: - ‘DBSCAN’ : Density-based clustering - ‘Birch’ : Balanced iterative reducing clustering hierarchy - ‘K-Means’ : K-means clustering - ‘Connected Components’ : Connected component analysis - ‘Envelope’ : Envelope-based clustering - ‘Leiden’ : Leiden community detection

drop_noisebool, optional

If True, drop noise points (label -1) from results. Default is False.

use_pointsbool, optional

If True, use point coordinates for clustering. Default is True.

use_normalsbool, optional

If True, include normal vectors in clustering features. Default is False.

**kwargs

Additional arguments passed to the chosen clustering method.

Returns:
List[mosaic.geometry.Geometry]

List of geometries, one per cluster.

Raises:
ValueError

If unsupported clustering method is specified or too many clusters found.