Skip to content

Commit e9f3037

Browse files
committed
fix: min distance nearest points fix, add to tests
1 parent 8ba0882 commit e9f3037

File tree

3 files changed

+234
-84
lines changed

3 files changed

+234
-84
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -362,4 +362,4 @@ for coll_pair in objs_in_collision:
362362
```
363363
>>> Object obj1 in collision with object obj2!
364364
```
365-
For more examples, see `example/example.py`.
365+
For more examples, see `examples/example.py`.

src/fcl/fcl.pyx

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -684,13 +684,14 @@ def distance(CollisionObject o1, CollisionObject o2,
684684
),
685685
cresult)
686686

687-
result.min_distance = min(cresult.min_distance, result.min_distance)
688-
result.nearest_points = [vec3d_to_numpy(cresult.nearest_points[0]),
689-
vec3d_to_numpy(cresult.nearest_points[1])]
690-
result.o1 = c_to_python_collision_geometry(cresult.o1, o1, o2)
691-
result.o2 = c_to_python_collision_geometry(cresult.o2, o1, o2)
692-
result.b1 = cresult.b1
693-
result.b2 = cresult.b2
687+
if result.min_distance > cresult.min_distance:
688+
result.min_distance = cresult.min_distance
689+
result.nearest_points = [vec3d_to_numpy(cresult.nearest_points[0]),
690+
vec3d_to_numpy(cresult.nearest_points[1])]
691+
result.o1 = c_to_python_collision_geometry(cresult.o1, o1, o2)
692+
result.o2 = c_to_python_collision_geometry(cresult.o2, o1, o2)
693+
result.b1 = cresult.b1
694+
result.b2 = cresult.b2
694695
return dis
695696

696697
###############################################################################

0 commit comments

Comments
 (0)