no nearest_points attribute for python bindings #623
-
Hi, i couldn't find It would be useful for testing things in python, Is it possible to implement or there are some issues with it? (i have no experience for writing python bindings for cpp libraries). |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
Hi @almazgaliev, col_res = hppfcl.CollisionResult()
[...] # do some collision checks
if col_res.isCollision():
contact = col_res.getContact(0) # get the first `Contact` object
cp1, cp2 = contact.getNearestPoint1(), contact.getNearestPoint2() If you are using the latest release which corresponds to the col_res = hppfcl.CollisionResult()
[...] # do some collision checks
if col_res.isCollision():
contact = col_res.getContact(0) # get the first `Contact` object
cp = contact.pos
normal = contact.normal
d = contact.penetration_depth
cp1, cp2 = cp - d * normal, cp + d * normal A few notes:
|
Beta Was this translation helpful? Give feedback.
Hi @almazgaliev,
A
CollisionResult
stores a vector ofContact
(in case there is indeed a collision).I don't know which branch of hpp-fcl you are using, but on the devel one (which will soon be released, @jorisv is working on it), you can retrieve the nearest points. On the master branch, you can use the normal and the contact point to find the associated "nearest" points.
On the
devel
branch, you can go over eachContact
and usegetNearestPoint1/2
methods:If…