Ubuntu下安装cgal4.5.2计算几何库
2015-03-05 22:23
141 查看
摘要:cgal是一个开源的计算几何库, 博文记录了其编译、安装和使用方法。
1 库下载
站点:http://www.cgal.org/
下载:https://gforge.inria.fr/frs/download.php/file/34514/CGAL-4.5.2.zip
2 解压缩、编译与安装
shell下进入解压文件夹
1)库配置文件生成命令:
cmake .
提示缺少gmp和mpfr库
安装缺少的库:
sudo apt-get install libgmp-dev libmpfr-dev
然后cmake .
提示成功
2)编译
make
约5秒编译完成
3)安装
sudo make install
头文件安装位置:/usr/local/include/CGAL/
库文件位置:/usr/local/lib/
相应的库有:libCGAL.so, libCGAL_ImageIO.so, libCGAL_Qt4.so, libCGAL_Core.so
3 程序测试
//编译: g++ test.cpp -lCGAL -lCGAL_Core -lgmp
//-lmpfr
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
#include <CGAL/convex_hull_2.h>
#include <vector>
typedef CGAL::Exact_predicates_inexact_constructions_kernel K;
typedef K::Point_2 Point_2;
typedef std::vector<Point_2> Points;
int main()
{
Points points, result;
points.push_back(Point_2(0,0));
points.push_back(Point_2(10,0));
points.push_back(Point_2(10,10));
points.push_back(Point_2(6,5));
points.push_back(Point_2(4,1));
CGAL::convex_hull_2( points.begin(), points.end(), std::back_inserter(result) );
std::cout << result.size() << " points on the convex hull" << std::endl;
return 0;
}
1 库下载
站点:http://www.cgal.org/
下载:https://gforge.inria.fr/frs/download.php/file/34514/CGAL-4.5.2.zip
2 解压缩、编译与安装
shell下进入解压文件夹
1)库配置文件生成命令:
cmake .
提示缺少gmp和mpfr库
安装缺少的库:
sudo apt-get install libgmp-dev libmpfr-dev
然后cmake .
提示成功
2)编译
make
约5秒编译完成
3)安装
sudo make install
头文件安装位置:/usr/local/include/CGAL/
库文件位置:/usr/local/lib/
相应的库有:libCGAL.so, libCGAL_ImageIO.so, libCGAL_Qt4.so, libCGAL_Core.so
3 程序测试
//编译: g++ test.cpp -lCGAL -lCGAL_Core -lgmp
//-lmpfr
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
#include <CGAL/convex_hull_2.h>
#include <vector>
typedef CGAL::Exact_predicates_inexact_constructions_kernel K;
typedef K::Point_2 Point_2;
typedef std::vector<Point_2> Points;
int main()
{
Points points, result;
points.push_back(Point_2(0,0));
points.push_back(Point_2(10,0));
points.push_back(Point_2(10,10));
points.push_back(Point_2(6,5));
points.push_back(Point_2(4,1));
CGAL::convex_hull_2( points.begin(), points.end(), std::back_inserter(result) );
std::cout << result.size() << " points on the convex hull" << std::endl;
return 0;
}
//编译: g++ test.cpp -lCGAL -lCGAL_Core -lgmp
相关文章推荐
- 在ubuntu上安装CGAL+GSL(用于Sperical Harmonic)
- [转载]在Ubuntu下安装Python科学计算环境
- ubuntu环境下科学计算云平台安装配置
- ubuntu14.04 下安装 gsl 科学计算库
- Ubuntu 11.04安装gcc 4.5.2以下版本[比如gcc 4.1.1]
- ubuntu14.04安装cuda7.0 (Nvidia独显计算,Intel集显显示)
- ubuntu下安装python科学计算环境和机器学习的TensorFlow库
- Ubuntu安装python科学计算环境
- 记录ubuntu安装python科学计算工具包numpy
- Python科学计算包模块的安装(ubuntu)
- 云计算大赛准备之为ubuntu安装hadoop过程
- Ubuntu下安装python科学计算库
- 数学之路-python计算实战(1)-ubuntu安装pypy
- Ubuntu安装MPICH3集群计算环境
- 数学之路-python计算实战(1)-ubuntu安装pypy
- ubuntu安装Python环境以及科学计算环境
- 在ubuntu下安装一些python库做科学计算
- 在Ubuntu中安装Python科学计算环境 作者 : RY 标签: ubuntu
- 推荐计算几何的开源库CGAL