(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.h"
typedef CGAL::Exact_predicates_inexact_constructions_kernel K

该教程详细介绍了如何在Visual Studio 2008中创建一个动态链接库(DLL),该库利用CGAL库计算二维点集的凸包。首先创建一个Win32 DLL项目,然后定义结构体和导出函数,接着实现CGAL的convex_hull_2函数来计算凸包,并将结果转换回原始点结构体。最后,配置项目的附加库目录以链接到CGAL库。
最低0.47元/天 解锁文章
406

被折叠的 条评论
为什么被折叠?



