theHamsta / volume2mesh

Voxelize meshes to volumes. Save meshes from volumes.
GNU General Public License v3.0
6 stars 1 forks source link

error when run example code #1

Closed utc1205 closed 4 years ago

utc1205 commented 4 years ago

after following the installation, I run the example code below:

file = '/tmp/my_mesh_file.obj' volume = np.zeros((100, 120, 131), np.float32) volume[20:40, 30:40, 40:50] = 1

volume2mesh(file, volume, threshold=0.5, adaptivity=0., spacing=[1., 1., 1.], origin=[0., 0., 0.], binary_file=True, only_write_biggest_components=False, max_component_count=1)

but the error shows:

/home/lpc/.local/lib/python3.6/site-packages/volume2mesh/internal/.rendered.vdb_meshing.cpp:62:5: error: no matching function for call to ‘openvdb::v3_1::Grid<openvdb::v3_1::tree::Tree<openvdb::v3_1::tree::RootNode<openvdb::v3_1::tree::InternalNode<openvdb::v3_1::tree::InternalNode<openvdb::v3_1::tree::LeafNode<float, 3u>, 4u>, 5u> > > >::setTransform(std::shared_ptr&)’ grid->setTransform(scaleTransform);

Could you help me with that error?

Thank you

theHamsta commented 4 years ago

Hi, thanks for the question! Could you maybe send the complete output of your compiler. Usually, there's some hints why the respective function could not be found. Probably, there's some changes in the API of OpenVDB. I'm using a more recent version (5.2). Though I could not find any big differences with that specific function.

Since you're using [1,1,1] spacing and origin [0,0,0], no transform is applied. So you could also out-comment the following lines in /home/lpc/.local/lib/python3.6/site-packages/volume2mesh/internal/vdb_meshing.cpp as a quickfix:

https://github.com/theHamsta/volume2mesh/blob/89e5fb8577e650d3cc60810333ef48817b4a87da/src/volume2mesh/internal/vdb_meshing.cpp#L72-L75

Which Linux distrubution are you using? In https://github.com/theHamsta/volume2mesh/blob/89e5fb8577e650d3cc60810333ef48817b4a87da/.travis.yml you can compare how the package is installed on Ubuntu Bionic. The package is just using cppimport instead of a proper CMake build script which would make finding libraries and headers easier.

utc1205 commented 4 years ago

thank you very much, after out-commenting these lines, it can run correctly.