Why Pymesh boolean operations extremely slow with my simple geometry setup?

682 views Asked by At

I am testing the efficiency of boolean operations in pymesh to see how fast it calculate boolean. But the performance I got using the default engine was extremely slow, comparing to the libigl paper

0.25 s in calculating self-union of 8616 meshes.

I did an experiment with a grain mesh intersecting with a small primitive box. The grain has 12 vertices, the primitive box has 8 vertices. The position of the grain is just semi-above one of the box's face. Calculating the intersection of these two objects, took 0.036 seconds.

For such an easy calculation, why it takes 0.036 seconds? When conducting this boolean operation, pymesh us Libigl as an engine, which is written in C++. DO I have to write the code in C++ to use Libigl directly to get similar performance?

These results are produced in the following environment:

  • Processor: 2.3 GHz Dual-Core Intel Core i5
  • Memory: 8 GB 2133 MHz LPDDR3
  • OS: Mac OS Catalina 10.15.7
  • IDE: Visual Studio Code, Jupyter Notebook
  • Python version: 3.7.5
  • Pymesh version: pymesh2==0.3
1

There are 1 answers

0
aerobiomat On

PyMesh describes itself as a rapid prototyping library and it depends on many other libraries.

If you want to use directly libigl from Python you may wish to try their Python bindings.

In either case, make sure you measure your program's speed using the timeit module.