// This file is part of libigl, a simple c++ geometry processing library. // // Copyright (C) 2014 Daniele Panozzo // // 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 "triangulate.h" #define REAL double #define VOID int extern "C" { #include } IGL_INLINE void igl::triangulate( const Eigen::MatrixXd& V, const Eigen::MatrixXi& E, const Eigen::MatrixXd& H, Eigen::MatrixXd& V2, Eigen::MatrixXi& F2, const std::string flags) { using namespace std; using namespace Eigen; // Prepare the flags string full_flags = flags + "pzBV"; // Prepare the input struct triangulateio in; assert(V.cols() == 2); in.numberofpoints = V.rows(); in.pointlist = (double*)calloc(V.rows()*2,sizeof(double)); for (unsigned i=0;i(full_flags.c_str()), &in, &out, 0); // Cleanup in free(in.pointlist); free(in.pointmarkerlist); free(in.segmentlist); free(in.segmentmarkerlist); free(in.holelist); // Cleanup out free(out.pointlist); free(out.trianglelist); free(out.segmentlist); // Return the mesh V2.resize(out.numberofpoints,2); for (unsigned i=0;i