writeOFF.h 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. // This file is part of libigl, a simple c++ geometry processing library.
  2. //
  3. // Copyright (C) 2013 Alec Jacobson <[email protected]>
  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_WRITEOFF_H
  9. #define IGL_WRITEOFF_H
  10. #include "igl_inline.h"
  11. #include <Eigen/Core>
  12. #include <string>
  13. namespace igl
  14. {
  15. /// Export geometry and colors-by-vertex to an ascii OFF file
  16. ///
  17. /// Only triangle meshes are supported
  18. ///
  19. /// @tparam Scalar type for positions and vectors (will be read as double and cast
  20. /// to Scalar)
  21. /// @tparam Index type for indices (will be read as int and cast to Index)
  22. /// @param[in] str path to .off output file
  23. /// @param[in] V #V by 3 mesh vertex positions
  24. /// @param[in] F #F by 3 mesh indices into V
  25. /// @param[in] C double matrix of rgb values per vertex #V by 3
  26. /// @return true on success, false on errors
  27. template <typename DerivedV, typename DerivedF, typename DerivedC>
  28. IGL_INLINE bool writeOFF(
  29. const std::string str,
  30. const Eigen::MatrixBase<DerivedV>& V,
  31. const Eigen::MatrixBase<DerivedF>& F,
  32. const Eigen::MatrixBase<DerivedC>& C);
  33. /// \overload
  34. template <typename DerivedV, typename DerivedF>
  35. IGL_INLINE bool writeOFF(
  36. const std::string str,
  37. const Eigen::MatrixBase<DerivedV>& V,
  38. const Eigen::MatrixBase<DerivedF>& F);
  39. }
  40. #ifndef IGL_STATIC_LIBRARY
  41. # include "writeOFF.cpp"
  42. #endif
  43. #endif