blob: 6cbb2518292cf743137f3d36adb22d2f7137ce5b (
plain)
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
|
#ifndef CGAL_H_
#define CGAL_H_
#ifdef ENABLE_CGAL
#include <CGAL/Gmpq.h>
#include <CGAL/Extended_cartesian.h>
#include <CGAL/Nef_polyhedron_2.h>
#include <CGAL/Cartesian.h>
#include <CGAL/Polyhedron_3.h>
#include <CGAL/Nef_polyhedron_3.h>
#include <CGAL/IO/Polyhedron_iostream.h>
typedef CGAL::Extended_cartesian<CGAL::Gmpq> CGAL_Kernel2;
typedef CGAL::Nef_polyhedron_2<CGAL_Kernel2> CGAL_Nef_polyhedron2;
typedef CGAL_Kernel2::Aff_transformation_2 CGAL_Aff_transformation2;
typedef CGAL::Cartesian<CGAL::Gmpq> CGAL_Kernel3;
typedef CGAL::Polyhedron_3<CGAL_Kernel3> CGAL_Polyhedron;
typedef CGAL_Polyhedron::HalfedgeDS CGAL_HDS;
typedef CGAL::Polyhedron_incremental_builder_3<CGAL_HDS> CGAL_Polybuilder;
typedef CGAL::Nef_polyhedron_3<CGAL_Kernel3> CGAL_Nef_polyhedron3;
typedef CGAL_Nef_polyhedron3::Aff_transformation_3 CGAL_Aff_transformation;
typedef CGAL_Nef_polyhedron3::Vector_3 CGAL_Vector;
typedef CGAL_Nef_polyhedron3::Plane_3 CGAL_Plane;
typedef CGAL_Nef_polyhedron3::Point_3 CGAL_Point;
struct CGAL_Nef_polyhedron
{
int dim;
CGAL_Nef_polyhedron2 p2;
CGAL_Nef_polyhedron3 p3;
CGAL_Nef_polyhedron() {
dim = 0;
}
CGAL_Nef_polyhedron(const CGAL_Nef_polyhedron2 &p) {
dim = 2;
p2 = p;
}
CGAL_Nef_polyhedron(const CGAL_Nef_polyhedron3 &p) {
dim = 3;
p3 = p;
}
CGAL_Nef_polyhedron& operator+=(const CGAL_Nef_polyhedron &other) {
if (other.dim == 2) {
this->p2 += other.p2;
this->dim = 2;
}
if (other.dim == 3) {
this->p3 += other.p3;
this->dim = 3;
}
return *this;
}
CGAL_Nef_polyhedron& operator*=(const CGAL_Nef_polyhedron &other) {
if (other.dim == 2) {
this->p2 *= other.p2;
this->dim = 2;
}
if (other.dim == 3) {
this->p3 *= other.p3;
this->dim = 3;
}
return *this;
}
CGAL_Nef_polyhedron& operator-=(const CGAL_Nef_polyhedron &other) {
if (other.dim == 2) {
this->p2 -= other.p2;
this->dim = 2;
}
if (other.dim == 3) {
this->p3 -= other.p3;
this->dim = 3;
}
return *this;
}
int weight() {
if (dim == 2)
return p2.explorer().number_of_vertices();
if (dim == 3)
return p3.number_of_vertices();
return 0;
}
};
#endif /* ENABLE_CGAL */
#endif
|