// This file is part of libigl, a simple c++ geometry processing library. // // Copyright (C) 2013 Alec Jacobson // // This Source Code Form is subject to the terms of the Mozilla Public License // v. 2.0. If a copy of the MPL was not distributed with this file, You can // obtain one at http://mozilla.org/MPL/2.0/. #include "tetrahedralize.h" #include "mesh_to_tetgenio.h" #include "tetgenio_to_tetmesh.h" // IGL includes #include "../../matrix_to_list.h" #include "../../list_to_matrix.h" #include "../../boundary_facets.h" // STL includes #include #include template < typename DerivedV, typename DerivedF, typename DerivedH, typename DerivedVM, typename DerivedFM, typename DerivedR, typename DerivedTV, typename DerivedTT, typename DerivedTF, typename DerivedTM, typename DerivedTR, typename DerivedTN, typename DerivedPT, typename DerivedFT> IGL_INLINE int igl::copyleft::tetgen::tetrahedralize( const Eigen::MatrixBase& V, const Eigen::MatrixBase& F, const Eigen::MatrixBase& H, const Eigen::MatrixBase& VM, const Eigen::MatrixBase& FM, const Eigen::MatrixBase& R, const std::string switches, Eigen::PlainObjectBase& TV, Eigen::PlainObjectBase& TT, Eigen::PlainObjectBase& TF, Eigen::PlainObjectBase& TM, Eigen::PlainObjectBase& TR, Eigen::PlainObjectBase& TN, Eigen::PlainObjectBase& PT, Eigen::PlainObjectBase& FT, int & num_regions) { // REAL is what tetgen is using as floating point precision // Prepare input tetgenio in,out; mesh_to_tetgenio(V,F,H,VM,FM,R,in); try { char * cswitches = new char[switches.size() + 1]; std::strcpy(cswitches,switches.c_str()); ::tetrahedralize(cswitches,&in, &out); delete[] cswitches; }catch(int e) { std::cerr<<"^"<<__FUNCTION__<<": TETGEN CRASHED... KABOOOM!!!"< IGL_INLINE int igl::copyleft::tetgen::tetrahedralize( const Eigen::MatrixBase& V, const Eigen::MatrixBase& F, const std::string switches, Eigen::PlainObjectBase& TV, Eigen::PlainObjectBase& TT, Eigen::PlainObjectBase& TF) { Eigen::VectorXi VM,FM; Eigen::MatrixXd H,R; Eigen::VectorXi TM,TR,PT; Eigen::MatrixXi FT,TN; int numRegions; return tetrahedralize(V,F,H,VM,FM,R,switches,TV,TT,TF,TM,TR,TN,PT,FT,numRegions); } #ifdef IGL_STATIC_LIBRARY // Explicit template instantiation // generated by autoexplicit.sh template int igl::copyleft::tetgen::tetrahedralize, Eigen::Matrix, Eigen::Matrix, Eigen::Matrix, Eigen::Matrix>(Eigen::MatrixBase> const&, Eigen::MatrixBase> const&, std::basic_string, std::allocator>, Eigen::PlainObjectBase>&, Eigen::PlainObjectBase>&, Eigen::PlainObjectBase>&); // generated by autoexplicit.sh template int igl::copyleft::tetgen::tetrahedralize, Eigen::Matrix, Eigen::Matrix, Eigen::Matrix, Eigen::Matrix, Eigen::Matrix, Eigen::Matrix, Eigen::Matrix, Eigen::Matrix, Eigen::Matrix, Eigen::Matrix, Eigen::Matrix, Eigen::Matrix, Eigen::Matrix>(Eigen::MatrixBase> const&, Eigen::MatrixBase> const&, Eigen::MatrixBase> const&, Eigen::MatrixBase> const&, Eigen::MatrixBase> const&, Eigen::MatrixBase> const&, std::basic_string, std::allocator>, Eigen::PlainObjectBase>&, Eigen::PlainObjectBase>&, Eigen::PlainObjectBase>&, Eigen::PlainObjectBase>&, Eigen::PlainObjectBase>&, Eigen::PlainObjectBase>&, Eigen::PlainObjectBase>&, Eigen::PlainObjectBase>&, int&); #endif