flexible-collision-library / fcl

Flexible Collision Library
https://flexible-collision-library.github.io/
Other
1.39k stars 417 forks source link

the time to create BVHModel #591

Closed ZERO-EAST closed 1 year ago

ZERO-EAST commented 1 year ago

For large amounts of data, Why does it take more than ten times longer to create BVHModels based on Python than C++?

e.g. the number of points is 176223, the number of triangles is 343688,

Python

m = fcl.BVHModel()
m.beginModel(len(points), len(triangles))
m.addSubModel(points, triangles)
m.endModel()

C++

std::shared_ptr<BVHModel<AABBd>> mesh_model;
mesh_model = std::make_shared<BVHModel<AABBd>>();
mesh_model->beginModel();
mesh_model->addSubModel(points, triangles);
mesh_model->endModel();
SeanCurtis-TRI commented 1 year ago

I suspect this is more a question for https://github.com/BerkeleyAutomation/python-fcl. The most likely possibility is that the points and triangles are being iterated through as python objects so you're paying the python loop cost instead of the C++ cost. But as this belongs to the bindings more than it does to this repo,