File: nef_2_construction.cpp

package info (click to toggle)
cgal 4.5-2
  • links: PTS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 69,700 kB
  • ctags: 118,537
  • sloc: cpp: 571,870; ansic: 110,997; sh: 725; python: 92; makefile: 87
file content (27 lines) | stat: -rw-r--r-- 798 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#include <CGAL/Exact_integer.h>
#include <CGAL/Filtered_extended_homogeneous.h>
#include <CGAL/Nef_polyhedron_2.h>

typedef CGAL::Exact_integer RT;
typedef CGAL::Filtered_extended_homogeneous<RT> Extended_kernel;
typedef CGAL::Nef_polyhedron_2<Extended_kernel> Nef_polyhedron;
typedef Nef_polyhedron::Point Point;
typedef Nef_polyhedron::Line  Line;

int main() {

  Nef_polyhedron N1(Nef_polyhedron::COMPLETE);

  Line l(2,4,2); // l : 2x + 4y + 2 = 0
  Nef_polyhedron N2(l,Nef_polyhedron::INCLUDED);
  Nef_polyhedron N3 = N2.complement();
  CGAL_assertion(N1 == N2.join(N3));

  Point p1(0,0), p2(10,10), p3(-20,15);
  Point triangle[3] = { p1, p2, p3 };
  Nef_polyhedron N4(triangle, triangle+3);
  Nef_polyhedron N5 = N2.intersection(N4);
  CGAL_assertion(N5 <= N2 && N5 <= N4);

  return 0;
}