资源简介
Tetgen是一个生成四面体网格的开源工具,本实例提供了从网上下载的开源的源码和一个简单的使用的示例,其中附带了Tetgen自带了的一个查看剖分出来的网格的工具TetView.exe,可以运行打开剖分出来的文件查看剖分的结果是否正确。
代码片段和文件信息
#include “stdafx.h“
#include “tetgen.h“
int main()
{
tetgenio in out;
tetgenio::facet *f;
tetgenio::polygon *p;
int i;
// All indices start from 1.
in.firstnumber = 1;
in.numberofpoints = 16;
in.pointlist = new REAL[in.numberofpoints * 3];
in.pointlist[0] = 0; // node 1.
in.pointlist[1] = 0;
in.pointlist[2] = 0;
in.pointlist[3] = 2; // node 2.
in.pointlist[4] = 0;
in.pointlist[5] = 0;
in.pointlist[6] = 2; // node 3.
in.pointlist[7] = 2;
in.pointlist[8] = 0;
in.pointlist[9] = 0; // node 4.
in.pointlist[10] = 2;
in.pointlist[11] = 0;
// Set node 5 6 7 8.
for (i = 4; i < 8; i++) {
in.pointlist[i * 3] = in.pointlist[(i - 4) * 3];
in.pointlist[i * 3 + 1] = in.pointlist[(i - 4) * 3 + 1];
in.pointlist[i * 3 + 2] = 2;
}
in.pointlist[24] = 0.25;//node 9
in.pointlist[25] = 0.25;
in.pointlist[26] = 2;
in.pointlist[27] = 1.75;//node 10
in.pointlist[28] = 0.25;
in.pointlist[29] = 2;
in.pointlist[30] = 1.75;//node 11
in.pointlist[31] = 1.75;
in.pointlist[32] = 2;
in.pointlist[33] = 0.25;//node 12
in.pointlist[34] = 1.75;
in.pointlist[35] = 2;
in.pointlist[36] = 0.5;//node 13
in.pointlist[37] = 0.5;
in.pointlist[38] = 1;
in.pointlist[39] = 1.5;//node 14
in.pointlist[40] = 0.5;
in.pointlist[41] = 1;
in.pointlist[42] = 1.5;//node 15
in.pointlist[43] = 1.5;
in.pointlist[44] = 1;
in.pointlist[45] = 0.5;//node 16
in.pointlist[46] = 1.5;
in.pointlist[47] = 1;
in.numberoffacets = 14;
in.facetlist = new tetgenio::facet[in.numberoffacets];
in.facetmarkerlist = new int[in.numberoffacets];
// Facet 1. The leftmost facet.
f = &in.facetlist[0];
f->numberofpolygons = 1;
f->polygonlist = new tetgenio::polygon[f->numberofpolygons];
f->numberofholes = 0;
f->holelist = NULL;
p = &f->polygonlist[0];
p->numberofvertices = 4;
p->vertexlist = new int[p->numberofvertices];
p->vertexlist[0] = 1;
p->vertexlist[1] = 2;
p->vertexlist[2] = 3;
p->vertexlist[3] = 4;
// Facet 2. The bottom facet.
f = &in.facetlist[1];
f->numberofpolygons = 1;
f->polygonlist = new tetgenio::polygon[f->numberofpolygons];
f->numberofholes = 0;
f->holelist = NULL;
p = &f->polygonlist[0];
p->numberofvertices = 4;
p->vertexlist = new int[p->numberofvertices];
p->vertexlist[0] = 1;
p->vertexlist[1] = 5;
p->vertexlist[2] = 6;
p->vertexlist[3] = 2;
// Facet 3. The back facet.
f = &in.facetlist[2];
f->numberofpolygons = 1;
f->polygonlist = new tetgenio::polygon[f->numberofpolygons];
f->numberofholes = 0;
f->holelist = NULL;
p = &f->polygonlist[0];
p->numberofvertices = 4;
p->vertexlist = new int[p->numberofvertices];
p->vertexlist[0] = 2;
p->vertexlist[1] = 6;
p->vertexlist[2] = 7;
p->vertexlist[3] = 3;
// Facet 4. The top facet.
f = &in.facetlist[3];
f->numberofpolygons = 1;
f->polygonlist = new tetgenio::polygon[f->numberofpolygons];
f->numberofholes = 0;
f->holelist = NULL;
p = &
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 926208 2011-08-02 15:09 TetgenTest\Debug\TetgenTest.exe
文件 903968 2011-08-02 15:09 TetgenTest\Debug\TetgenTest.ilk
文件 1952768 2011-08-02 15:09 TetgenTest\Debug\TetgenTest.pdb
文件 252 2011-08-02 14:57 TetgenTest\TetgenTest\barin.node
文件 493 2011-08-02 14:57 TetgenTest\TetgenTest\barin.poly
文件 23432 2011-08-02 14:57 TetgenTest\TetgenTest\barout.ele
文件 11828 2011-08-02 14:57 TetgenTest\TetgenTest\barout.face
文件 7047 2011-08-02 14:57 TetgenTest\TetgenTest\barout.node
文件 7662 2011-08-02 15:09 TetgenTest\TetgenTest\Debug\BuildLog.htm
文件 21449 2011-08-02 15:09 TetgenTest\TetgenTest\Debug\main.obj
文件 65 2011-08-02 15:09 TetgenTest\TetgenTest\Debug\mt.dep
文件 300706 2011-08-02 13:12 TetgenTest\TetgenTest\Debug\predicates.obj
文件 12421 2011-08-02 13:12 TetgenTest\TetgenTest\Debug\stdafx.obj
文件 1563083 2011-08-02 13:12 TetgenTest\TetgenTest\Debug\tetgen.obj
文件 663 2011-08-02 09:54 TetgenTest\TetgenTest\Debug\TetgenTest.exe.em
文件 728 2011-08-02 09:54 TetgenTest\TetgenTest\Debug\TetgenTest.exe.em
文件 621 2011-08-02 15:09 TetgenTest\TetgenTest\Debug\TetgenTest.exe.intermediate.manifest
文件 21331 2011-08-02 11:46 TetgenTest\TetgenTest\Debug\TetgenTest.obj
文件 3211264 2011-08-02 13:12 TetgenTest\TetgenTest\Debug\TetgenTest.pch
文件 273408 2011-08-02 15:09 TetgenTest\TetgenTest\Debug\vc90.idb
文件 331776 2011-08-02 15:09 TetgenTest\TetgenTest\Debug\vc90.pdb
文件 7947 2011-08-02 15:09 TetgenTest\TetgenTest\main.cpp
文件 176379 2011-04-12 15:45 TetgenTest\TetgenTest\predicates.cxx
文件 1201 2011-08-02 08:46 TetgenTest\TetgenTest\ReadMe.txt
文件 215 2011-08-02 13:06 TetgenTest\TetgenTest\stdafx.cpp
文件 315 2011-08-02 13:12 TetgenTest\TetgenTest\stdafx.h
文件 498 2011-08-02 08:46 TetgenTest\TetgenTest\targetver.h
文件 1254291 2011-08-02 12:04 TetgenTest\TetgenTest\tetgen.cxx
文件 142168 2011-08-02 11:03 TetgenTest\TetgenTest\tetgen.h
文件 4689 2011-08-02 13:04 TetgenTest\TetgenTest\TetgenTest.vcproj
............此处省略12个文件信息
- 上一篇:轻松Scrum之旅:敏捷开发故事.pdf
- 下一篇:超市管理系统.zip
评论
共有 条评论