Skip to content

Commit d1490a6

Browse files
committed
FIX: cloud2mesh distance
1 parent ad136a4 commit d1490a6

File tree

1 file changed

+3
-28
lines changed

1 file changed

+3
-28
lines changed

src/gh/diffCheck/diffCheck/df_error_estimation.py

Lines changed: 3 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,9 @@ def cloud_2_mesh_distance(source, target):
3939

4040
distances = np.ones(len(source.points), dtype=float)
4141

42+
for i in range(len(source.points)):
43+
distances[i] = point_2_mesh_distance(target, source.points[i])
44+
4245
return distances
4346

4447

@@ -80,34 +83,6 @@ def point_2_mesh_distance(geo, query_point):
8083

8184
return shortest_distance
8285

83-
# Find the distance to the adjacent faces
84-
if squared_distances:
85-
least_squared_distance = min(squared_distances)
86-
else:
87-
print("No neighbors found within the specified radius.")
88-
89-
90-
91-
# create a box centered around the query point with an edge length equal to two times the distance to the nearest vertex
92-
search_distance = dist * 2
93-
94-
search_box_min = query_point - search_distance
95-
search_box_max = query_point + search_distance
96-
97-
# query a kd tree for all the faces that intersect this box
98-
def face_in_box(face):
99-
v0, v1, v2 = face
100-
vertices = np.asarray(geo.vertices)
101-
return (np.all(vertices[v0] >= search_box_min) and np.all(vertices[v0] <= search_box_max) or
102-
np.all(vertices[v1] >= search_box_min) and np.all(vertices[v1] <= search_box_max) or
103-
np.all(vertices[v2] >= search_box_min) and np.all(vertices[v2] <= search_box_max))
104-
105-
candidate_faces = [face for face in np.asarray(geo.triangles) if face_in_box(face)]
106-
107-
108-
# compute the closest point for the faces that we get back
109-
pass
110-
11186

11287
def point_2_face_distance(face, point):
11388
"""

0 commit comments

Comments
 (0)