DFCloudNormalEstimator component

Contents

_images/icon4.png

DFCloudNormalEstimator component#

Evaluate the normals of a point cloud.

Inputs:

i_cloud (pointcloud ,item)

The point cloud to evaluate.

i_knn (int ,item)

The knn search value (by default 100).

i_radius (int ,item)

The radius search. If value is provided the search will be hybrid.

i_switch_mode (bool ,item)

Switch between Open3d (true) or Cilantro (false) library. Default is Open3d.

Outputs:

o_cloud

The cloud with normals computed.

Code:

#! python3

import Rhino
from ghpythonlib.componentbase import executingcomponent as component

from diffCheck import df_cvt_bindings

class DFCloudNormalEstimator(component):
    def RunScript(self,
            i_cloud: Rhino.Geometry.PointCloud,
            i_knn: int,
            i_radius: int,
            i_switch_mode: bool):
        o_cloud = Rhino.Geometry.PointCloud()

        if i_cloud is None:
            return None

        df_cloud = df_cvt_bindings.cvt_rhcloud_2_dfcloud(i_cloud)

        if i_knn is None:
            i_knn = 100

        if i_switch_mode is None:
            i_switch_mode = False

        df_cloud.estimate_normals(
            use_cilantro_evaluator=i_switch_mode,
            knn=i_knn,
            search_radius=i_radius
            )

        o_cloud = df_cvt_bindings.cvt_dfcloud_2_rhcloud(df_cloud)

        return o_cloud