summaryrefslogtreecommitdiff
path: root/src/cgal.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/cgal.h')
-rw-r--r--src/cgal.h89
1 files changed, 16 insertions, 73 deletions
diff --git a/src/cgal.h b/src/cgal.h
index f9161cc..26d64ae 100644
--- a/src/cgal.h
+++ b/src/cgal.h
@@ -3,6 +3,14 @@
#ifdef ENABLE_CGAL
+#ifdef _MSC_VER
+// see http://en.wikipedia.org/wiki/Stdint.h
+// and http://www.mpfr.org/mpfr-2.4.2/#stdint
+#include <boost/cstdint.hpp>
+using boost::intmax_t;
+using boost::uintmax_t;
+#endif
+
#include <CGAL/Gmpq.h>
#include <CGAL/Extended_cartesian.h>
#include <CGAL/Nef_polyhedron_2.h>
@@ -14,87 +22,22 @@
#include <CGAL/Polygon_2.h>
#include <CGAL/Polygon_with_holes_2.h>
-typedef CGAL::Extended_cartesian<CGAL::Gmpq> CGAL_Kernel2;
+typedef CGAL::Gmpq NT;
+typedef CGAL::Extended_cartesian<NT> 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;
typedef CGAL::Exact_predicates_exact_constructions_kernel CGAL_ExactKernel2;
typedef CGAL::Polygon_2<CGAL_ExactKernel2> CGAL_Poly2;
typedef CGAL::Polygon_with_holes_2<CGAL_ExactKernel2> CGAL_Poly2h;
-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;
- }
+typedef CGAL::Cartesian<NT> CGAL_Kernel3;
+typedef CGAL::Nef_polyhedron_3<CGAL_Kernel3> CGAL_Nef_polyhedron3;
+typedef CGAL_Nef_polyhedron3::Aff_transformation_3 CGAL_Aff_transformation;
- int weight() {
- if (dim == 2)
- return p2.explorer().number_of_vertices();
- if (dim == 3)
- return p3.number_of_vertices();
- return 0;
- }
-};
+typedef CGAL::Polyhedron_3<CGAL_Kernel3> CGAL_Polyhedron;
+typedef CGAL_Polyhedron::HalfedgeDS CGAL_HDS;
+typedef CGAL::Polyhedron_incremental_builder_3<CGAL_HDS> CGAL_Polybuilder;
#endif /* ENABLE_CGAL */
contact: Jan Huwald // Impressum