Skip to content

Commit 78584cb

Browse files
committed
WIP-ADD helper functions for error_estimation
1 parent 5f18290 commit 78584cb

File tree

1 file changed

+57
-0
lines changed

1 file changed

+57
-0
lines changed
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
#! python3
2+
"""
3+
This module contains the utility functions to convert the data between the
4+
Rhino, the basic diffCheck data structures and the diffCheck bindings.
5+
"""
6+
7+
import Rhino
8+
import Rhino.Geometry as rg
9+
import numpy as np
10+
from diffCheck import diffcheck_bindings
11+
12+
def cloud_2_cloud_distance(source, target):
13+
14+
# Convert pts to np array and calculate distances
15+
distances = np.linalg.norm(np.asarray(source.points) - np.asarray(target.points), axis=1)
16+
17+
return distances
18+
19+
def compute_mse(source, target):
20+
"""
21+
Calculate mean squared distance
22+
"""
23+
24+
distances = cloud_2_cloud_distance(source, target)
25+
mse = np.sqrt(np.mean(distances ** 2))
26+
27+
return mse
28+
29+
def compute_max_deviation(source, target):
30+
"""
31+
Calculate max deviation of distances
32+
"""
33+
34+
max_deviation = np.max(cloud_2_cloud_distance(source, target))
35+
36+
return max_deviation
37+
38+
39+
40+
def compute_min_deviation(source, target):
41+
"""
42+
Calculate min deviation of distances
43+
"""
44+
45+
max_deviation = np.min(cloud_2_cloud_distance(source, target))
46+
47+
return min_deviation
48+
49+
50+
def compute_standard_deviation(source, target):
51+
"""
52+
Calculate standard deviation of distances
53+
"""
54+
55+
std_deviation = np.std(cloud_2_cloud_distance(source, target))
56+
57+
return standard_deviation

0 commit comments

Comments
 (0)