// 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" #ifdef ANSI_DECLARATORS # define IGL_PREVIOUSLY_DEFINED_ANSI_DECLARATORS ANSI_DECLARATORS # undef ANSI_DECLARATORS #endif #ifdef REAL # define IGL_PREVIOUSLY_DEFINED_REAL REAL # undef REAL #endif #ifdef VOID # define IGL_PREVIOUSLY_DEFINED_VOID VOID # undef VOID #endif #define ANSI_DECLARATORS #define REAL double #define VOID int extern "C" { #include } #undef ANSI_DECLARATORS #ifdef IGL_PREVIOUSLY_DEFINED_ANSI_DECLARATORS # define ANSI_DECLARATORS IGL_PREVIOUSLY_DEFINED_ANSI_DECLARATORS #endif #undef REAL #ifdef IGL_PREVIOUSLY_DEFINED_REAL # define REAL IGL_PREVIOUSLY_DEFINED_REAL #endif #undef VOID #ifdef IGL_PREVIOUSLY_DEFINED_VOID # define VOID IGL_PREVIOUSLY_DEFINED_VOID #endif IGL_INLINE void igl::triangle::triangulate( const Eigen::MatrixXd& V, const Eigen::MatrixXi& E, const Eigen::MatrixXd& H, const std::string flags, Eigen::MatrixXd& V2, Eigen::MatrixXi& F2) { using namespace std; using namespace Eigen; // Prepare the flags string full_flags = flags + "pzB"; // 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); // Return the mesh V2.resize(out.numberofpoints,2); for (unsigned i=0;i