File: interface_polyhedron.cpp

package info (click to toggle)
cgal 4.0-5
  • links: PTS
  • area: main
  • in suites: wheezy
  • size: 65,068 kB
  • sloc: cpp: 500,870; ansic: 102,544; sh: 321; python: 92; makefile: 75; xml: 2
file content (32 lines) | stat: -rw-r--r-- 864 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
24
25
26
27
28
29
30
31
32
#include <CGAL/Gmpz.h>
#include <CGAL/Homogeneous.h>
#include <CGAL/Polyhedron_3.h>
#include <CGAL/IO/Polyhedron_iostream.h>
#include <CGAL/Nef_polyhedron_3.h>
#include <CGAL/IO/Nef_polyhedron_iostream_3.h>
#include <iostream>

typedef CGAL::Homogeneous<CGAL::Gmpz>  Kernel;
typedef CGAL::Polyhedron_3<Kernel>  Polyhedron;
typedef CGAL::Nef_polyhedron_3<Kernel> Nef_polyhedron;
typedef Kernel::Vector_3  Vector_3;
typedef Kernel::Aff_transformation_3  Aff_transformation_3;

int main() {
  Polyhedron P;
  std::cin >> P;
  if(P.is_closed()) {
    Nef_polyhedron N1(P);
    Nef_polyhedron N2(N1);
    Aff_transformation_3 aff(CGAL::TRANSLATION, Vector_3(2,2,0,1));
    N2.transform(aff);
    N1 += N2;

    if(N1.is_simple()) {
      N1.convert_to_polyhedron(P);
      std::cout << P;
    }
    else
      std::cerr << "N1 is not a 2-manifold." << std::endl;
  }
}