您的位置:首页 > 其它

关于TRIANGLE二维三角网格生成器在windows下的配置说明

2014-06-18 21:21 423 查看
最近需要用到三角网格生成的一些东西,所以就把TRIANGLE这个库编译了一下,发现编译过程还是稍微有些纠结,于是就想到写下来,希望以后有些童鞋看到少走一些弯路。

首先非常感谢eryar的帮助,非常感谢!

在编译之前还是先看一下eryar的博文:

http://www.cnblogs.com/opencascade/p/3632705.html

我是在visual studio 2010 windows环境下面编译的。

刚开始磕磕绊绊的也编译完了,但是在c++下面是不能使用的,所以求助eryar才最后成功:

直接上代码吧,triangle头文件更改如下:



#ifndef _TRIANGLE_HEADER_
#define _TRIANGLE_HEADER_
#ifdef _cplusplus
extern "C"{
#endif///更改这里,博客加粗改颜色之后成代码了,不知为什么

#define REAL double
#define ANSI_DECLARATORS
#define VOID int
#include "triangle.h"

struct triangulateio {
  REAL *pointlist;                                               /* In / out */
  REAL *pointattributelist;                                      /* In / out */
  int *pointmarkerlist;                                          /* In / out */
  int numberofpoints;                                            /* In / out */
  int numberofpointattributes;                                   /* In / out */

  int *trianglelist;                                             /* In / out */
  REAL *triangleattributelist;                                   /* In / out */
  REAL *trianglearealist;                                         /* In only */
  int *neighborlist;                                             /* Out only */
  int numberoftriangles;                                         /* In / out */
  int numberofcorners;                                           /* In / out */
  int numberoftriangleattributes;                                /* In / out */

  int *segmentlist;                                              /* In / out */
  int *segmentmarkerlist;                                        /* In / out */
  int numberofsegments;                                          /* In / out */

  REAL *holelist;                        /* In / pointer to array copied out */
  int numberofholes;                                      /* In / copied out */

  REAL *regionlist;                      /* In / pointer to array copied out */
  int numberofregions;                                    /* In / copied out */

  int *edgelist;                                                 /* Out only */
  int *edgemarkerlist;            /* Not used with Voronoi diagram; out only */
  REAL *normlist;                /* Used only with Voronoi diagram; out only */
  int numberofedges;                                             /* Out only */
};

#ifdef ANSI_DECLARATORS
void triangulate(char *, struct triangulateio *, struct triangulateio *,struct triangulateio *);
void trifree(VOID *memptr);
#else /* not ANSI_DECLARATORS */
void triangulate();
void trifree();
#endif /* not ANSI_DECLARATORS */
#ifdef _cplusplus
}
#endif///更改这里,博客加粗改颜色之后成代码了,不知为什么
#endif


同时在triangle.c里面修改:

将:

/* #define NO_TIMER */

/* #define TRILIBRARY*/

改为:

#define NO_TIMER

#define TRILIBRARY

也就是将这两个宏定义打开就OK了。

成功生成lib库



内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: