topskychen / voxelizer

A fast parallel CPU-based surface & solid voxelizer.
MIT License
76 stars 20 forks source link

undeclared identifier 'Vec3f' #5

Closed ngophuc closed 6 years ago

ngophuc commented 6 years ago

Dear authors,

I would like to test/use your voxelizer code. However, I have several problems while compiling the code, it is related to the type "Vec3f". Here are errors:

/src/commons.h:47:24: error: unknown type name 'Vec3f' inline void Fill(const Vec3f& vc, float ft[3]); /src/commons.h:34: error: use of class template 'TriangleP' requires template arguments /src/commons.h:35: error: use of class template 'Box' requires template arguments ...

Could you fix them ? Thank you !

topskychen commented 6 years ago

May I know have you installed the libfcl? It looks the program cannot find the Vec3f which is originated from libfcl. Please check https://github.com/topskychen/voxelizer#installation section.

ngophuc commented 6 years ago

I installed libfcl but not the tag 0.3.3 since I got some errors with octomap lib.

topskychen commented 6 years ago

Please install tags/0.3.3, the latest version has changed a lot. May I know what is the detailed error you got when you install? The platform being tested includes MacOS 10.9.3/10.13.4 and ubuntu 14.04.

ngophuc commented 6 years ago

Here is error .... In file included from /fcl/src/continuous_collision.cpp:6: In file included from /fcl/include/fcl/traversal/traversal_node_setup.h:47: */fcl/include/fcl/traversal/traversal_node_octree.h:670:52: error: no member named 'getChild' in 'octomap::OcTreeNode' const OcTree::OcTreeNode child = root1->getChild(i);**


/fcl/include/fcl/traversal/traversal_node_octree.h:704:16: warning: 'hasChildren' is deprecated
      [-Wdeprecated-declarations]
    if(!root1->hasChildren() && !root2->hasChildren())
               ^
/usr/local/include/octomap/OcTreeDataNode.h:100:5: note: 'hasChildren' has been explicitly marked deprecated here
    OCTOMAP_DEPRECATED(bool hasChildren() const);
....
topskychen commented 6 years ago

Can I have more information?

  1. When did this error happen? Is it when you build the fcl lib?
  2. How did you build libfcl?
  3. Have you installed libccd?
  4. What is your platform and version?
ngophuc commented 6 years ago

Can I have more information?

When did this error happen? Is it when you build the fcl lib?

yes, it happens when I compile fcl lib How did you build libfcl? with cmake as explained in https://github.com/flexible-collision-library/fcl Have you installed libccd? Yes (https://github.com/danfis/libccd) What is your platform and version? MacOs High Sierra 10.13.4

topskychen commented 6 years ago

Hmm, I build once again successfully on 10.13.4. To confirm again:

  1. git clone the fcl repo.
  2. git checkout tags/0.3.3
  3. go to fcl and mkdir build
  4. cd build
  5. cmake ..
  6. make install
ngophuc commented 6 years ago

Which version of octomap do you have ? Is it 1.9.0 ?

topskychen commented 6 years ago

I see. That's the reason. I am not using the Octomap. -- FCL does not use Octomap. You may skip the Octomap when cmake.

# Find Octomap (optional)
find_package(PkgConfig QUIET)
set(FCL_HAVE_OCTOMAP 0)
if(PKG_CONFIG_FOUND)
    pkg_check_modules(OCTOMAP QUIET octomap)
endif()
if(NOT OCTOMAP_FOUND)
    # if pkfconfig is not installed, then fall back on more fragile detection
    # of octomap
    find_path(OCTOMAP_INCLUDE_DIRS octomap.h
        PATH_SUFFIXES octomap)
    find_path(OCTOMAP_LIBRARY_DIRS
        ${CMAKE_SHARED_LIBRARY_PREFIX}octomap${CMAKE_SHARED_LIBRARY_SUFFIX})
    if(OCTOMAP_INCLUDE_DIRS AND OCTOMAP_LIBRARY_DIRS)
        set(OCTOMAP_LIBRARIES "octomap;octomath")
    endif()
endif()
if (OCTOMAP_INCLUDE_DIRS AND OCTOMAP_LIBRARY_DIRS)
  include_directories(${OCTOMAP_INCLUDE_DIRS})
  link_directories(${OCTOMAP_LIBRARY_DIRS})
  set(FCL_HAVE_OCTOMAP 1)
  message(STATUS "FCL uses Octomap")
else()
  message(STATUS "FCL does not use Octomap")
endif()
ngophuc commented 6 years ago

Indeed, it is due to octomap. Thanks a lot for your help. It works now. Another question, how do you visualize the result ? (.vox file).

topskychen commented 6 years ago

Cool, you may check the result as follows:

  1. http://www.patrickmin.com/viewvox/ this software can view a voxelized file.
  2. In main file: https://github.com/topskychen/voxelizer/blob/master/src/voxelizerMain.cpp, please enable voxelizer.writeForView(outputFile) by commenting line 34 and uncomment line 36. The writeForView function will generate the file which can be compatible with viewvox.
ngophuc commented 6 years ago

I tried viewvox with writeForView, but I got this error :

--- [viewvox] binary voxel viewer, version 0.45, build #367 on 2017/12/29 14:09:23 --- written by Patrick Min, 2004-2017

will keep all interal voxels loading voxel file... filename: [data/kawada-hironx], extension: [vox] error: unsupported filetype 5

Do you know why ?

topskychen commented 6 years ago

Are you sure you are using WriteForView? *output << "#binvox 1" << endl; the type should be 1 instead of 5. Btw, make sure you rebuild the program after you make the code change. Here is what I can see on my local mac:

image image

ngophuc commented 6 years ago

Sorry, it's completely my fault. I was in the wrong directory. It works now. Thanks a lot for your time. It's so great !

topskychen commented 6 years ago

So glad to hear it works, enjoy ;) I am closing this issue now.

davinci26 commented 6 years ago

Hey, coming a bit late to the party.

Did you do any additional configurations to make viewvox work besides enabling WriteForView?

My output get stuck and it only shows this:

davincis-MBP:stl_visualization davinci$ sudo ./viewvox data/kawada-hironx.binvox 

--- [viewvox] binary voxel viewer, version 0.45, build #367 on 2017/12/29 14:09:23
--- written by Patrick Min, 2004-2017