File: regularize_contour.cpp

package info (click to toggle)
cgal 6.0.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 141,840 kB
  • sloc: cpp: 797,081; ansic: 203,398; sh: 490; python: 411; makefile: 286; javascript: 174
file content (23 lines) | stat: -rw-r--r-- 611 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#include <CGAL/Simple_cartesian.h>
#include <CGAL/Shape_regularization/regularize_contours.h>

using Kernel  = CGAL::Simple_cartesian<double>;
using Point_2 = typename Kernel::Point_2;

int main() {

  // Create input contour.
  const std::vector<Point_2> contour = {
    Point_2(0.00,  0.00),
    Point_2(0.50, -0.05),
    Point_2(1.00,  0.00),
    Point_2(1.05,  0.50),
    Point_2(1.00,  1.00),
    Point_2(0.00,  1.00)
  };

  // Regularize this contour.
  std::vector<Point_2> regularized;
  CGAL::Shape_regularization::Contours::
    regularize_closed_contour(contour, std::back_inserter(regularized));
}