// 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 "mesh_with_skeleton.h" #include "tetrahedralize.h" #include "../../sample_edges.h" #include "../../cat.h" #include // Default settings pq2Y tell tetgen to mesh interior of triangle mesh and // to produce a graded tet mesh const static std::string DEFAULT_TETGEN_FLAGS = "pq2Y"; IGL_INLINE bool igl::copyleft::tetgen::mesh_with_skeleton( const Eigen::MatrixXd & V, const Eigen::MatrixXi & F, const Eigen::MatrixXd & C, const Eigen::VectorXi & /*P*/, const Eigen::MatrixXi & BE, const Eigen::MatrixXi & CE, const int samples_per_bone, const std::string & tetgen_flags, Eigen::MatrixXd & VV, Eigen::MatrixXi & TT, Eigen::MatrixXi & FF) { const std::string eff_tetgen_flags = (tetgen_flags.length() == 0?DEFAULT_TETGEN_FLAGS:tetgen_flags); // Collect all edges that need samples: Eigen::MatrixXi BECE = cat(1,BE,CE); Eigen::MatrixXd S; // Sample each edge with 10 samples. (Choice of 10 doesn't seem to matter so // much, but could under some circumstances) sample_edges(C,BECE,samples_per_bone,S); // Vertices we'll constrain tet mesh to meet Eigen::MatrixXd VS = cat(1,V,S); // Use tetgen to mesh the interior of surface, this assumes surface: // * has no holes // * has no non-manifold edges or vertices // * has consistent orientation // * has no self-intersections // * has no 0-volume pieces int status = tetrahedralize( VS,F,eff_tetgen_flags,VV,TT,FF); if(FF.rows() != F.rows()) { // Issue a warning if the surface has changed std::cerr<<"mesh_with_skeleton: Warning: boundary faces != input faces"<