(1)VC文件->新建->项目->Win32项目(DLL-CGAL-CONVELL)
下一步->下一步->应用程序类型:DLL
(2)解决方案示图:
头文件:(右键)—》添加dtriangulate(.h),输入如下代码
#ifndef _DTRIANGULATE_H
#define _DTRIANGULATE_H
#ifdef _USRDLL
#define DLLAPI __declspec(dllexport)
#else
#define DLLAPI __declspec(dllimport)
#endif
//定义结构体点的类型
struct Point{
double x;
double y;
double z;
};
//定义结构体三角形
struct Triangle{
Point p1;
Point p2;
Point p3;
};
DLLAPI int triangulate(Point *pts, int length, Point **outPts);
#endif
(3)在DLL-CGAL-CONVELL.cpp中输入如下代码:
// DLL-CGAL-CONVELL.cpp : 定义 DLL 应用程序的导出函数。
//
#include "stdafx.h"
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
#include <CGAL/convex_hull_2.h>
#include <vector>
#include "dtriangulate.