mhogg / pyoctree

Octree structure containing a 3D triangular mesh model
MIT License
86 stars 19 forks source link

Computing intersections over float values instead of dtype= dtype=np.float32, using dev version functionality. #49

Open shashankIITK opened 3 years ago

shashankIITK commented 3 years ago

In one of the issue you mentioned that in dev version you have made changes such that we need not specify dtype=np.float32. to compute ray intersection. I have downloaded source code from dev branch and installed it according to instructions in readme file but still I am getting error :

File "pyoctree\pyoctree.pyx", line 206, in pyoctree.pyoctree.pyoctree.PyOctree.rayIntersection ValueError: Buffer dtype mismatch, expected 'float' but got 'double'

Can you help me to fix this?

shashankIITK commented 3 years ago

Also I got this error while installing code that I downloaded from github: Cannot open source file: 'pyoctree/pyoctree.cpp': No such file or directory How this error is occuring please help me with this....

mhogg commented 3 years ago

Yes, as you say, some changes were made in the dev branch to address the double vs float issue. Your issue is that you are copying pyoctree.cpp from somewhere else, so when you build pyoctree these updates are not applied.

In the readme, it clearly says that if you are installing from source (meaning the pyx file) then you should have both Cython and a C++ compiler installed. It is Cython that will read poctree.pyx and then create pyoctree.cpp. The C++ compiler then compiles the pyoctree.cpp file into the Python extension.

So, in summary, install Cython and let it build the pyoctree.cpp file. Do not copy it from somewhere else.

Note: pyoctree.cpp is not included in the github release, because it is a generated file, not a source file. It is only included in the source files uploaded to PyPi (which is where I assume you got it from in the first place?) for people who may not have Cython installed.