资源简介

3D三角形网格模型补洞算法源代码,原为linux平台下编译,现已改为Windows环境下;由于使用了C++11新特性,需通过VS2013或更高版本编译。

资源截图

代码片段和文件信息

#pragma warning(disable:4996)
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 

using Eigen::VectorXi;
using Eigen::MatrixXd;
using Eigen::MatrixXi;
using Eigen::VectorXd;
typedef Eigen::SparseMatrix SpMat;
typedef Eigen::Triplet Tri;

void printHelpExit() {
printf(“Invalid command line arguments specified!\n\n“);

printf(“USAGE: hole_fixer [options]\n\n“);

printf(“OPTIONS: \n“);

printf(“  -in\t\t\ttarget mesh file in .off-format with a hole\n“);
printf(“  -out\t\t\toutput mesh file in .off-format\n“);
printf(“  -outfaces\t\tHow many faces to decimate the mesh to\n“);
printf(“  -upsample\t\tHow much upsampling to use when creating the patch\n“);

exit(1);
}

const char* findToken(const char* param int argc char* argv[]) {
const char* token = nullptr;
for (int i = 0; i < argc; ++i) {
if (strcmp(argv[i] param) == 0) {
if (i + 1 < argc) {
token = argv[i + 1];
break;
}
}
}

if (token == nullptr) {
printf(“Could not find command-line parameter %s\n“ param);
return nullptr;
}

return token;
}

const char* parseStringParam(const char* param int argc char* argv[]) {
const char* token = findToken(param argc argv);
return token;
}

bool parseIntParam(const char* param int argc char* argv[] unsigned int& out) {
const char* token = findToken(param argc argv);
if (token == nullptr)
return false;

int r = sscanf(token “%u“ &out);
if (r != 1 || r == EOF) {
return false;
}
else {
return true;
}
}

int main(/*int argc char *argv[]*/)
{

//
// command line parsing.
//
int argc = 2;
char* argv[] = { “hole_fixer“ “-in“ “bunnyhole.off“ “-out“ “out.off“ “-outfaces“ “8000“ “-upsample“ “2“ };
const char* inFile = “bunnyhole.off“;
/*const char* inFile = parseStringParam(“-in“ argc argv);*/
if (inFile == nullptr) printHelpExit();
const char* outFile = “example.off“;
//const char* outFile = parseStringParam(“-out“ argc argv);
if (outFile == nullptr) printHelpExit();

unsigned int outFacesN = 8000;
//if (!parseIntParam(“-outfaces“ argc argv outFacesN)) printHelpExit();

unsigned int upsampleN = 2;
//if (!parseIntParam(“-upsample“ argc argv upsampleN)) printHelpExit();

// original mesh vertices and indices. This is the original mesh which has a hole.
MatrixXd originalV;
MatrixXi originalF;

if (!igl::readOFF(inFile originalV originalF)) {
printHelpExit();
}
VectorXi originalLoop; // indices of the boundary of the hole. 
igl::boundary_loop(originalF originalLoop);


if (originalLoop.size() == 0) {
printf(“Mesh has no hole!“);
printHelpExit();
}

// upsample the original mesh. this makes fusing the original mesh with the patch much easier.
igl::upsample(Eigen::MatrixXd(originalV) Eigen::MatrixXi(originalF) originalV

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

    ..A..H.     40448  2018-06-28 21:41  MeshFixer\.vs\MeshFixer\v14\.suo

     文件     365818  2018-02-27 05:24  MeshFixer\bunnyhole.off

     文件    2189824  2018-06-28 21:36  MeshFixer\Debug\MeshFixer.exe

     文件   12838568  2018-06-28 21:36  MeshFixer\Debug\MeshFixer.ilk

     文件   50393088  2018-06-28 21:36  MeshFixer\Debug\MeshFixer.pdb

     文件     365818  2018-02-27 05:24  MeshFixer\hole_fixer-master\bunnyhole.off

     文件        137  2018-02-27 05:24  MeshFixer\hole_fixer-master\CMakeLists.txt

     文件     338153  2018-02-27 05:24  MeshFixer\hole_fixer-master\img\bunnymontage.png

     文件     221121  2018-02-27 05:24  MeshFixer\hole_fixer-master\img\spheremontage.png

     文件        304  2018-02-27 05:24  MeshFixer\hole_fixer-master\libigl\eigen\Eigen\Array

     文件        775  2018-02-27 05:24  MeshFixer\hole_fixer-master\libigl\eigen\Eigen\Cholesky

     文件       1670  2018-02-27 05:24  MeshFixer\hole_fixer-master\libigl\eigen\Eigen\CholmodSupport

     文件        607  2018-02-27 05:24  MeshFixer\hole_fixer-master\libigl\eigen\Eigen\CMakeLists.txt

     文件      12826  2018-02-27 05:24  MeshFixer\hole_fixer-master\libigl\eigen\Eigen\Core

     文件        122  2018-02-27 05:24  MeshFixer\hole_fixer-master\libigl\eigen\Eigen\Dense

     文件         37  2018-02-27 05:24  MeshFixer\hole_fixer-master\libigl\eigen\Eigen\Eigen

     文件       3295  2018-02-27 05:24  MeshFixer\hole_fixer-master\libigl\eigen\Eigen\Eigen2Support

     文件       1394  2018-02-27 05:24  MeshFixer\hole_fixer-master\libigl\eigen\Eigen\Eigenvalues

     文件       1605  2018-02-27 05:24  MeshFixer\hole_fixer-master\libigl\eigen\Eigen\Geometry

     文件        580  2018-02-27 05:24  MeshFixer\hole_fixer-master\libigl\eigen\Eigen\Householder

     文件       1594  2018-02-27 05:24  MeshFixer\hole_fixer-master\libigl\eigen\Eigen\IterativeLinearSolvers

     文件        645  2018-02-27 05:24  MeshFixer\hole_fixer-master\libigl\eigen\Eigen\Jacobi

     文件        712  2018-02-27 05:24  MeshFixer\hole_fixer-master\libigl\eigen\Eigen\LeastSquares

     文件        983  2018-02-27 05:24  MeshFixer\hole_fixer-master\libigl\eigen\Eigen\LU

     文件        697  2018-02-27 05:24  MeshFixer\hole_fixer-master\libigl\eigen\Eigen\MetisSupport

     文件       2189  2018-02-27 05:24  MeshFixer\hole_fixer-master\libigl\eigen\Eigen\OrderingMethods

     文件        864  2018-02-27 05:24  MeshFixer\hole_fixer-master\libigl\eigen\Eigen\PardisoSupport

     文件       1467  2018-02-27 05:24  MeshFixer\hole_fixer-master\libigl\eigen\Eigen\PaStiXSupport

     文件        926  2018-02-27 05:24  MeshFixer\hole_fixer-master\libigl\eigen\Eigen\QR

     文件        637  2018-02-27 05:24  MeshFixer\hole_fixer-master\libigl\eigen\Eigen\QtAlignedMalloc

............此处省略1697个文件信息

评论

共有 条评论