What is the correct way to get the distance between and the corresponding closest points? #405
-
Hi, I just started to look into this library, and I noticed that when computing the distance between two objects import hppfcl
import numpy as np
box = hppfcl.Box(np.array([1.0, 1.0, 1.0]))
capsule = hppfcl.Capsule(1.0, 2.0)
M_box = hppfcl.Transform3f(np.eye(3), np.array([0, 0, 0]))
M_capsule = hppfcl.Transform3f(np.eye(3), np.array([10, 0, 0]))
req = hppfcl.DistanceRequest()
res = hppfcl.DistanceResult()
dis = hppfcl.distance(capsule, M_capsule, box, M_box, req, res) It does not give any other information, like the corresponding closest points. Is possible to help me understand how I can obtain that information? Thanks in advance! |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 7 replies
-
Did you look at the |
Beta Was this translation helpful? Give feedback.
-
Thanks for the response! So we can get the closest points using capsule_point = res.getNearestPoint1()
box_point = res.getNearestPoint2() This seems to give the points in world frame coordinates, is there a way to directly get the points in body frame coordinates? Another question I have is, when I want to compute the distance between the same objects just with different |
Beta Was this translation helpful? Give feedback.
-
Just apply the inverse transformation on the points.
Do a new call. You won't gain so much, except in specific scenarios. And please do not forget to cite this repository in your code and publications. |
Beta Was this translation helpful? Give feedback.
Thanks for the response!
So we can get the closest points using
This seems to give the points in world frame coordinates, is there a way to directly get the points in body frame coordinates?
Another question I have is, when I want to compute the distance between the same objects just with different
Transform3f
s, is there anupdate
function for that?