初识CGAL

1.CGAL:概览

  CGAL,是由European Community成立的大型项目。目的是开发可以普遍应用于计算几何的一系列对象和函数,并使他们在应用领域和非专业人士可方便使用。

  CGAL项目致力于提供健壮(robust),灵活高效的代码。模板和特征类这些方法受STL的启发。

  项目由三部分组成:Kernel,basic library和support library。内核实现了基本的几何对象,例如点,线段,线和圆,和一些对象常见的谓词如Orientation()或者in_circle()检测,相交检测,等等。基本类库包含大量的几何数据结构和算法,例如多边形,三角形和平面地图,多面体,凸包,最小外接圆和椭圆。还有树例如kd-trees或者range-tree。支持类库考虑了CGAL和可视化系统的联系,例如GeomView,OpenInventor,LEDA Window或者OpenGL。它们中的一些特别适合三维对象的可视化。

  类库大约100,000行C++代码,可以链接其他的C++,C或者Fortan的类库。例如GMP 、LEDA。CGAL是一款强大的工具应用于个人程序开发,他提供了健壮的普遍存在的几何数据结构的实现。其中的两个就像Delaunay三角化和Voronoi图。特别关注对于简化几何配置的处理,这种配置往往是频繁的。需要强调的是健壮性并不阻碍效率,因为几何算法依赖于计算工具的技术发展水平。特别地,类库可以用来很好的理解几何算法如果工作通过显示对输入数据的插入、删除、更改产生的几何数据结构的变化。本Video包括两部分,首先,介绍CGAL如何使用或满足用户的需求实现三角化;第二,它展示一个方便的工具,使用3DViewer和一个多线程设计来调试几何代码。

2.使用CGAL编程

在CGAL中,灵活健壮的主干通过使用对象技术和方便的计算工具。为了更好的理解CGAL的特征从灵活和先进的通用编程技术,我们展示一个2D三角网如何被实例化。


1.CGAL(Computational Geometry Algorithms Library,计算几何算法库)

  设计目标是,以C++库的形式提供方便,高效,可靠的几何算法。

  CGAL可用于各种需要几何计算的领域,如计算机图形学,科学可视化,计算机辅助设计和建模,地理信息系统,分子生物学,医学成像,机器人运动规划,网格生成,数值方法等等。

  计算几何算法库(CGAL),提供计算几何相关的数据结构和算法,诸如三角剖分(2D约束三角剖分及二维和三维Delaunay三角剖分),Voronoi图(二维和三维的点,2D加权Voronoi图,分割Voronoi图等),多边形(布尔操作,偏置),多面体(布尔运算),曲线整理及其应用,网格生成(二维Delaunay网格生成和三维表面和体积网格生成等),几何处理(表面网格简化,细分和参数化等),凸壳算法(2D,3D和dD),搜索结构(近邻搜索,kd树等),插值,形状分析,拟合,距离等。

The goal of the Cgal Open Source Project is to provide easy access to efficient and reliable geometric algorithms in the form of a C++library.

The Computational Geometry Algorithms Library offers data structures and algorithms like triangulations, Voronoi diagrams, Boolean operations on polygons and on polyhedra, arrangements of curves, mesh generation, geometry processing, convex hull algorithms, to name just a few.

All these data structures and algorithms operate on geometric objects like points and segments, and perform geometric tests on them. These objects and predicates are regrouped in Cgal Kernels.

Finally, the Cgal Support Library offers geometric object generators and spatial sorting functions, as well as a matrix search framework and a solver for linear and quadratic programs. It further offers interfaces to third party software such as the Gui libraries Qt, Geomview, and the Boost Graph Library.

2.CGAL依赖

CMake

  In order to configure, build, and install the Cgal libraries, examples and demos, you need CMake, a cross-platform ``makefile generator''. If CMake is not installed already you can obtain it from http://www.cmake.org/. CMake version 2.6.2 or higher is required. On Windows, CMake version 2.8.6 or higher is required, for a proper support of DLLs generation.

  CMake是一个跨平台的安装(编译)工具,可以用简单的语句来描述所有平台的安装(编译过程)。他能够输出各种各样的makefile或者project文件,能测试编译器所支持的C++特性,类似UNIX下的automake。只是 CMake 的组态档取名为 CmakeLists.txt。Cmake 并不直接建构出最终的软件,而是产生标准的建构档(如 Unix 的 Makefile 或 Windows Visual C++ 的 projects/workspaces),然后再依一般的建构方式使用。这使得熟悉某个集成开发环境(IDE)的开发者可以用标准的方式建构他的软件,这种可以使用各平台的原生建构系统的能力是 CMake 和 SCons 等其他类似系统的区别之处。

   CMake 可以编译源代码、制作程式库、产生适配器(wrapper)、还可以用任意的顺序建构执行档。CMake 支援 in-place 建构(二进档和源代码在同一个目录树中)和 out-of-place 建构(二进档在别的目录里),因此可以很容易从同一个源代码目录树中建构出多个二进档。CMake 也支援静态与动态程式库的建构。

  “CMake”这个名字是“cross platform make”的缩写。虽然名字中含有“make”,但是CMake和Unix上常见的“make”系统是分开的,而且更为高阶。

Boost

  The Boost libraries are a set of portable C++ source libraries. Most of Boostlibraries are header-only, but a few of them need to be compiled or installed as binaries.Cgal requires the Boost libraries. In particular the header files and the threading library (Boost.Threadbinaries. Version 1.39 (or higher) are needed.

  On Windows, as auto-linking is used, you also need the binaries of Boost.Serialization and Boost.DateTime, but the dependency is artificial and used only at link-time: the CGAL libraries do not depend on the DLLs of those two libraries.

  In Cgal some demos also depend on Boost.Program_options.

  In case the Boost libraries are not installed on your system already, you can obtain them from http://www.boost.org/. For Windows you can download an installer from http://www.boostpro.com/download/. Since Boost.Thread is required, make sure to either install the precompiled libraries for your compiler or build libboost-thread.

  As on Windows there is no canonical directory for where to find Boost, we recommend that you define the environment variable BOOST_ROOT and set it to where you have installed Boost, e.g., C:\boost\boost_1_41_0.

  Boost库是一个可移植、提供源代码的C++库,作为标准库的后备,是C++标准化进程的发动机之一。 Boost库由C++标准委员会库工作组成员发起,其中有些内容有望成为下一代C++标准库内容。在C++社区中影响甚大,是不折不扣的“准”标准库。Boost由于其对跨平台的强调,对标准C++的强调,与编写平台无关。大部分boost库功能的使用只需包括相应头文件即可,少数(如正则表达式库,文件系统库等)需要链接库。但Boost中也有很多是实验性质的东西,在实际的开发中实用需要谨慎。

Qt

  Qt is a cross-platform application and UI framework.Most Cgaldemos use Qt3 or Qt4. Having Qt4 version 4.3.0 or higher is recommended.

In case Qt is not yet installed on your system, you can download it from http://qt.nokia.com/.

  Qt是一个1991年由奇趣科技开发的跨平台C++图形用户界面应用程序开发框架。它既可以开发GUI程式,也可用于开发非GUI程式,比如控制台工具和服务器。Qt是面向对象语言,易于扩展,并且允许组件编程。2008年,奇趣科技被诺基亚公司收购,QT也因此成为诺基亚旗下的编程语言工具。

文章未经说明均属原创,学习笔记可能有大段的引用,一般会注明参考文献。 欢迎大家留言交流,转载请注明出处。
原文地址:https://www.cnblogs.com/yhlx125/p/2612799.html