example1.cpp 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. //
  2. // IGL Lib - Simple C++ mesh library
  3. //
  4. // Copyright 2011, Daniele Panozzo. All rights reserved.
  5. // IMPORTANT DO NOT REMOVE OR MOVE
  6. #define EIGEN_YES_I_KNOW_SPARSE_MODULE_IS_NOT_STABLE_YET
  7. #include <iostream>
  8. #include <string>
  9. #include <igl/read.h>
  10. #include <igl/write.h>
  11. #include <igl/cotmatrix.h>
  12. #include <igl/tt.h>
  13. #include <igl/edgetopology.h>
  14. using namespace std;
  15. int main (int argc, const char * argv[])
  16. {
  17. Eigen::MatrixXd V;
  18. Eigen::MatrixXi F;
  19. igl::read("bunny.off",V,F);
  20. std::cout << "Mesh loaded!\n";
  21. cout << "Vertex Array:" << endl;
  22. cout << V << endl;
  23. cout << "-------------" << endl;
  24. cout << "Face Array:" << endl;
  25. cout << F << endl;
  26. cout << "-------------" << endl;
  27. cout << "CotMatrix:" << endl;
  28. Eigen::SparseMatrix<double> L;
  29. igl::cotmatrix(V,F,L);
  30. cout << L << endl;
  31. cout << "-------------" << endl;
  32. igl::write("bunny_out.off",V,F);
  33. // Face Topology
  34. cout << "TT Topology:" << endl;
  35. Eigen::MatrixXi TT;
  36. igl::tt(V,F,TT);
  37. cout << TT << endl;
  38. cout << "-------------" << endl;
  39. // Edge Topology
  40. cout << "Edge Topology:" << endl;
  41. Eigen::MatrixXi EV;
  42. Eigen::MatrixXi FE;
  43. Eigen::MatrixXi EF;
  44. igl::edgetopology(V,F,EV,FE, EF);
  45. cout << EV << endl << FE << endl << EF << endl;
  46. cout << "-------------" << endl;
  47. return 0;
  48. }