File: regularize_simple.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-- 772 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_segments.h>

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

int main() {

  // Create input segments.
  std::vector<Segment_2> segments = {
    Segment_2(Point_2(0.2, 0.0), Point_2(1.2, 0.0)),
    Segment_2(Point_2(1.2, 0.1), Point_2(2.2, 0.1)),
    Segment_2(Point_2(2.2, 0.0), Point_2(2.0, 2.0)),
    Segment_2(Point_2(2.0, 2.0), Point_2(1.0, 2.0)),
    Segment_2(Point_2(1.0, 1.9), Point_2(0.0, 1.9)),
    Segment_2(Point_2(0.0, 2.0), Point_2(0.2, 0.0))
  };

  // Regularize all segments: both angles and offsets.
  CGAL::Shape_regularization::Segments::
    regularize_segments(segments);
}