MEPP2 Project
boolops_definitions.hpp
Go to the documentation of this file.
1 // Copyright (c) 2012-2019 University of Lyon and CNRS (France).
2 // All rights reserved.
3 //
4 // This file is part of MEPP2; you can redistribute it and/or modify
5 // it under the terms of the GNU General Public License as published
6 // by the Free Software Foundation; either version 3 of the License,
7 // or (at your option) any later version.
8 //
9 // This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
10 // WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
11 
12 #pragma once
13 
20 #include <CGAL/Gmpq.h>
21 #include <CGAL/Lazy_exact_nt.h>
22 
23 #include <chrono> // for time measurement
24 
25 
27 
28 
30 typedef typename EnrichedPolyhedron::Point_3 Point3d;
31 
32 
37 //#define BOOLEAN_OPERATIONS_DEBUG
38 
43 //#define BOOLEAN_OPERATIONS_DEBUG_VERBOSE
44 
49 #define BOOLEAN_OPERATIONS_TIME
50 
56 
61 typedef CGAL::Lazy_exact_nt<CGAL::Gmpq> num_type;
62 
67 typedef CGAL::Simple_cartesian<num_type> Exact_Kernel;
68 
73 typedef CGAL::Vector_3<Exact_Kernel> Vector_exact;
74 
79 typedef CGAL::Point_3<Exact_Kernel> Point3d_exact;
80 
88 {
89  return Point3d_exact(p.x(),p.y(),p.z());
90 }
91 
100 {
101  return Point3d(to_double(pe.x()),to_double(pe.y()),to_double(pe.z()));
102 }
103 
111 inline Vector_exact Compute_Normal_direction(Halfedge_handle he) // MT: suppression référence
112 {
113  return CGAL::cross_product(
114  point_to_exact(he->next()->vertex()->point()) -
115  point_to_exact(he->vertex()->point()),
116  point_to_exact(he->next()->next()->vertex()->point()) -
117  point_to_exact(he->vertex()->point()));
118 }
119 
127 inline double tr(double &n)
128 {
129  return floor(n*1000)/1000;
130 }
131 
139 inline double
141  std::chrono::time_point< std::chrono::steady_clock > &time_start)
142 {
143  auto time_now = std::chrono::steady_clock::now();
144  std::chrono::duration< double > duration = time_now - time_start;
145  time_start = time_now;
146 
147  return duration.count();
148 }
point_to_double
Point3d point_to_double(Point3d_exact &pe)
Convertion from a Point3d_exact (exact) to a Point3d (double)
Definition: boolops_definitions.hpp:99
num_type
CGAL::Lazy_exact_nt< CGAL::Gmpq > num_type
exact number type
Definition: boolops_definitions.hpp:61
tr
double tr(double &n)
Truncate a number to 1/1000 (only if BOOLEAN_OPERATIONS_DEBUG is enable)
Definition: boolops_definitions.hpp:127
boolops_enriched_polyhedron.hpp
FEVV::Math::Vector::cross_product
static std::vector< ElementType > cross_product(const ElementType v1[DIM], const ElementType v2[DIM])
Definition: MatrixOperations.hpp:460
Point3d_exact
CGAL::Point_3< Exact_Kernel > Point3d_exact
3d point using exact number type
Definition: boolops_definitions.hpp:79
Vector_exact
CGAL::Vector_3< Exact_Kernel > Vector_exact
3d vector using exact number type
Definition: boolops_definitions.hpp:73
point_to_exact
Point3d_exact point_to_exact(Point3d &p)
Convertion from a Point3d (double) to a Point3d_exact (exact)
Definition: boolops_definitions.hpp:87
MINUS
@ MINUS
Definition: boolops_definitions.hpp:55
Halfedge_handle
EnrichedPolyhedron::Halfedge_handle Halfedge_handle
Definition: boolops_definitions.hpp:29
Bool_Op
Bool_Op
The three Boolean operations.
Definition: boolops_definitions.hpp:55
Halfedge_handle
EnrichedPolyhedron::Halfedge_handle Halfedge_handle
Definition: boolops_cpolyhedron_builder.hpp:25
Exact_Kernel
CGAL::Simple_cartesian< num_type > Exact_Kernel
Kernel using exact number type.
Definition: boolops_definitions.hpp:67
Point3d
EnrichedPolyhedron::Point_3 Point3d
Definition: boolops_cpolyhedron_builder.hpp:27
Compute_Normal_direction
Vector_exact Compute_Normal_direction(Halfedge_handle he)
Definition: boolops_definitions.hpp:111
Point3d
EnrichedPolyhedron::Point_3 Point3d
Definition: boolops_definitions.hpp:30
INTER
@ INTER
Definition: boolops_definitions.hpp:55
UNION
@ UNION
Definition: boolops_definitions.hpp:55
get_time_and_reset
double get_time_and_reset(std::chrono::time_point< std::chrono::steady_clock > &time_start)
Measure time since starting time and reset starting time.
Definition: boolops_definitions.hpp:140