#include "tetgenio_to_tetmesh.h" // IGL includes #include // STL includes #include IGL_INLINE bool igl::tetgenio_to_tetmesh( const tetgenio & out, std::vector > & V, std::vector > & T) { using namespace std; // process points if(out.pointlist == NULL) { cerr<<"^tetgenio_to_tetmesh Error: point list is NULL\n"<(3)); // loop over points for(int i = 0;i < out.numberofpoints; i++) { V[i][0] = out.pointlist[i*3+0]; V[i][1] = out.pointlist[i*3+1]; V[i][2] = out.pointlist[i*3+2]; } // process tets if(out.tetrahedronlist == NULL) { cerr<<"^tetgenio_to_tetmesh Error: tet list is NULL\n"<(out.numberofcorners)); int min_index = 1e7; int max_index = -1e7; // loop over tetrahedra for(int i = 0; i < out.numberoftetrahedra; i++) { for(int j = 0; j index ? index : min_index); max_index = (max_index < index ? index : max_index); } } assert(min_index >= 0); assert(max_index >= 0); assert(max_index < (int)V.size()); return true; } template IGL_INLINE bool igl::tetgenio_to_tetmesh( const tetgenio & out, Eigen::PlainObjectBase& V, Eigen::PlainObjectBase& T) { using namespace igl; using namespace std; vector > vV; vector > vT; bool success = tetgenio_to_tetmesh(out,vV,vT); if(!success) { return false; } bool V_rect = list_to_matrix(vV,V); if(!V_rect) { // igl::list_to_matrix(vV,V) already printed error message to std err return false; } bool T_rect = list_to_matrix(vT,T); if(!T_rect) { // igl::list_to_matrix(vT,T) already printed error message to std err return false; } return true; } #ifndef IGL_HEADER_ONLY // Explicit template specialization template bool igl::tetgenio_to_tetmesh, Eigen::Matrix >(tetgenio const&, Eigen::PlainObjectBase >&, Eigen::PlainObjectBase >&); #endif