-
Hello! I noticed that returning distance from distance_lower_bound quite unprecise. Seems to be it can be a ditance between AABB's, but not between geometries themselves. Here's my test when I'm getting different results with different cube mesh positions. Although real distance (closest points) between two objects not chaned. shared_ptr<BVHModelBase> loadMesh(const char* file_name) {
NODE_TYPE bv_type = BV_OBBRSS;
MeshLoader loader(bv_type);
shared_ptr<BVHModelBase> bvh = loader.load(file_name);
return bvh;
}
int main() {
shared_ptr<BVHModelBase> shapeA = loadMesh("d:/dev/collis_models/obj_A.obj");
shared_ptr<BVHModelBase> shapeB = loadMesh("d:/dev/collis_models/obj_B.obj");
shared_ptr<BVHModelBase> shapeC = loadMesh("d:/dev/collis_models/obj_cylinder.obj");
auto* objA = new CollisionObject(shapeA);
auto* objB = new CollisionObject(shapeB);
auto* objC = new CollisionObject(shapeC);
CollisionRequest col_req;
col_req.security_margin = 0;
CollisionResult col_res;
collide(objA, objC, col_req, col_res);
cout << "A" << "\n";
cout << "distance_lower_bound: " << col_res.distance_lower_bound << "\n";
cout << "nearest point 1: " << col_res.nearest_points[0].transpose() << "\n";
cout << "nearest point 2: " << col_res.nearest_points[1].transpose() << "\n";
col_res.clear();
collide(objB, objC, col_req, col_res);
cout << "B" << "\n";
cout << "distance_lower_bound: " << col_res.distance_lower_bound << "\n";
cout << "nearest point 1: " << col_res.nearest_points[0].transpose() << "\n";
cout << "nearest point 2: " << col_res.nearest_points[1].transpose() << "\n";
col_res.clear();
retirn 0;
} Output:
Is there any options to get precise distance between geometries? |
Beta Was this translation helpful? Give feedback.
Answered by
maxwave11
May 27, 2024
Replies: 1 comment
-
Hm, found that there's a method distance from <hpp/fcl/distance.h> which calculates distance with correct value. |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
maxwave11
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hm, found that there's a method distance from <hpp/fcl/distance.h> which calculates distance with correct value.