writeOFF.h 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  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_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
  16. // Export a mesh from an ascii OFF file, filling in vertex positions.
  17. // Only triangle meshes are supported
  18. //
  19. // Templates:
  20. // Scalar type for positions and vectors (will be read as double and cast
  21. // to Scalar)
  22. // Index type for indices (will be read as int and cast to Index)
  23. // Inputs:
  24. // str path to .off output file
  25. // V #V by 3 mesh vertex positions
  26. // F #F by 3 mesh indices into V
  27. // C double matrix of rgb values per vertex #V by 3
  28. // Outputs:
  29. // Returns true on success, false on errors
  30. template <typename DerivedV, typename DerivedF, typename DerivedC>
  31. IGL_INLINE bool writeOFF(
  32. const std::string str,
  33. const Eigen::PlainObjectBase<DerivedV>& V,
  34. const Eigen::PlainObjectBase<DerivedF>& F,
  35. const Eigen::PlainObjectBase<DerivedC>& C);
  36. template <typename DerivedV, typename DerivedF>
  37. IGL_INLINE bool writeOFF(
  38. const std::string str,
  39. const Eigen::PlainObjectBase<DerivedV>& V,
  40. const Eigen::PlainObjectBase<DerivedF>& F);
  41. }
  42. #ifndef IGL_STATIC_LIBRARY
  43. # include "writeOFF.cpp"
  44. #endif
  45. #endif