\( \newcommand{\E}{\mathrm{E}} \) \( \newcommand{\A}{\mathrm{A}} \) \( \newcommand{\R}{\mathrm{R}} \) \( \newcommand{\N}{\mathrm{N}} \) \( \newcommand{\Q}{\mathrm{Q}} \) \( \newcommand{\Z}{\mathrm{Z}} \) \( \def\ccSum #1#2#3{ \sum_{#1}^{#2}{#3} } \def\ccProd #1#2#3{ \sum_{#1}^{#2}{#3} }\)
CGAL 4.6.1 - 2D Polyline Simplification
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Groups Pages
Polyline_simplification_2/simplify_polygon.cpp
#include <iostream>
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
#include <CGAL/Polygon_2.h>
#include <CGAL/Polyline_simplification_2/simplify.h>
namespace PS = CGAL::Polyline_simplification_2;
typedef CGAL::Polygon_2<K> Polygon_2;
typedef PS::Stop_below_count_ratio_threshold Stop;
typedef PS::Squared_distance_cost Cost;
int main()
{
Polygon_2 polygon;
std::cin >> polygon;
Cost cost;
polygon = PS::simplify(polygon, cost, Stop(0.5));
std::cout.precision(12);
std::cout << polygon << std::endl;
return 0;
}