read_into_tetgenio.h 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. // This file is part of libigl, a simple c++ geometry processing library.
  2. //
  3. // Copyright (C) 2013 Alec Jacobson <alecjacobson@gmail.com>
  4. //
  5. // This Source Code Form is subject to the terms of the Mozilla Public License
  6. // v. 2.0. If a copy of the MPL was not distributed with this file, You can
  7. // obtain one at http://mozilla.org/MPL/2.0/.
  8. #ifndef IGL_COPYLEFT_TETGEN_READ_INTO_TETGENIO_H
  9. #define IGL_COPYLEFT_TETGEN_READ_INTO_TETGENIO_H
  10. #include "../../igl_inline.h"
  11. #include <string>
  12. #ifndef TETLIBRARY
  13. #define TETLIBRARY
  14. #endif
  15. #include "tetgen.h" // Defined tetgenio, REAL
  16. namespace igl
  17. {
  18. namespace copyleft
  19. {
  20. namespace tetgen
  21. {
  22. // Read a mesh or point set into tetgenio (input object for calling
  23. // tetgen). Many file formats are already supported by tetgen:
  24. // .off
  25. // .ply
  26. // .node
  27. // .ply
  28. // .medit
  29. // .vtk
  30. // etc.
  31. // Noteably it does not support .obj which is loaded by hand here (also
  32. // demonstrating how to load points/faces programatically)
  33. //
  34. // If the file extension is not recognized the filename is assumed to be
  35. // the basename of a collection describe a tetmesh, (of which at least
  36. // the .node file must exist):
  37. // [filename].node
  38. // [filename].ele
  39. // [filename].face
  40. // [filename].edge
  41. // [filename].vol
  42. //
  43. // Inputs:
  44. // path path to file or basename to files
  45. // Outputs:
  46. // in tetgenio input object
  47. // Returns true on success, false on error
  48. IGL_INLINE bool read_into_tetgenio(
  49. const std::string & path,
  50. tetgenio & in);
  51. }
  52. }
  53. }
  54. #ifndef IGL_STATIC_LIBRARY
  55. # include "read_into_tetgenio.cpp"
  56. #endif
  57. #endif