DFCloudUniformDownsample component

Contents

_images/icon8.png

DFCloudUniformDownsample component#

Downsample a point cloud using in a uniform way by selecting every k points to delete.

Inputs:

i_cloud (pointcloud ,item)

The point cloud to reduce the size.

i_every_k_points (int ,item)

Every k value points will be deleted.

Outputs:

o_cloud

The downsampled cloud.

Code:

#! python3


import Rhino
from ghpythonlib.componentbase import executingcomponent as component


from diffCheck import df_cvt_bindings

class DFCloudUniformDownsample(component):
    def RunScript(self,
        i_cloud: Rhino.Geometry.PointCloud,
        i_every_k_points: int) -> Rhino.Geometry.PointCloud:
        if i_cloud is None or i_every_k_points is None:
            return None
        df_cloud = df_cvt_bindings.cvt_rhcloud_2_dfcloud(i_cloud)
        df_cloud.uniform_downsample(i_every_k_points)
        o_cloud = df_cvt_bindings.cvt_dfcloud_2_rhcloud(df_cloud)

        return [o_cloud]