Install cgal4.5.2 compute Geometry Library under Ubuntu

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.