// This file is part of libigl, a simple c++ geometry processing library. // // Copyright (C) 2018 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/. #ifndef IGL_REMESH_ALONG_ISOLINE_H #define IGL_REMESH_ALONG_ISOLINE_H #include "igl_inline.h" #include #include namespace igl { /// Given a triangle mesh and a scalar field, remesh so that a given isovalue /// of the scalar field follows (new) edges of the output mesh. Effectively /// running "marching triangles" on mesh, but not in any coherent order. The /// output mesh should be as manifold as the input. /// /// @param[in] V #V by dim list of mesh vertex positions /// @param[in] F #F by 3 list of mesh triangle indices into V /// @param[in] S #V by 1 list of scalar field /// @param[in] val value of S to remesh along /// @param[out] U #U by dim list of mesh vertex positions #U>=#V /// @param[out] G #G by 3 list of mesh triangle indices into U, #G>=#F /// @param[out] SU #U list of scalar field values over new mesh /// @param[out] J #G list of indices into F revealing birth triangles /// @param[out] BC #U by #V sparse matrix of barycentric coordinates so that U = BC*V /// @param[out] L #G list of bools whether scalar field in triangle below or above val template < typename DerivedV, typename DerivedF, typename DerivedS, typename DerivedU, typename DerivedG, typename DerivedJ, typename BCtype, typename DerivedSU, typename DerivedL> IGL_INLINE void remesh_along_isoline( const Eigen::MatrixBase & V, const Eigen::MatrixBase & F, const Eigen::MatrixBase & S, const typename DerivedS::Scalar val, Eigen::PlainObjectBase & U, Eigen::PlainObjectBase & G, Eigen::PlainObjectBase & SU, Eigen::PlainObjectBase & J, Eigen::SparseMatrix & BC, Eigen::PlainObjectBase & L); /// \overload /// @param[in] n number of vertices (#V) template < typename DerivedF, typename DerivedS, typename DerivedG, typename DerivedJ, typename BCtype, typename DerivedSU, typename DerivedL> IGL_INLINE void remesh_along_isoline( const int n, const Eigen::MatrixBase & F, const Eigen::MatrixBase & S, const typename DerivedS::Scalar val, Eigen::PlainObjectBase & G, Eigen::PlainObjectBase & SU, Eigen::PlainObjectBase & J, Eigen::SparseMatrix & BC, Eigen::PlainObjectBase & L); } #ifndef IGL_STATIC_LIBRARY # include "remesh_along_isoline.cpp" #endif #endif