Skip to content

Commit a460527

Browse files
committed
WIP-ADD cloud to cloud distance component
1 parent 78584cb commit a460527

File tree

2 files changed

+12
-9
lines changed

2 files changed

+12
-9
lines changed

src/gh/components/DF_cloud_to_cloud_distance/code.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313
import diffCheck
1414
from diffCheck import diffcheck_bindings
1515
from diffCheck import df_cvt_bindings
16+
from diffCheck import df_error_estimation
17+
1618
import diffCheck.df_util
1719

1820
class CloudToMeshDistance(component):
@@ -28,6 +30,9 @@ def RunScript(self,
2830
:param i_cloud_target: target point cloud to align to
2931
3032
:return o_distances : list of calculated distances for each point
33+
:return o_mse: the average squared difference between corresponding points of source and target
34+
:return o_max_deviation: the max deviation between source and target (Hausdorff Distance)
35+
:return o_min_deviation: the min deviation between source and target
3136
"""
3237
if i_cloud_source is None or i_cloud_target is None:
3338
ghenv.Component.AddRuntimeMessage(RML.Warning, "Please provide both objects of type point clouds to compare")
@@ -38,9 +43,12 @@ def RunScript(self,
3843
df_cloud_target = df_cvt_bindings.cvt_rhcloud_2_dfcloud(i_cloud_target)
3944

4045
# calculate distances
41-
o_distances = cloud_2_mesh_distance(df_cloud_source, df_cloud_target)
46+
o_distances = df_error_estimation.cloud_2_cloud_distance(df_cloud_source, df_cloud_target)
47+
o_mse = df_error_estimation.compute_mse(df_cloud_source, df_cloud_target)
48+
o_max_deviation = df_error_estimation.compute_max_deviation(df_cloud_source, df_cloud_target)
49+
o_min_deviation = df_error_estimation.compute_min_deviation(df_cloud_source, df_cloud_target)
4250

43-
return o_distances
51+
return o_distances, o_mse, o_max_deviation, o_min_deviation
4452

4553

4654
if __name__ == "__main__":

src/gh/diffCheck/diffCheck/df_error_estimation.py

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@
44
Rhino, the basic diffCheck data structures and the diffCheck bindings.
55
"""
66

7-
import Rhino
8-
import Rhino.Geometry as rg
97
import numpy as np
108
from diffCheck import diffcheck_bindings
119

@@ -35,23 +33,20 @@ def compute_max_deviation(source, target):
3533

3634
return max_deviation
3735

38-
39-
4036
def compute_min_deviation(source, target):
4137
"""
4238
Calculate min deviation of distances
4339
"""
4440

45-
max_deviation = np.min(cloud_2_cloud_distance(source, target))
41+
min_deviation = np.min(cloud_2_cloud_distance(source, target))
4642

4743
return min_deviation
4844

49-
5045
def compute_standard_deviation(source, target):
5146
"""
5247
Calculate standard deviation of distances
5348
"""
5449

55-
std_deviation = np.std(cloud_2_cloud_distance(source, target))
50+
standard_deviation = np.std(cloud_2_cloud_distance(source, target))
5651

5752
return standard_deviation

0 commit comments

Comments
 (0)