Abstract: Cgal is an open-source computational geometry library that logs its compilation, installation, and usage methods.
1 Library Download
Site: http://www.cgal.org/
Download: Https://gforge.inria.fr/frs/download.php/file/34514/CGAL-4.5.2.zip
2 extracting, compiling and installing
Shell into the Unzip folder
1) Library configuration file Generation command:
CMake.
Tips for missing GMP and MPFR libraries
Install the Missing libraries:
sudo apt-get install Libgmp-dev Libmpfr-dev
Then CMake.
Prompt success
2) compiling
Make
Approx. 5 sec. compile complete
3) Installation
sudo make install
Header File Installation location:/usr/local/include/cgal/
Library file Location:/usr/local/lib/
The corresponding libraries are: libcgal.so, libcgal_imageio.so, libcgal_qt4.so, libcgal_core.so
3 Program Testing
Compilation: 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::P oint_2 point_2;typedef std::vector<point_2> Points;int Main () {Points Points, Result;points.push_back (Point_2 (0,0));p Oints.push_back (Point_2 (10,0));p Oints.push_back (Point_2 (10,10)); Points.push_back (Point_2 (6,5));p Oints.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;}
Compile:
Install cgal4.5.2 compute Geometry Library under Ubuntu