diff --git a/BGL/include/CGAL/boost/graph/parameters_interface.h b/BGL/include/CGAL/boost/graph/parameters_interface.h index 31209cf8a42..7a95000a38e 100644 --- a/BGL/include/CGAL/boost/graph/parameters_interface.h +++ b/BGL/include/CGAL/boost/graph/parameters_interface.h @@ -222,6 +222,7 @@ CGAL_add_named_parameter(k_intersections_t, k_intersections, k_intersections) CGAL_add_named_parameter(n_subdivisions_t, n_subdivisions, n_subdivisions) CGAL_add_named_parameter(enlarge_bbox_ratio_t, enlarge_bbox_ratio, enlarge_bbox_ratio) CGAL_add_named_parameter(reorient_t, reorient, reorient) +CGAL_add_named_parameter(use_hybrid_mode_t, use_hybrid_mode, use_hybrid_mode) // region growing CGAL_add_named_parameter(k_neighbors_t, k_neighbors, k_neighbors) diff --git a/Kinetic_shape_reconstruction/examples/Kinetic_shape_reconstruction/include/Parameters.h b/Kinetic_shape_reconstruction/examples/Kinetic_shape_reconstruction/include/Parameters.h index 414c7237b50..8a10b32355f 100644 --- a/Kinetic_shape_reconstruction/examples/Kinetic_shape_reconstruction/include/Parameters.h +++ b/Kinetic_shape_reconstruction/examples/Kinetic_shape_reconstruction/include/Parameters.h @@ -1,5 +1,5 @@ -#ifndef CGAL_KSR_PARAMETERS_H -#define CGAL_KSR_PARAMETERS_H +#ifndef CGAL_KSR_ALL_PARAMETERS_EXAMPLES_H +#define CGAL_KSR_ALL_PARAMETERS_EXAMPLES_H // STL includes. #include @@ -8,7 +8,7 @@ namespace CGAL { namespace KSR { template - struct Parameters { + struct All_parameters { // Path to the input data file. std::string data; @@ -46,7 +46,7 @@ namespace KSR { FT graphcut_beta; // Constructor. - Parameters() : + All_parameters() : data(""), gi("0"), bi("1"), ii("2"), vi("3"), // main parameters @@ -80,4 +80,4 @@ namespace KSR { } // KSR } // CGAL -#endif // CGAL_KSR_PARAMETERS_H +#endif // CGAL_KSR_ALL_PARAMETERS_EXAMPLES_H diff --git a/Kinetic_shape_reconstruction/examples/Kinetic_shape_reconstruction/kinetic_precomputed_shapes_example.cpp b/Kinetic_shape_reconstruction/examples/Kinetic_shape_reconstruction/kinetic_precomputed_shapes_example.cpp index c314e98a5bd..435f66a96ab 100644 --- a/Kinetic_shape_reconstruction/examples/Kinetic_shape_reconstruction/kinetic_precomputed_shapes_example.cpp +++ b/Kinetic_shape_reconstruction/examples/Kinetic_shape_reconstruction/kinetic_precomputed_shapes_example.cpp @@ -96,7 +96,8 @@ int main(const int argc, const char** argv) { k_intersections(k). n_subdivisions(subdiv). enlarge_bbox_ratio(eratio). - reorient(orient)); + reorient(orient). + use_hybrid_mode(true)); assert(is_ksr_success); const std::string success = is_ksr_success ? "SUCCESS" : "FAILED"; timer.stop(); diff --git a/Kinetic_shape_reconstruction/examples/Kinetic_shape_reconstruction/kinetic_reconstruction_example.cpp b/Kinetic_shape_reconstruction/examples/Kinetic_shape_reconstruction/kinetic_reconstruction_example.cpp index 63c8d19bc7e..39fb68101cb 100644 --- a/Kinetic_shape_reconstruction/examples/Kinetic_shape_reconstruction/kinetic_reconstruction_example.cpp +++ b/Kinetic_shape_reconstruction/examples/Kinetic_shape_reconstruction/kinetic_reconstruction_example.cpp @@ -28,7 +28,7 @@ using Semantic_map = CGAL::KSR::Semantic_from_label_map; using KSR = CGAL::Kinetic_shape_reconstruction_3; -using Parameters = CGAL::KSR::Parameters; +using Parameters = CGAL::KSR::All_parameters; using Terminal_parser = CGAL::KSR::Terminal_parser; using Timer = CGAL::Real_timer; diff --git a/Kinetic_shape_reconstruction/include/CGAL/KSR/conversions.h b/Kinetic_shape_reconstruction/include/CGAL/KSR/conversions.h new file mode 100644 index 00000000000..3bdffde8c31 --- /dev/null +++ b/Kinetic_shape_reconstruction/include/CGAL/KSR/conversions.h @@ -0,0 +1,29 @@ +// Copyright (c) 2021 GeometryFactory SARL (France). +// All rights reserved. +// +// This file is part of CGAL (www.cgal.org). +// +// $URL$ +// $Id$ +// SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-Commercial +// +// +// Author(s) : Dmitry Anisimov + +#ifndef CGAL_KSR_CONVERSIONS_H +#define CGAL_KSR_CONVERSIONS_H + +// #include + +// STL includes. +#include +#include + +namespace CGAL { +namespace KSR { + + +} // namespace KSR +} // namespace CGAL + +#endif // CGAL_KSR_CONVERSIONS_H diff --git a/Kinetic_shape_reconstruction/include/CGAL/KSR/parameters.h b/Kinetic_shape_reconstruction/include/CGAL/KSR/parameters.h new file mode 100644 index 00000000000..f3126b9aa3e --- /dev/null +++ b/Kinetic_shape_reconstruction/include/CGAL/KSR/parameters.h @@ -0,0 +1,44 @@ +// Copyright (c) 2021 GeometryFactory SARL (France). +// All rights reserved. +// +// This file is part of CGAL (www.cgal.org). +// +// $URL$ +// $Id$ +// SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-Commercial +// +// +// Author(s) : Dmitry Anisimov + +#ifndef CGAL_KSR_PARAMETERS_H +#define CGAL_KSR_PARAMETERS_H + +// #include + +namespace CGAL { +namespace KSR { + +template +struct Parameters_3 { + + unsigned int k = 1; // k intersections + unsigned int n = 0; // n subdivisions + + FT enlarge_bbox_ratio = FT(11) / FT(10); // ratio to enlarge bbox + + bool reorient = false; // true - optimal bounding box, false - axis aligned + bool use_hybrid_mode = false; // true - apply exact interesections while all other computations are inexact + + bool verbose = true; // print basic verbose information + bool debug = false; // print all steps and substeps + export initial and final configurations + bool export_all = false; // export all intermediate configurations and events + + // See also global tolerance inside utils.h! + Parameters_3(const bool v = true, const bool d = false, const bool e = false) : + verbose(v), debug(d), export_all(e) { } +}; + +} // namespace KSR +} // namespace CGAL + +#endif // CGAL_KSR_PARAMETERS_H diff --git a/Kinetic_shape_reconstruction/include/CGAL/KSR/utils.h b/Kinetic_shape_reconstruction/include/CGAL/KSR/utils.h index 634e65bffa5..53fdd45c96d 100644 --- a/Kinetic_shape_reconstruction/include/CGAL/KSR/utils.h +++ b/Kinetic_shape_reconstruction/include/CGAL/KSR/utils.h @@ -88,7 +88,7 @@ point_3_from_point_2(const Point_2& point_2) { point_2.x(), point_2.y(), typename Kernel_traits::Kernel::FT(0)); } -// Tolerance. +// Global tolerance. template static FT tolerance() { return FT(1) / FT(100000); diff --git a/Kinetic_shape_reconstruction/include/CGAL/KSR_3/Data_structure.h b/Kinetic_shape_reconstruction/include/CGAL/KSR_3/Data_structure.h index f42b1a31813..72d43117d97 100644 --- a/Kinetic_shape_reconstruction/include/CGAL/KSR_3/Data_structure.h +++ b/Kinetic_shape_reconstruction/include/CGAL/KSR_3/Data_structure.h @@ -22,6 +22,7 @@ #include #include #include +#include #include #include @@ -46,7 +47,9 @@ private: using Triangle_2 = typename Kernel::Triangle_2; using Line_2 = typename Kernel::Line_2; using Plane_3 = typename Kernel::Plane_3; - using Polygon_2 = CGAL::Polygon_2; + + using Polygon_2 = CGAL::Polygon_2; + using Parameters = KSR::Parameters_3; public: using Support_plane = KSR_3::Support_plane; @@ -201,9 +204,9 @@ private: using Limit_line = std::vector< std::pair< std::pair, bool> >; std::vector m_limit_lines; + const Parameters& m_parameters; FT m_previous_time; FT m_current_time; - bool m_verbose; std::vector m_volumes; std::map m_volume_level_map; @@ -212,10 +215,10 @@ private: Reconstructed_model m_reconstructed_model; public: - Data_structure(const bool verbose) : + Data_structure(const Parameters& parameters) : + m_parameters(parameters), m_previous_time(FT(0)), - m_current_time(FT(0)), - m_verbose(verbose) + m_current_time(FT(0)) { } /******************************* @@ -346,7 +349,7 @@ public: // pairs.push_back(std::make_pair(std::make_pair(sp_idx_2, sp_idx_1), false)); ++num_1_intersected; - // if (m_verbose) { + // if (m_parameters.debug) { // std::cout << "pair 1: " << std::to_string(sp_idx_1) << "/" << std::to_string(sp_idx_2) << std::endl; // } // CGAL_assertion_msg(false, "TODO: 1 POLYGON IS INTERSECTED!"); @@ -363,7 +366,7 @@ public: pairs.push_back(std::make_pair(std::make_pair(sp_idx_1, sp_idx_2), false)); pairs.push_back(std::make_pair(std::make_pair(sp_idx_2, sp_idx_1), false)); ++num_2_intersected; - // if (m_verbose) { + // if (m_parameters.debug) { // std::cout << "pair 1: " << std::to_string(sp_idx_1) << "/" << std::to_string(sp_idx_2) << std::endl; // std::cout << "pair 2: " << std::to_string(sp_idx_2) << "/" << std::to_string(sp_idx_1) << std::endl; // } @@ -377,7 +380,7 @@ public: } } - if (m_verbose) { + if (m_parameters.debug) { std::cout << "- num 1 intersected: " << num_1_intersected << std::endl; std::cout << "- num 2 intersected: " << num_2_intersected << std::endl; } @@ -1085,14 +1088,14 @@ public: } } - if (m_verbose) { + if (m_parameters.debug) { std::cout << "- iedges, front: " << fiedges.size() << std::endl; for (const auto& fiedge : fiedges) { std::cout << str(fiedge) << ": " << segment_3(fiedge) << std::endl; } } - if (m_verbose ) { + if (m_parameters.debug ) { std::cout << "- iedges, back: " << biedges.size() << std::endl; for (const auto& biedge : biedges) { std::cout << str(biedge) << ": " << segment_3(biedge) << std::endl; @@ -1103,7 +1106,7 @@ public: const std::pair front_and_back_34(const PVertex& pvertex) { - if (m_verbose) std::cout << "- front back 34 case" << std::endl; + if (m_parameters.debug) std::cout << "- front back 34 case" << std::endl; PVertex front, back; const std::size_t sp_idx = pvertex.first; CGAL_assertion(sp_idx != KSR::no_element()); @@ -1125,7 +1128,7 @@ public: const std::pair front_and_back_5( const PVertex& pvertex1, const PVertex& pvertex2) { - if (m_verbose) std::cout << "- front back 5 case" << std::endl; + if (m_parameters.debug) std::cout << "- front back 5 case" << std::endl; PVertex front, back; CGAL_assertion(pvertex1.first == pvertex2.first); const std::size_t sp_idx = pvertex1.first; @@ -1308,7 +1311,7 @@ public: std::vector< std::pair >& iedges, std::vector& pvertices) { - if (m_verbose) { + if (m_parameters.debug) { std::cout << "**** traversing iedges global" << std::endl; std::cout << "- k intersections before: " << this->k(pvertex.first) << std::endl; } @@ -1320,11 +1323,11 @@ public: for (std::size_t i = 0; i < iedges.size() - 1; ++i) { if (iedges[i].second) { - if (m_verbose) { + if (m_parameters.debug) { std::cout << "- break iedge " << std::to_string(i) << std::endl; } break; } else { - if (m_verbose) { + if (m_parameters.debug) { std::cout << "- handle iedge " << std::to_string(i) << std::endl; } } @@ -1343,20 +1346,20 @@ public: is_limit_line = update_limit_lines_and_k(pvertex, iedge_i, is_occupied_iedge); } - if (m_verbose) { + if (m_parameters.debug) { std::cout << "- bbox: " << is_bbox_reached << "; " << " limit: " << is_limit_line << "; " << " occupied: " << is_occupied_iedge << std::endl; } if (is_bbox_reached) { - if (m_verbose) std::cout << "- bbox, stop" << std::endl; + if (m_parameters.debug) std::cout << "- bbox, stop" << std::endl; break; } else if (is_limit_line) { - if (m_verbose) std::cout << "- limit, stop" << std::endl; + if (m_parameters.debug) std::cout << "- limit, stop" << std::endl; break; } else { - if (m_verbose) std::cout << "- free, any k, continue" << std::endl; + if (m_parameters.debug) std::cout << "- free, any k, continue" << std::endl; const std::size_t ip = i + 1; const auto& iedge_ip = iedges[ip].first; CGAL_assertion_msg(KSR::distance( @@ -1376,7 +1379,7 @@ public: iedges.back().second = true; } - if (m_verbose) { + if (m_parameters.debug) { std::cout << "- num added pfaces: " << num_added_pfaces << std::endl; std::cout << "- k intersections after: " << this->k(pvertex.first) << std::endl; } @@ -1392,14 +1395,14 @@ public: const bool is_open, const bool reverse, const std::size_t idx, const IEdge& iedge, std::vector& pvertices) { - if (m_verbose) { + if (m_parameters.debug) { std::cout << "- adding new pface: " << std::endl; } // The first pvertex of the new triangle. const auto& pv1 = pvertices[idx]; CGAL_assertion(pv1 != null_pvertex()); - if (m_verbose) { + if (m_parameters.debug) { std::cout << "- pv1 " << str(pv1) << ": " << point_3(pv1) << std::endl; } @@ -1416,7 +1419,7 @@ public: pv2 = pvertices[idx + 1]; } CGAL_assertion(pv2 != null_pvertex()); - if (m_verbose) { + if (m_parameters.debug) { std::cout << "- pv2 " << str(pv2) << ": " << point_3(pv2) << std::endl; } @@ -1434,28 +1437,28 @@ public: const bool is_open, const std::size_t idx, const IEdge& iedge, std::vector& pvertices) { - if (m_verbose) std::cout << "- creating new pvertex" << std::endl; + if (m_parameters.debug) std::cout << "- creating new pvertex" << std::endl; bool is_parallel = false; Point_2 future_point; Vector_2 future_direction; if (!is_open) { - if (m_verbose) std::cout << "- handling back/front case" << std::endl; + if (m_parameters.debug) std::cout << "- handling back/front case" << std::endl; is_parallel = compute_future_point_and_direction( 0, ivertex, pv_prev, pv_next, iedge, future_point, future_direction); if (is_parallel) { - if (m_verbose) std::cout << "- new pvertex, back/front, parallel/reverse case" << std::endl; + if (m_parameters.debug) std::cout << "- new pvertex, back/front, parallel/reverse case" << std::endl; CGAL_assertion_msg(!is_parallel, "TODO: CREATE PVERTEX, BACK/FRONT, ADD PARALLEL CASE!"); } else { - if (m_verbose) std::cout << "- new pvertex, back/front, standard case" << std::endl; + if (m_parameters.debug) std::cout << "- new pvertex, back/front, standard case" << std::endl; } } else { - if (m_verbose) std::cout << "- handling open case" << std::endl; + if (m_parameters.debug) std::cout << "- handling open case" << std::endl; is_parallel = compute_future_point_and_direction( pvertex, ivertex, pv_prev, pv_next, iedge, future_point, future_direction); if (is_parallel) { - if (m_verbose) std::cout << "- new pvertex, open, parallel/reverse case" << std::endl; + if (m_parameters.debug) std::cout << "- new pvertex, open, parallel/reverse case" << std::endl; IEdge prev_iedge = null_iedge(); IEdge next_iedge = null_iedge(); @@ -1467,21 +1470,21 @@ public: } if (prev_iedge == iedge) { - if (m_verbose) std::cout << "- new pvertex, open, prev, parallel case" << std::endl; + if (m_parameters.debug) std::cout << "- new pvertex, open, prev, parallel case" << std::endl; CGAL_assertion_msg(!is_parallel, "TODO: CREATE_PVERTEX, OPEN, PREV, ADD PARALLEL CASE!"); } else { - if (m_verbose) std::cout << "- new pvertex, open, prev, standard case" << std::endl; + if (m_parameters.debug) std::cout << "- new pvertex, open, prev, standard case" << std::endl; } if (next_iedge == iedge) { - if (m_verbose) std::cout << "- new pvertex, open, next, parallel case" << std::endl; + if (m_parameters.debug) std::cout << "- new pvertex, open, next, parallel case" << std::endl; CGAL_assertion_msg(!is_parallel, "TODO: CREATE_PVERTEX, OPEN, NEXT, ADD PARALLEL CASE!"); } else { - if (m_verbose) std::cout << "- new pvertex, open, next, standard case" << std::endl; + if (m_parameters.debug) std::cout << "- new pvertex, open, next, standard case" << std::endl; } CGAL_assertion_msg(!is_parallel, "TODO: CREATE_PVERTEX, OPEN, ADD PARALLEL CASE!"); } else { - if (m_verbose) std::cout << "- new pvertex, open, standard case" << std::endl; + if (m_parameters.debug) std::cout << "- new pvertex, open, standard case" << std::endl; } } @@ -1689,9 +1692,6 @@ public: bool is_active(const PVertex& pvertex) const { return support_plane(pvertex).is_active(pvertex.second); } - bool is_verbose() const { return m_verbose; } - void set_verbose(const bool verbose) { m_verbose = verbose; } - void deactivate(const PVertex& pvertex) { support_plane(pvertex).set_active(pvertex.second, false); @@ -2021,7 +2021,7 @@ public: std::vector pvertices_around_ivertex( const PVertex& pvertex, const IVertex& ivertex) const { - if (m_verbose) { + if (m_parameters.debug) { std::cout.precision(20); std::cout << "** searching pvertices around " << str(pvertex) << " wrt " << str(ivertex) << std::endl; std::cout << "- pvertex: " << point_3(pvertex) << std::endl; @@ -2031,7 +2031,7 @@ public: std::deque pvertices; pvertices.push_back(pvertex); - if (m_verbose) { + if (m_parameters.debug) { const auto iedge = this->iedge(pvertex); if (iedge != null_iedge()) { std::cout << "- came from: " << str(iedge) << " " << segment_3(iedge) << std::endl; @@ -2084,7 +2084,7 @@ public: // std::cout << "dot: " << dot_product << std::endl; if (dot_product < FT(0)) { - if (m_verbose) { + if (m_parameters.debug) { std::cout << "- " << str(current) << " is backwards" << std::endl; // std::cout << point_3(current) << std::endl; } @@ -2092,7 +2092,7 @@ public: } if (is_frozen(current)) { - if (m_verbose) { + if (m_parameters.debug) { std::cout << "- " << str(current) << " is frozen" << std::endl; // std::cout << point_3(current) << std::endl; } @@ -2102,7 +2102,7 @@ public: } if (previous_was_free && is_free) { - if (m_verbose) { + if (m_parameters.debug) { std::cout << "- " << str(current) << " has no iedge, stopping there" << std::endl; // std::cout << point_3(current) << std::endl; } @@ -2110,12 +2110,12 @@ public: } if (is_free) { - if (m_verbose) { + if (m_parameters.debug) { std::cout << "- " << str(current) << " has no iedge" << std::endl; // std::cout << point_3(current) << std::endl; } } else { - if (m_verbose) { + if (m_parameters.debug) { std::cout << "- " << str(current) << " has iedge " << str(iedge) << " from " << str(source(iedge)) << " to " << str(target(iedge)) << std::endl; // std::cout << segment_3(iedge) << std::endl; @@ -2148,7 +2148,7 @@ public: std::copy(pvertices.begin(), pvertices.end(), std::back_inserter(crossed_pvertices)); - if (m_verbose) { + if (m_parameters.debug) { std::cout << "- found " << crossed_pvertices.size() << " pvertices ready to be merged: " << std::endl; for (const auto& crossed_pvertex : crossed_pvertices) { @@ -2358,12 +2358,12 @@ public: if (is_ok_1 && is_ok_2) { is_limit_line = item.second; - if (m_verbose) std::cout << "- found intersection " << std::endl; + if (m_parameters.debug) std::cout << "- found intersection " << std::endl; return is_limit_line; } } - if (m_verbose) { + if (m_parameters.debug) { std::cout << "- first time intersection" << std::endl; std::cout << "- adding pair: " << std::to_string(sp_idx_1) << "-" << std::to_string(sp_idx_2); } @@ -2371,17 +2371,17 @@ public: CGAL_assertion(pairs.size() < 2); if (is_occupied_iedge) { if (this->k(pvertex.first) == 1) { - if (m_verbose) std::cout << ", occupied, TRUE" << std::endl; + if (m_parameters.debug) std::cout << ", occupied, TRUE" << std::endl; is_limit_line = true; pairs.push_back(std::make_pair(std::make_pair(sp_idx_1, sp_idx_2), is_limit_line)); } else { - if (m_verbose) std::cout << ", occupied, FALSE" << std::endl; + if (m_parameters.debug) std::cout << ", occupied, FALSE" << std::endl; is_limit_line = false; pairs.push_back(std::make_pair(std::make_pair(sp_idx_1, sp_idx_2), is_limit_line)); this->k(pvertex.first)--; } } else { - if (m_verbose) std::cout << ", free, FALSE" << std::endl; + if (m_parameters.debug) std::cout << ", free, FALSE" << std::endl; is_limit_line = false; pairs.push_back(std::make_pair(std::make_pair(sp_idx_1, sp_idx_2), is_limit_line)); } @@ -2415,7 +2415,7 @@ public: const FT vec_dot = vec1 * vec2; const bool is_reversed = (vec_dot < FT(0)); - if (is_reversed && m_verbose) { + if (is_reversed && m_parameters.debug) { std::cout << "- found reversed future direction" << std::endl; } return is_reversed; @@ -2879,7 +2879,7 @@ public: bool is_reversed = false; if (CGAL::abs(m1 - m3) >= tol) { - if (m_verbose) std::cout << "- prev intersected lines" << std::endl; + if (m_parameters.debug) std::cout << "- prev intersected lines" << std::endl; const bool is_a_found = KSR::intersection( future_line_prev, iedge_line, future_point_a); if (!is_a_found) { @@ -2888,7 +2888,7 @@ public: CGAL_assertion_msg(false, "TODO: CAN WE EVER BE HERE? WHY?"); } - if (m_verbose) { + if (m_parameters.debug) { std::cout << "- intersected point: " << to_3d(sp_idx, future_point_a) << std::endl; } @@ -2902,16 +2902,16 @@ public: } if (CGAL::abs(m1 - m3) < tol || is_reversed) { - if (m_verbose) std::cout << "- prev parallel lines" << std::endl; + if (m_parameters.debug) std::cout << "- prev parallel lines" << std::endl; is_parallel_prev = true; // Here, in the dot product, we can have maximum 1 zero-length vector. const FT prev_dot = current_vec_prev * iedge_vec; if (prev_dot < FT(0)) { - if (m_verbose) std::cout << "- prev moves backwards" << std::endl; + if (m_parameters.debug) std::cout << "- prev moves backwards" << std::endl; future_point_a = target_p; // std::cout << point_3(target(iedge)) << std::endl; } else { - if (m_verbose) std::cout << "- prev moves forwards" << std::endl; + if (m_parameters.debug) std::cout << "- prev moves forwards" << std::endl; future_point_a = source_p; // std::cout << point_3(source(iedge)) << std::endl; } @@ -2922,7 +2922,7 @@ public: CGAL_assertion(future_direction_a != Vector_2()); future_point_a = pinit - m_current_time * future_direction_a; - if (m_verbose) { + if (m_parameters.debug) { auto tmp_a = future_direction_a; tmp_a = KSR::normalize(tmp_a); std::cout << "- prev future point a: " << @@ -2932,7 +2932,7 @@ public: is_reversed = false; if (CGAL::abs(m2 - m3) >= tol) { - if (m_verbose) std::cout << "- next intersected lines" << std::endl; + if (m_parameters.debug) std::cout << "- next intersected lines" << std::endl; const bool is_b_found = KSR::intersection( future_line_next, iedge_line, future_point_b); if (!is_b_found) { @@ -2941,7 +2941,7 @@ public: CGAL_assertion_msg(false, "TODO: CAN WE EVER BE HERE? WHY?"); } - if (m_verbose) { + if (m_parameters.debug) { std::cout << "- intersected point: " << to_3d(sp_idx, future_point_b) << std::endl; } @@ -2955,16 +2955,16 @@ public: } if (CGAL::abs(m2 - m3) < tol || is_reversed) { - if (m_verbose) std::cout << "- next parallel lines" << std::endl; + if (m_parameters.debug) std::cout << "- next parallel lines" << std::endl; is_parallel_next = true; // Here, in the dot product, we can have maximum 1 zero-length vector. const FT next_dot = current_vec_next * iedge_vec; if (next_dot < FT(0)) { - if (m_verbose) std::cout << "- next moves backwards" << std::endl; + if (m_parameters.debug) std::cout << "- next moves backwards" << std::endl; future_point_b = target_p; // std::cout << point_3(target(iedge)) << std::endl; } else { - if (m_verbose) std::cout << "- next moves forwards" << std::endl; + if (m_parameters.debug) std::cout << "- next moves forwards" << std::endl; future_point_b = source_p; // std::cout << point_3(source(iedge)) << std::endl; } @@ -2975,7 +2975,7 @@ public: CGAL_assertion(future_direction_b != Vector_2()); future_point_b = pinit - m_current_time * future_direction_b; - if (m_verbose) { + if (m_parameters.debug) { auto tmp_b = future_direction_b; tmp_b = KSR::normalize(tmp_b); std::cout << "- next future point b: " << @@ -3100,9 +3100,9 @@ public: bool is_reversed = false; if (CGAL::abs(m2 - m3) >= tol) { - if (m_verbose) std::cout << "- back/front intersected lines" << std::endl; + if (m_parameters.debug) std::cout << "- back/front intersected lines" << std::endl; future_point = KSR::intersection(future_line_next, iedge_line); - if (m_verbose) { + if (m_parameters.debug) { std::cout << "- intersected point: " << to_3d(sp_idx, future_point) << std::endl; } @@ -3113,27 +3113,27 @@ public: } const FT back_front_distance = KSR::distance(pinit, future_point); - if (m_verbose) std::cout << "- back/front distance: " << back_front_distance << std::endl; + if (m_parameters.debug) std::cout << "- back/front distance: " << back_front_distance << std::endl; CGAL_assertion(back_front_distance >= FT(0)); // It can still miss this tolerance and then we enter parallel case and fail! const FT reversed_tol = tol * FT(1000); if (is_reversed && back_front_distance < reversed_tol) { is_reversed = false; - if (m_verbose) std::cout << "- back/front reversed, imprecise computation" << std::endl; + if (m_parameters.debug) std::cout << "- back/front reversed, imprecise computation" << std::endl; CGAL_assertion_msg(false, "TODO: BACK/FRONT HANDLE REVERSED CASE!"); } if (CGAL::abs(m2 - m3) < tol || is_reversed) { - if (m_verbose) std::cout << "- back/front parallel lines" << std::endl; + if (m_parameters.debug) std::cout << "- back/front parallel lines" << std::endl; is_parallel = true; // Here, in the dot product, we can have maximum 1 zero-length vector. const FT next_dot = current_vec_next * iedge_vec; if (next_dot < FT(0)) { - if (m_verbose) std::cout << "- back/front moves backwards" << std::endl; + if (m_parameters.debug) std::cout << "- back/front moves backwards" << std::endl; future_point = target_p; // std::cout << point_3(target(iedge)) << std::endl; } else { - if (m_verbose) std::cout << "- back/front moves forwards" << std::endl; + if (m_parameters.debug) std::cout << "- back/front moves forwards" << std::endl; future_point = source_p; // std::cout << point_3(source(iedge)) << std::endl; } @@ -3144,7 +3144,7 @@ public: CGAL_assertion(future_direction != Vector_2()); future_point = pinit - m_current_time * future_direction; - if (m_verbose) { + if (m_parameters.debug) { auto tmp = future_direction; tmp = KSR::normalize(tmp); std::cout << "- back/front future point: " << @@ -3222,9 +3222,9 @@ public: bool is_reversed = false; if (CGAL::abs(m2 - m3) >= tol) { - if (m_verbose) std::cout << "- open intersected lines" << std::endl; + if (m_parameters.debug) std::cout << "- open intersected lines" << std::endl; future_point = KSR::intersection(future_line_next, iedge_line); - if (m_verbose) { + if (m_parameters.debug) { std::cout << "- intersected point: " << to_3d(sp_idx, future_point) << std::endl; } @@ -3235,7 +3235,7 @@ public: } const FT open_distance = KSR::distance(pinit, future_point); - if (m_verbose) std::cout << "- open distance: " << open_distance << std::endl; + if (m_parameters.debug) std::cout << "- open distance: " << open_distance << std::endl; CGAL_assertion(open_distance >= FT(0)); // It can still miss this tolerance and then we enter parallel case and fail! const FT reversed_tol = tol * FT(1000); @@ -3244,19 +3244,19 @@ public: // auto nvec = Vector_2(future_point, pinit); // nvec = KSR::normalize(nvec); // future_point = pinit + tol * nvec; // not a valid solution, tested - if (m_verbose) std::cout << "- open reversed, imprecise computation" << std::endl; + if (m_parameters.debug) std::cout << "- open reversed, imprecise computation" << std::endl; CGAL_assertion_msg(false, "TODO: OPEN HANDLE REVERSED CASE!"); } if (CGAL::abs(m2 - m3) < tol || is_reversed) { - if (m_verbose) std::cout << "- open parallel lines" << std::endl; + if (m_parameters.debug) std::cout << "- open parallel lines" << std::endl; is_parallel = true; if (source_p == pv_point) { - if (m_verbose) std::cout << "- open moves backwards" << std::endl; + if (m_parameters.debug) std::cout << "- open moves backwards" << std::endl; future_point = target_p; // std::cout << point_3(target(iedge)) << std::endl; } else { - if (m_verbose) std::cout << "- open moves forwards" << std::endl; + if (m_parameters.debug) std::cout << "- open moves forwards" << std::endl; future_point = source_p; // std::cout << point_3(source(iedge)) << std::endl; } @@ -3267,7 +3267,7 @@ public: CGAL_assertion(future_direction != Vector_2()); future_point = pinit - m_current_time * future_direction; - if (m_verbose) { + if (m_parameters.debug) { auto tmp = future_direction; tmp = KSR::normalize(tmp); std::cout << "- open future point: " << @@ -3296,32 +3296,32 @@ public: const auto ibbox = isegment.bbox(); if (has_iedge(pvertex)) { - if (m_verbose) std::cout << "- constrained pvertex case" << std::endl; + if (m_parameters.debug) std::cout << "- constrained pvertex case" << std::endl; return false; } if (!is_active(pvertex)) { - if (m_verbose) std::cout << "- pvertex no active case" << std::endl; + if (m_parameters.debug) std::cout << "- pvertex no active case" << std::endl; return false; } if (!is_active(iedge)) { - if (m_verbose) std::cout << "- iedge no active case" << std::endl; + if (m_parameters.debug) std::cout << "- iedge no active case" << std::endl; return false; } if (!CGAL::do_overlap(pbbox, ibbox)) { - if (m_verbose) std::cout << "- no overlap case" << std::endl; + if (m_parameters.debug) std::cout << "- no overlap case" << std::endl; return false; } Point_2 point; if (!KSR::intersection(psegment, isegment, point)) { - if (m_verbose) std::cout << "- no intersection case" << std::endl; + if (m_parameters.debug) std::cout << "- no intersection case" << std::endl; return false; } - if (m_verbose) std::cout << "- found intersection" << std::endl; + if (m_parameters.debug) std::cout << "- found intersection" << std::endl; return true; } }; diff --git a/Kinetic_shape_reconstruction/include/CGAL/KSR_3/Finalizer.h b/Kinetic_shape_reconstruction/include/CGAL/KSR_3/Finalizer.h index 60f7c6f7eb7..85035fbe965 100644 --- a/Kinetic_shape_reconstruction/include/CGAL/KSR_3/Finalizer.h +++ b/Kinetic_shape_reconstruction/include/CGAL/KSR_3/Finalizer.h @@ -26,6 +26,8 @@ // Internal includes. #include #include +#include + #include namespace CGAL { @@ -100,10 +102,11 @@ private: using Face_handle = typename CDT::Face_handle; using Edge = typename CDT::Edge; + using Parameters = KSR::Parameters_3; + public: - Finalizer( - const bool verbose, const bool dprint, const bool debug, Data_structure& data) : - m_verbose(verbose), m_export(dprint), m_debug(debug), m_data(data) + Finalizer(Data_structure& data, const Parameters& parameters) : + m_data(data), m_parameters(parameters) { } void clean() { @@ -113,13 +116,13 @@ public: std::size_t num_hanging_pfaces = detect_hanging_pfaces(should_be_removed); if (num_hanging_pfaces >= stop_value) { - if (m_verbose) { + if (m_parameters.verbose) { std::cout << "* number of hanging pfaces: " << num_hanging_pfaces << std::endl; } if (should_be_removed) return; const std::size_t num_added_pfaces = fill_holes(should_be_removed); CGAL_assertion(num_added_pfaces > 0); - if (m_verbose) { + if (m_parameters.verbose) { std::cout << "* number of added pfaces: " << num_added_pfaces << std::endl; } num_hanging_pfaces = detect_hanging_pfaces(should_be_removed); @@ -147,10 +150,8 @@ public: } private: - const bool m_verbose; - const bool m_export; - const bool m_debug; Data_structure& m_data; + const Parameters& m_parameters; /******************************* ** CLEANING ** @@ -883,7 +884,7 @@ private: } } } - if (m_verbose) { + if (m_parameters.verbose) { std::cout << "* found boundary volumes: "<< volume_index << std::endl; } num_volumes = volume_index; @@ -923,7 +924,7 @@ private: } } const int after = volume_index; - if (m_verbose) { + if (m_parameters.verbose) { std::cout << "* found interior volumes: "<< after - before << std::endl; } num_volumes = volume_index; @@ -960,13 +961,13 @@ private: for (auto& volume : volumes) create_cell_pvertices(volume); - if (m_verbose) { + if (m_parameters.verbose) { std::cout << "* created volumes: " << volumes.size() << std::endl; - if (m_export) dump_volumes(m_data, "final"); + if (m_parameters.export_all) dump_volumes(m_data, "final"); for (std::size_t i = 0; i < volumes.size(); ++i) { const auto& volume = volumes[i]; CGAL_assertion(volume.pfaces.size() > 3); - if (m_debug) { + if (m_parameters.debug) { std::cout << " VOLUME " << std::to_string(i) << ": " " pvertices: " << volume.pvertices.size() << @@ -1014,7 +1015,7 @@ private: volume_size, volume_centroid, map_volumes, queue); } - if (m_debug) { + if (m_parameters.debug) { std::cout << "- FOUND VOLUME " << volume_index << ", (SIZE/BARYCENTER): " << volume_size << " / " << volume_centroid << std::endl; } @@ -1062,7 +1063,7 @@ private: false, query, volume_index, num_volumes, centroids, volume_size, volume_centroid, map_volumes, queue); } - if (m_debug) { + if (m_parameters.debug) { std::cout << "- FOUND VOLUME " << volume_index << ", (SIZE/BARYCENTER): " << volume_size << " / " << volume_centroid << std::endl; } diff --git a/Kinetic_shape_reconstruction/include/CGAL/KSR_3/Initializer.h b/Kinetic_shape_reconstruction/include/CGAL/KSR_3/Initializer.h index 2b45a8af8ba..66b30fcf2d8 100644 --- a/Kinetic_shape_reconstruction/include/CGAL/KSR_3/Initializer.h +++ b/Kinetic_shape_reconstruction/include/CGAL/KSR_3/Initializer.h @@ -22,6 +22,8 @@ // Internal includes. #include #include +#include + #include #include @@ -55,31 +57,26 @@ private: using OBB_traits = CGAL::Oriented_bounding_box_traits_3; using Planar_shape_type = KSR::Planar_shape_type; + using Parameters = KSR::Parameters_3; public: - Initializer( - const bool verbose, const bool dprint, const bool debug, Data_structure& data) : - m_verbose(verbose), m_export(dprint), m_debug(debug), m_data(data), + Initializer(Data_structure& data, const Parameters& parameters) : + m_data(data), m_parameters(parameters), m_merge_type(Planar_shape_type::CONVEX_HULL) { } template< typename InputRange, typename PolygonMap> - double initialize( - const InputRange& input_range, - const PolygonMap polygon_map, - const unsigned int k, - const double enlarge_bbox_ratio, - const bool reorient) { + double initialize(const InputRange& input_range, const PolygonMap polygon_map) { FT time_step; std::array bbox; create_bounding_box( input_range, polygon_map, - static_cast(enlarge_bbox_ratio), - reorient, bbox, time_step); - if (m_verbose) { + m_parameters.enlarge_bbox_ratio, + m_parameters.reorient, bbox, time_step); + if (m_parameters.verbose) { std::cout << "* precomputed time_step: " << time_step << std::endl; } @@ -87,8 +84,8 @@ public: bounding_box_to_polygons(bbox, bbox_faces); add_polygons(input_range, polygon_map, bbox_faces); - if (m_verbose) std::cout << "* intersecting input polygons ... "; - if (m_debug) { + if (m_parameters.verbose) std::cout << "* intersecting input polygons ... "; + if (m_parameters.debug) { KSR_3::dump(m_data, "init"); // KSR_3::dump_segmented_edges(m_data, "init"); } @@ -96,10 +93,10 @@ public: CGAL_assertion(m_data.check_integrity(false)); make_polygons_intersection_free(); CGAL_assertion(m_data.check_integrity(false)); - set_k_intersections(k); + set_k_intersections(m_parameters.k); - if (m_verbose) std::cout << "done" << std::endl; - if (m_debug) { + if (m_parameters.verbose) std::cout << "done" << std::endl; + if (m_parameters.debug) { KSR_3::dump(m_data, "intersected"); // KSR_3::dump_segmented_edges(m_data, "intersected"); } @@ -141,10 +138,8 @@ public: } private: - const bool m_verbose; - const bool m_export; - const bool m_debug; Data_structure& m_data; + const Parameters& m_parameters; const Planar_shape_type m_merge_type; template< @@ -172,12 +167,12 @@ private: const auto& minp = bbox.front(); const auto& maxp = bbox.back(); - if (m_verbose) { + if (m_parameters.verbose) { std::cout.precision(20); std::cout << "* bounding box minp: " << std::fixed << minp.x() << "\t, " << minp.y() << "\t, " << minp.z() << std::endl; } - if (m_verbose) { + if (m_parameters.verbose) { std::cout.precision(20); std::cout << "* bounding box maxp: " << std::fixed << maxp.x() << "\t, " << maxp.y() << "\t, " << maxp.z() << std::endl; @@ -240,12 +235,12 @@ private: CGAL_assertion(bbox_length_3 >= FT(0)); const FT tol = KSR::tolerance(); if (bbox_length_1 < tol || bbox_length_2 < tol || bbox_length_3 < tol) { - if (m_verbose) { + if (m_parameters.verbose) { std::cout << "* warning: optimal bounding box is flat, reverting ..." << std::endl; } initialize_axis_aligned_box(input_range, polygon_map, bbox); } else { - if (m_verbose) { + if (m_parameters.verbose) { std::cout << "* using optimal bounding box" << std::endl; } } @@ -300,7 +295,7 @@ private: bbox[2] = Point_3(bbox[2].x() + d, bbox[2].y() + d, bbox[2].z() - d); bbox[7] = Point_3(bbox[7].x() + d, bbox[7].y() + d, bbox[7].z() + d); bbox[6] = Point_3(bbox[6].x() + d, bbox[6].y() - d, bbox[6].z() + d); - if (m_verbose) { + if (m_parameters.verbose) { std::cout << "* setting x-based flat axis-aligned bounding box" << std::endl; } @@ -317,7 +312,7 @@ private: bbox[2] = Point_3(bbox[2].x() + d, bbox[2].y() + d, bbox[2].z() - d); bbox[7] = Point_3(bbox[7].x() + d, bbox[7].y() + d, bbox[7].z() + d); bbox[4] = Point_3(bbox[4].x() - d, bbox[4].y() + d, bbox[4].z() + d); - if (m_verbose) { + if (m_parameters.verbose) { std::cout << "* setting y-based flat axis-aligned bounding box" << std::endl; } @@ -334,7 +329,7 @@ private: bbox[6] = Point_3(bbox[6].x() + d, bbox[6].y() - d, bbox[6].z() + d); bbox[7] = Point_3(bbox[7].x() + d, bbox[7].y() + d, bbox[7].z() + d); bbox[4] = Point_3(bbox[4].x() - d, bbox[4].y() + d, bbox[4].z() + d); - if (m_verbose) { + if (m_parameters.verbose) { std::cout << "* setting z-based flat axis-aligned bounding box" << std::endl; } @@ -342,7 +337,7 @@ private: CGAL_assertion_msg(false, "ERROR: WRONG CASE!"); } } else { - if (m_verbose) { + if (m_parameters.verbose) { std::cout << "* using axis-aligned bounding box" << std::endl; } } @@ -433,7 +428,7 @@ private: CGAL_assertion(m_data.ivertices().size() == 8); CGAL_assertion(m_data.iedges().size() == 12); - if (m_verbose) { + if (m_parameters.verbose) { std::cout << "* inserted bbox faces: " << bbox_faces.size() << std::endl; } } @@ -461,7 +456,7 @@ private: } CGAL_assertion(m_data.number_of_support_planes() > 6); - if (m_verbose) { + if (m_parameters.verbose) { std::cout << "* provided input polygons: " << input_range.size() << std::endl; std::cout << "* inserted input polygons: " << polygons.size() << std::endl; } @@ -655,7 +650,7 @@ private: void make_polygons_intersection_free() { - if (m_debug) { + if (m_parameters.debug) { std::cout << std::endl; std::cout.precision(20); } @@ -733,9 +728,9 @@ private: // Refine polygons. for (std::size_t i = 0; i < m_data.number_of_support_planes(); ++i) { - Polygon_splitter splitter(m_data); + Polygon_splitter splitter(m_data, m_parameters); splitter.split_support_plane(i); - // if (i >= 6 && m_export) { + // if (i >= 6 && m_parameters.export_all) { // KSR_3::dump(m_data, "intersected-iter-" + std::to_string(i)); // } } diff --git a/Kinetic_shape_reconstruction/include/CGAL/KSR_3/Polygon_splitter.h b/Kinetic_shape_reconstruction/include/CGAL/KSR_3/Polygon_splitter.h index b8a0b1b356c..ccae773b1b2 100644 --- a/Kinetic_shape_reconstruction/include/CGAL/KSR_3/Polygon_splitter.h +++ b/Kinetic_shape_reconstruction/include/CGAL/KSR_3/Polygon_splitter.h @@ -99,12 +99,13 @@ private: using Uchar_map = typename Mesh_3::template Property_map; using Planar_shape_type = KSR::Planar_shape_type; + using Parameters = KSR::Parameters_3; public: - Polygon_splitter(Data_structure& data) : + Polygon_splitter(Data_structure& data, const Parameters& parameters) : m_data(data), - m_merge_type(Planar_shape_type::CONVEX_HULL), - m_verbose(m_data.is_verbose()) + m_parameters(parameters), + m_merge_type(Planar_shape_type::CONVEX_HULL) { } void split_support_plane(const std::size_t sp_idx) { @@ -151,12 +152,13 @@ public: private: Data_structure& m_data; + const Parameters& m_parameters; + TRI m_cdt; std::set m_input; std::map m_map_intersections; std::map m_boundary_ivertices; const Planar_shape_type m_merge_type; - const bool m_verbose; /******************************* ** MERGE PFACES ** @@ -856,7 +858,7 @@ private: } CGAL_assertion(num_pfaces > 0); - if (m_verbose) { + if (m_parameters.verbose) { std::cout << "** number of newly inserted pfaces: " << num_pfaces << std::endl; } } @@ -977,7 +979,7 @@ private: void set_boundary_ivertex( const PVertex& pvertex, const IVertex& ivertex) { - if (m_verbose) { + if (m_parameters.verbose) { std::cout.precision(20); std::cout << "*** setting boundary ivertex " << m_data.str(ivertex) << " via pvertex " << m_data.str(pvertex) << std::endl; @@ -988,7 +990,7 @@ private: // Get prev and next pvertices. PVertex prev, next; std::tie(prev, next) = m_data.border_prev_and_next(pvertex); - if (m_verbose) { + if (m_parameters.verbose) { std::cout << "- prev: " << m_data.point_3(prev) << std::endl; std::cout << "- next: " << m_data.point_3(next) << std::endl; } @@ -1055,7 +1057,7 @@ private: } CGAL_assertion(crossed_iedges.size() >= 2); - if (m_verbose) { + if (m_parameters.verbose) { std::cout << "- crossed " << crossed_iedges.size() << " iedges: " << std::endl; for (const auto& crossed_iedge : crossed_iedges) { std::cout << m_data.str(crossed_iedge.first) << ": " << @@ -1079,7 +1081,7 @@ private: new_pvertices.resize(crossed_iedges.size(), m_data.null_pvertex()); { // first crop - if (m_verbose) std::cout << "- first crop" << std::endl; + if (m_parameters.verbose) std::cout << "- first crop" << std::endl; const auto cropped = PVertex(pvertex.first, m_data.support_plane(pvertex).split_edge(pvertex.second, next.second)); CGAL_assertion(cropped != m_data.null_pvertex()); @@ -1093,12 +1095,12 @@ private: CGAL_assertion(future_directions.front() != Vector_2()); m_data.support_plane(cropped).set_point(cropped.second, future_points.front()); m_data.direction(cropped) = future_directions.front(); - if (m_verbose) std::cout << "- cropped 1: " << + if (m_parameters.verbose) std::cout << "- cropped 1: " << m_data.str(cropped) << ", " << m_data.point_3(cropped) << std::endl; } { // second crop - if (m_verbose) std::cout << "- second crop" << std::endl; + if (m_parameters.verbose) std::cout << "- second crop" << std::endl; const auto cropped = PVertex(pvertex.first, m_data.support_plane(pvertex).split_edge(pvertex.second, prev.second)); CGAL_assertion(cropped != m_data.null_pvertex()); @@ -1112,7 +1114,7 @@ private: CGAL_assertion(future_directions.back() != Vector_2()); m_data.support_plane(cropped).set_point(cropped.second, future_points.back()); m_data.direction(cropped) = future_directions.back(); - if (m_verbose) std::cout << "- cropped 2: " << + if (m_parameters.verbose) std::cout << "- cropped 2: " << m_data.str(cropped) << ", " << m_data.point_3(cropped) << std::endl; } @@ -1217,11 +1219,8 @@ private: m_data.point_2(sp_idx, m_data.target(iedge))) >= KSR::point_tolerance(), "TODO: SET FUTURE DIRECTION, HANDLE ZERO-LENGTH IEDGE!"); - const bool is_debug = false; - m_data.set_verbose(is_debug); const auto is_parallel = m_data.compute_future_point_and_direction( pvertex, ivertex, n1, n2, iedge, future_point, future_direction); - m_data.set_verbose(m_verbose); CGAL_assertion_msg(!is_parallel, "TODO: COMPUTE FUTURE POINT AND DIRECTION, ADD PARALLEL CASE!"); diff --git a/Kinetic_shape_reconstruction/include/CGAL/KSR_3/Propagation.h b/Kinetic_shape_reconstruction/include/CGAL/KSR_3/Propagation.h index d0583535d31..a41c957d46b 100644 --- a/Kinetic_shape_reconstruction/include/CGAL/KSR_3/Propagation.h +++ b/Kinetic_shape_reconstruction/include/CGAL/KSR_3/Propagation.h @@ -18,6 +18,8 @@ // Internal includes. #include #include +#include + #include #include #include @@ -53,12 +55,12 @@ private: using Bbox_2 = CGAL::Bbox_2; using Face_index = typename Data_structure::Face_index; + using Parameters = KSR::Parameters_3; public: - Propagation( - const bool verbose, const bool dprint, const bool debug, Data_structure& data) : - m_verbose(verbose), m_export(dprint), m_debug(debug), m_data(data), - m_queue(m_debug), m_min_time(-FT(1)), m_max_time(-FT(1)) + Propagation(Data_structure& data, const Parameters& parameters) : + m_data(data), m_parameters(parameters), m_queue(parameters.debug), + m_min_time(-FT(1)), m_max_time(-FT(1)) { } const std::pair propagate(const FT time_step) { @@ -76,7 +78,7 @@ public: CGAL_assertion(m_data.check_integrity()); ++num_queue_calls; - if (m_verbose && !m_debug) { + if (m_parameters.verbose && !m_parameters.debug) { if ((num_queue_calls % 50) == 0) { std::cout << ".................................................." << std::endl; } @@ -97,10 +99,9 @@ public: } private: - const bool m_verbose; - const bool m_export; - const bool m_debug; Data_structure& m_data; + const Parameters& m_parameters; + Event_queue m_queue; FT m_min_time; FT m_max_time; @@ -111,7 +112,7 @@ private: bool initialize_queue() { - if (m_debug) { + if (m_parameters.debug) { std::cout << "* initializing queue for events in [" << m_min_time << ";" << m_max_time << "]" << std::endl; } @@ -516,7 +517,7 @@ private: std::size_t run( const std::size_t initial_iteration) { - if (m_debug) { + if (m_parameters.debug) { std::cout << "* unstacking queue, current size: " << m_queue.size() << std::endl; } @@ -528,7 +529,7 @@ private: const FT current_time = event.time(); // const std::size_t sp_debug_idx = 20; - if (m_export /* && event.pvertex().first == sp_debug_idx */) { + if (m_parameters.export_all /* && event.pvertex().first == sp_debug_idx */) { if (iteration < 10) { dump(m_data, "iter-0" + std::to_string(iteration)); // dump_2d_surface_mesh(m_data, sp_debug_idx, "iter-" + std::to_string(iteration) + @@ -545,7 +546,7 @@ private: } m_data.update_positions(current_time); - if (m_debug) { + if (m_parameters.debug) { std::cout << std::endl << "* APPLYING " << iteration << ": " << event << std::endl; } ++iteration; @@ -626,7 +627,7 @@ private: const PVertex& /* pother */, const Event& /* event */) { - // if (m_debug) { + // if (m_parameters.debug) { // std::cout << "WARNING: SKIPPING TWO UNCONSTRAINED PVERTICES MEET EVENT!" << std::endl; // std::cout << "WARNING: THIS EVENT IS DUST!" << std::endl; // m_queue.print(); @@ -644,7 +645,7 @@ private: const PVertex& /* pother */, const Event& /* event */) { - // if (m_debug) { + // if (m_parameters.debug) { // std::cout << "WARNING: SKIPPING TWO CONSTRAINED PVERTICES MEET EVENT!" << std::endl; // std::cout << "WARNING: THIS EVENT IS DUST!" << std::endl; // m_queue.print(); @@ -662,7 +663,7 @@ private: const IEdge& /* iedge */, const Event& /* event */) { - // if (m_debug) { + // if (m_parameters.debug) { // std::cout << "WARNING: SKIPPING CONSTRAINED PVERTEX MEETS IEDGE EVENT!" << std::endl; // std::cout << "WARNING: THIS EVENT IS DUST!" << std::endl; // // m_queue.print(); @@ -688,7 +689,7 @@ private: CGAL_assertion( m_data.has_iedge(pvertex)); CGAL_assertion(!m_data.has_iedge(pother)); - // if (m_debug) { + // if (m_parameters.debug) { // std::cout << "WARNING: SKIPPING PVERTICES MEET IVERTEX EVENT!" << std::endl; // std::cout << "WARNING: THIS EVENT IS DUST!" << std::endl; // m_queue.print(); @@ -707,7 +708,7 @@ private: CGAL_assertion(!m_data.has_iedge(pvertex)); CGAL_assertion( m_data.has_one_pface(pvertex)); - // if (m_debug) { + // if (m_parameters.debug) { // std::cout << "WARNING: SKIPPING UNCONSTRAINED PVERTEX MEETS IVERTEX EVENT!" << std::endl; // std::cout << "WARNING: THIS EVENT IS DUST!" << std::endl; // m_queue.print(); @@ -913,7 +914,7 @@ private: bool check_pvertex_meets_iedge_global_k( const PVertex& pvertex, const IEdge& iedge) { - if (m_debug) { + if (m_parameters.debug) { std::cout << "- k intersections before: " << m_data.k(pvertex.first) << std::endl; } @@ -921,7 +922,7 @@ private: std::tie(is_occupied_iedge, is_bbox_reached) = m_data.collision_occured(pvertex, iedge); const bool is_limit_line = m_data.update_limit_lines_and_k(pvertex, iedge, is_occupied_iedge); - if (m_debug) { + if (m_parameters.debug) { std::cout << "- bbox: " << is_bbox_reached << "; " << " limit: " << is_limit_line << "; " << " occupied: " << is_occupied_iedge << std::endl; @@ -929,17 +930,17 @@ private: bool stop = false; if (is_bbox_reached) { - if (m_debug) std::cout << "- bbox, stop" << std::endl; + if (m_parameters.debug) std::cout << "- bbox, stop" << std::endl; stop = true; } else if (is_limit_line) { - if (m_debug) std::cout << "- limit, stop" << std::endl; + if (m_parameters.debug) std::cout << "- limit, stop" << std::endl; stop = true; } else { - if (m_debug) std::cout << "- free, any k, continue" << std::endl; + if (m_parameters.debug) std::cout << "- free, any k, continue" << std::endl; stop = false; } CGAL_assertion(m_data.k(pvertex.first) >= 1); - if (m_debug) { + if (m_parameters.debug) { std::cout << "- k intersections after: " << m_data.k(pvertex.first) << std::endl; } // CGAL_assertion_msg(false, "TODO: CHECK PVERTEX MEETS IVERTEX GLOBAL!"); @@ -954,7 +955,7 @@ private: bool check_pedge_meets_iedge_global_k( const PVertex& pvertex, const PVertex& pother, const IEdge& iedge) { - if (m_debug) { + if (m_parameters.debug) { std::cout << "- k intersections before: " << m_data.k(pvertex.first) << std::endl; } @@ -966,7 +967,7 @@ private: const bool is_limit_line_1 = m_data.update_limit_lines_and_k(pvertex, iedge, is_occupied_iedge_1); const bool is_limit_line_2 = m_data.update_limit_lines_and_k(pother , iedge, is_occupied_iedge_2); - if (m_debug) { + if (m_parameters.debug) { std::cout << "- bbox1: " << is_bbox_reached_1 << "; " << " limit1: " << is_limit_line_1 << "; " << " occupied1: " << is_occupied_iedge_1 << std::endl; @@ -979,19 +980,19 @@ private: bool stop = false; if (is_bbox_reached_1 || is_bbox_reached_2) { - if (m_debug) std::cout << "- bbox, stop" << std::endl; + if (m_parameters.debug) std::cout << "- bbox, stop" << std::endl; stop = true; } else if (is_limit_line_1 || is_limit_line_2) { - if (m_debug) std::cout << "- limit, stop" << std::endl; + if (m_parameters.debug) std::cout << "- limit, stop" << std::endl; stop = true; } else { - if (m_debug) std::cout << "- free, any k, continue" << std::endl; + if (m_parameters.debug) std::cout << "- free, any k, continue" << std::endl; CGAL_assertion(!m_data.is_sneaking_pedge(pvertex, pother, iedge)); stop = false; } CGAL_assertion(m_data.k(pvertex.first) >= 1); - if (m_debug) { + if (m_parameters.debug) { std::cout << "- k intersections after: " << m_data.k(pvertex.first) << std::endl; } // CGAL_assertion_msg(false, "TODO: CHECK PEDGE MEETS IEDGE GLOBAL!"); @@ -1052,7 +1053,7 @@ private: PVertex crop_pvertex_along_iedge( const PVertex& pvertex, const IEdge& iedge) { - if (m_debug) { + if (m_parameters.debug) { std::cout.precision(20); std::cout << "** cropping " << m_data.str(pvertex) << " along " << m_data.str(iedge) << std::endl; std::cout << "- pvertex: " << m_data.point_3(pvertex) << std::endl; @@ -1078,7 +1079,7 @@ private: CGAL_assertion(future_direction_a != Vector_2()); CGAL_assertion(future_direction_b != Vector_2()); if (is_parallel_a || is_parallel_b) { - if (m_debug) std::cout << "- pvertex to iedge, parallel case" << std::endl; + if (m_parameters.debug) std::cout << "- pvertex to iedge, parallel case" << std::endl; // CGAL_assertion_msg(!is_parallel_a && !is_parallel_b, // "TODO: PVERTEX -> IEDGE, HANDLE CASE WITH PARALLEL LINES!"); } @@ -1086,7 +1087,7 @@ private: const PEdge pedge(pvertex.first, m_data.support_plane(pvertex).split_vertex(pvertex.second)); CGAL_assertion(m_data.source(pedge) == pvertex || m_data.target(pedge) == pvertex); const PVertex pother = m_data.opposite(pedge, pvertex); - if (m_debug) { + if (m_parameters.debug) { std::cout << "- new pedge: " << m_data.str(pedge) << " between " << m_data.str(pvertex) << " and " << m_data.str(pother) << std::endl; } @@ -1100,7 +1101,7 @@ private: m_data.direction(pvertex) = future_direction_a; m_data.direction(pother) = future_direction_b; - if (m_debug) std::cout << "- new pvertices: " << + if (m_parameters.debug) std::cout << "- new pvertices: " << m_data.str(pother) << ": " << m_data.point_3(pother) << std::endl; // CGAL_assertion_msg(false, "TODO: CROP PVERTEX ALONG IEDGE!"); @@ -1110,7 +1111,7 @@ private: std::array propagate_pvertex_beyond_iedge( const PVertex& pvertex, const IEdge& iedge) { - if (m_debug) { + if (m_parameters.debug) { std::cout.precision(20); std::cout << "** propagating " << m_data.str(pvertex) << " beyond " << m_data.str(iedge) << std::endl; std::cout << "- pvertex: " << m_data.point_3(pvertex) << std::endl; @@ -1124,7 +1125,7 @@ private: const PVertex propagated = m_data.add_pvertex(pvertex.first, original_point); m_data.direction(propagated) = original_direction; - if (m_debug) { + if (m_parameters.debug) { std::cout << "- propagated: " << m_data.str(propagated) << ": " << m_data.point_3(propagated) << std::endl; } @@ -1136,7 +1137,7 @@ private: const PFace new_pface = m_data.add_pface(pvertices); CGAL_assertion(new_pface != m_data.null_pface()); CGAL_assertion(new_pface.second != Face_index()); - if (m_debug) { + if (m_parameters.debug) { std::cout << "- new pface " << m_data.str(new_pface) << ": " << m_data.centroid_of_pface(new_pface) << std::endl; } @@ -1148,7 +1149,7 @@ private: void crop_pedge_along_iedge( const PVertex& pvertex, const PVertex& pother, const IEdge& iedge) { - if (m_debug) { + if (m_parameters.debug) { std::cout.precision(20); std::cout << "** cropping pedge [" << m_data.str(pvertex) << "-" << m_data.str(pother) << "] along " << m_data.str(iedge) << std::endl; @@ -1168,7 +1169,7 @@ private: const PVertex prev(pvertex.first, m_data.support_plane(pvertex).prev(pvertex.second)); const PVertex next(pvertex.first, m_data.support_plane(pvertex).next(pvertex.second)); - if (m_debug) { + if (m_parameters.debug) { std::cout << "- prev pv: " << m_data.point_3(prev) << std::endl; std::cout << "- next pv: " << m_data.point_3(next) << std::endl; } @@ -1182,7 +1183,7 @@ private: } CGAL_assertion(pthird != m_data.null_pvertex()); - if (m_debug) { + if (m_parameters.debug) { std::cout << "- pthird pv: " << m_data.point_3(pthird) << std::endl; } @@ -1190,7 +1191,7 @@ private: 0, IVertex(), pvertex, pthird, iedge, future_point, future_direction); CGAL_assertion(future_direction != Vector_2()); if (is_parallel) { - if (m_debug) std::cout << "- pedge to iedge 1, parallel case" << std::endl; + if (m_parameters.debug) std::cout << "- pedge to iedge 1, parallel case" << std::endl; // CGAL_assertion_msg(!is_parallel, // "TODO: PEDGE -> IEDGE 1, HANDLE CASE WITH PARALLEL LINES!"); } @@ -1204,7 +1205,7 @@ private: const PVertex prev(pother.first, m_data.support_plane(pother).prev(pother.second)); const PVertex next(pother.first, m_data.support_plane(pother).next(pother.second)); - if (m_debug) { + if (m_parameters.debug) { std::cout << "- prev po: " << m_data.point_3(prev) << std::endl; std::cout << "- next po: " << m_data.point_3(next) << std::endl; } @@ -1218,7 +1219,7 @@ private: } CGAL_assertion(pthird != m_data.null_pvertex()); - if (m_debug) { + if (m_parameters.debug) { std::cout << "- pthird po: " << m_data.point_3(pthird) << std::endl; } @@ -1226,7 +1227,7 @@ private: 0, IVertex(), pother, pthird, iedge, future_point, future_direction); CGAL_assertion(future_direction != Vector_2()); if (is_parallel) { - if (m_debug) std::cout << "- pedge to iedge 2, parallel case" << std::endl; + if (m_parameters.debug) std::cout << "- pedge to iedge 2, parallel case" << std::endl; // CGAL_assertion_msg(!is_parallel, // "TODO: PEDGE -> IEDGE 2, HANDLE CASE WITH PARALLEL LINES!"); } @@ -1245,7 +1246,7 @@ private: std::pair propagate_pedge_beyond_iedge( const PVertex& pvertex, const PVertex& pother, const IEdge& iedge) { - if (m_debug) { + if (m_parameters.debug) { std::cout.precision(20); std::cout << "** propagating pedge [" << m_data.str(pvertex) << "-" << m_data.str(pother) << "] beyond " << m_data.str(iedge) << std::endl; @@ -1268,7 +1269,7 @@ private: const PVertex propagated_2 = m_data.add_pvertex(pother.first, original_point_2); m_data.direction(propagated_2) = original_direction_2; - if (m_debug) { + if (m_parameters.debug) { std::cout << "- propagated 1: " << m_data.str(propagated_1) << ": " << m_data.point_3(propagated_1) << std::endl; std::cout << "- propagated 2: " << m_data.str(propagated_2) << ": " << @@ -1284,7 +1285,7 @@ private: const PFace new_pface = m_data.add_pface(pvertices); CGAL_assertion(new_pface != m_data.null_pface()); CGAL_assertion(new_pface.second != Face_index()); - if (m_debug) { + if (m_parameters.debug) { std::cout << "- new pface " << m_data.str(new_pface) << ": " << m_data.centroid_of_pface(new_pface) << std::endl; } @@ -1295,7 +1296,7 @@ private: bool transfer_pvertex_via_iedge( const PVertex& pvertex, const PVertex& pother) { - if (m_debug) { + if (m_parameters.debug) { std::cout.precision(20); CGAL_assertion(m_data.has_iedge(pvertex)); std::cout << "** transfering " << m_data.str(pother) << " through " << m_data.str(pvertex) << " via " @@ -1310,12 +1311,12 @@ private: std::tie(source_pface, target_pface) = m_data.pfaces_of_pvertex(pvertex); const auto common_pface = m_data.pface_of_pvertex(pother); if (common_pface == target_pface) { - if (m_debug) std::cout << "- swap pfaces" << std::endl; + if (m_parameters.debug) std::cout << "- swap pfaces" << std::endl; std::swap(source_pface, target_pface); } CGAL_assertion(common_pface == source_pface); - if (m_debug) { + if (m_parameters.debug) { std::cout << "- initial pfaces: " << std::endl; if (source_pface != m_data.null_pface()) { std::cout << "source " << m_data.str(source_pface) << ": " << @@ -1330,7 +1331,7 @@ private: // Get pthird. PVertex pthird = m_data.next(pother); if (pthird == pvertex) pthird = m_data.prev(pother); - if (m_debug) std::cout << "- pthird: " << m_data.point_3(pthird) << std::endl; + if (m_parameters.debug) std::cout << "- pthird: " << m_data.point_3(pthird) << std::endl; // Get future point and direction. CGAL_assertion(m_data.has_iedge(pvertex)); @@ -1348,7 +1349,7 @@ private: 0, IVertex(), pother, pthird, iedge, future_point, future_direction); CGAL_assertion(future_direction != Vector_2()); if (is_parallel) { - if (m_debug) std::cout << "- transfer pvertex, parallel case" << std::endl; + if (m_parameters.debug) std::cout << "- transfer pvertex, parallel case" << std::endl; // CGAL_assertion_msg(!is_parallel, // "TODO: TRANSFER PVERTEX, HANDLE CASE WITH PARALLEL LINES!"); } @@ -1381,11 +1382,11 @@ private: CGAL_assertion(m_data.mesh(pedge).face(he) == common_pface.second); if (m_data.mesh(pedge).target(he) == pvertex.second) { - // if (m_debug) std::cout << "- shifting target" << std::endl; + // if (m_parameters.debug) std::cout << "- shifting target" << std::endl; CGAL::Euler::shift_target(he, m_data.mesh(pedge)); } else { CGAL_assertion(m_data.mesh(pedge).source(he) == pvertex.second); - // if (m_debug) std::cout << "- shifting source" << std::endl; + // if (m_parameters.debug) std::cout << "- shifting source" << std::endl; CGAL::Euler::shift_source(he, m_data.mesh(pedge)); } @@ -1403,7 +1404,7 @@ private: // "TODO: TRANSFER PVERTEX 2, ADD NEW FUTURE POINTS AND DIRECTIONS!"); } - if (m_debug) { + if (m_parameters.debug) { std::cout << "- new pfaces: " << std::endl; if (source_pface != m_data.null_pface()) { std::cout << "source " << m_data.str(source_pface) << ": " << @@ -1424,7 +1425,7 @@ private: const PVertex& event_pvertex, const std::vector& pvertices, std::vector< std::pair >& crossed_iedges) { - if (m_debug) { + if (m_parameters.debug) { std::cout.precision(20); std::cout << "** merging " << m_data.str(pvertices[1]) << " on " << m_data.str(ivertex) << std::endl; std::cout << "- pvertex: " << m_data.point_3(pvertices[1]) << std::endl; @@ -1437,7 +1438,7 @@ private: const PVertex next = pvertices.back(); const PVertex pvertex = pvertices[1]; - if (m_debug) { + if (m_parameters.debug) { const auto iedge = m_data.iedge(pvertex); if (iedge != m_data.null_iedge()) { std::cout << "- start from: " << m_data.str(iedge) << " " << @@ -1460,7 +1461,7 @@ private: CGAL_assertion_msg(false, "ERROR: INVALID CONNECTIVITY CASE!"); } - if (m_debug) { + if (m_parameters.debug) { std::cout << "- found neighbors: " << std::endl << "prev = " << m_data.point_3(prev) << std::endl << "fron = " << m_data.point_3(front) << std::endl << @@ -1483,7 +1484,7 @@ private: m_data.support_plane(curr).set_point(curr.second, ipoint); } m_data.connect(pvertex, ivertex); - if (m_debug) { + if (m_parameters.debug) { std::cout << "- frozen pvertex: " << m_data.str(pvertex) << " : " << m_data.point_3(pvertex) << std::endl; } @@ -1517,11 +1518,11 @@ private: } if (back_constrained && !front_constrained) { - if (m_debug) std::cout << "- reverse iedges" << std::endl; + if (m_parameters.debug) std::cout << "- reverse iedges" << std::endl; std::reverse(iedges.begin(), iedges.end()); } - if (m_debug) { + if (m_parameters.debug) { std::cout << "- initial iedges: " << iedges.size() << std::endl; for (const auto& iedge : iedges) { std::cout << m_data.str(iedge.first) << ": " << @@ -1561,7 +1562,7 @@ private: crossed_iedges.push_back(std::make_pair(m_data.iedge(pvertex), true)); } - if (m_debug) { + if (m_parameters.debug) { std::size_t num_new_pvertices = 0; for (const auto& new_pvertex : new_pvertices) { if (new_pvertex != m_data.null_pvertex()) ++num_new_pvertices; @@ -1576,7 +1577,7 @@ private: void apply_closing_case(const PVertex& pvertex) const { - if (m_debug) { + if (m_parameters.debug) { std::cout.precision(20); std::cout << "*** CLOSING CASE" << std::endl; } @@ -1595,7 +1596,7 @@ private: std::vector< std::pair >& crossed_iedges, std::vector& new_pvertices) { - if (m_debug) { + if (m_parameters.debug) { std::cout.precision(20); std::cout << "*** BACK BORDER CASE" << std::endl; } @@ -1630,7 +1631,7 @@ private: Point_2 shifted_prev; const auto pp_curr = m_data.point_2(prev, curr_time); if (prev_diff < tol) { - if (m_debug) std::cout << "- back, same time events, prev" << std::endl; + if (m_parameters.debug) std::cout << "- back, same time events, prev" << std::endl; CGAL_assertion(CGAL::abs(ntime - curr_time) >= tol); const auto pp_futr = m_data.point_2(prev, ntime); const auto dirp = Vector_2(pp_curr, pp_futr); @@ -1647,28 +1648,28 @@ private: // std::cout << "fiedge: " << (fiedges.size() > 0) << std::endl; // std::cout << "fiedge: " << m_data.segment_3(fiedges.back()) << std::endl; if (fiedges.size() > 0 && iedge == fiedges.back()) { - if (m_debug) std::cout << "- found same time iedge, prev" << std::endl; + if (m_parameters.debug) std::cout << "- found same time iedge, prev" << std::endl; found_iedge = true; break; } } if (found_iedge) { shifted_prev = pp_curr + dirp / FT(2); - if (m_debug) std::cout << "- excluding iedge, prev" << std::endl; + if (m_parameters.debug) std::cout << "- excluding iedge, prev" << std::endl; // CGAL_assertion_msg(false, "TODO: CHECK BACK PREV CASE 1!"); } else { shifted_prev = pp_curr - dirp / FT(2); - if (m_debug) std::cout << "- including iedge, prev" << std::endl; + if (m_parameters.debug) std::cout << "- including iedge, prev" << std::endl; // CGAL_assertion_msg(false, "TODO: CHECK BACK PREV CASE 2!"); } } else { const auto pp_last = m_data.point_2(prev, prev_time); const auto dirp = Vector_2(pp_last, pp_curr); shifted_prev = pp_curr - dirp / FT(10); - if (m_debug) std::cout << "- including iedge, prev" << std::endl; + if (m_parameters.debug) std::cout << "- including iedge, prev" << std::endl; } - if (m_debug) { + if (m_parameters.debug) { std::cout << "- shifting prev: " << m_data.to_3d(pvertex.first, shifted_prev) << std::endl; } @@ -1702,7 +1703,7 @@ private: const bool is_bbox_reached = ( m_data.collision_occured(pvertex, iedge) ).second; const bool is_limit_reached = ( m_data.line_idx(iedge) == other_side_limit ); - if (m_debug) { + if (m_parameters.debug) { std::cout << "- bbox: " << is_bbox_reached << "; limit: " << is_limit_reached << std::endl; } @@ -1718,7 +1719,7 @@ private: } CGAL_assertion(crossed_iedges.size() > 0); - if (m_debug) { + if (m_parameters.debug) { std::cout << "- crossed " << crossed_iedges.size() << " iedges: " << std::endl; for (const auto& crossed_iedge : crossed_iedges) { std::cout << m_data.str(crossed_iedge.first) << ": " << @@ -1740,12 +1741,12 @@ private: if (KSR::distance(m_data.point_2(back), m_data.point_2(prev)) < KSR::point_tolerance()) { // is_parallel = m_data.compute_future_point_and_direction( // 0, back, prev, iedge_0, future_point, future_direction); // does not work! - if (m_debug) std::cout << "- back = prev, equal points case" << std::endl; + if (m_parameters.debug) std::cout << "- back = prev, equal points case" << std::endl; is_parallel = m_data.compute_future_point_and_direction( 0, ivertex, event_pvertex, prev, iedge_0, future_point, future_direction); // CGAL_assertion_msg(false, "TODO: BACK, FIX CASE WITH EQUAL BACK AND PREV!"); } else { - if (m_debug) std::cout << "- back, prev, not equal points case" << std::endl; + if (m_parameters.debug) std::cout << "- back, prev, not equal points case" << std::endl; is_parallel = m_data.compute_future_point_and_direction( 0, ivertex, back, prev, iedge_0, future_point, future_direction); } @@ -1763,7 +1764,7 @@ private: { // crop PVertex cropped = m_data.null_pvertex(); if (prev_iedge == iedge_0) { - if (m_debug) std::cout << "- back, prev, parallel case" << std::endl; + if (m_parameters.debug) std::cout << "- back, prev, parallel case" << std::endl; // In case, we are parallel, we update the future point and direction. cropped = prev; @@ -1772,7 +1773,7 @@ private: 0, ivertex, prev, pprev, prev_iedge, future_point, future_direction); } else { - if (m_debug) std::cout << "- back, prev, standard case" << std::endl; + if (m_parameters.debug) std::cout << "- back, prev, standard case" << std::endl; cropped = PVertex(pvertex.first, m_data.support_plane(pvertex).split_edge(pvertex.second, prev.second)); } @@ -1789,7 +1790,7 @@ private: CGAL_assertion(future_direction != Vector_2()); m_data.support_plane(cropped).set_point(cropped.second, future_point); m_data.direction(cropped) = future_direction; - if (m_debug) std::cout << "- cropped: " << + if (m_parameters.debug) std::cout << "- cropped: " << m_data.str(cropped) << ", " << m_data.point_3(cropped) << std::endl; CGAL_assertion(m_data.is_correctly_oriented( cropped.first, future_direction, ivertex, iedge_0)); @@ -1813,7 +1814,7 @@ private: std::vector< std::pair >& crossed_iedges, std::vector& new_pvertices) { - if (m_debug) { + if (m_parameters.debug) { std::cout.precision(20); std::cout << "*** FRONT BORDER CASE" << std::endl; } @@ -1848,7 +1849,7 @@ private: Point_2 shifted_next; const auto pn_curr = m_data.point_2(next, curr_time); if (next_diff < tol) { - if (m_debug) std::cout << "- front, same time events, next" << std::endl; + if (m_parameters.debug) std::cout << "- front, same time events, next" << std::endl; CGAL_assertion(CGAL::abs(ntime - curr_time) >= tol); const auto pn_futr = m_data.point_2(next, ntime); const auto dirn = Vector_2(pn_curr, pn_futr); @@ -1864,28 +1865,28 @@ private: // std::cout << "biedge: " << (biedges.size() > 0) << std::endl; // std::cout << "biedge: " << m_data.segment_3(biedges.front()) << std::endl; if (biedges.size() > 0 && iedge == biedges.front()) { - if (m_debug) std::cout << "- found same time iedge, next" << std::endl; + if (m_parameters.debug) std::cout << "- found same time iedge, next" << std::endl; found_iedge = true; break; } } if (found_iedge) { shifted_next = pn_curr + dirn / FT(2); - if (m_debug) std::cout << "- excluding iedge, next" << std::endl; + if (m_parameters.debug) std::cout << "- excluding iedge, next" << std::endl; // CGAL_assertion_msg(false, "TODO: CHECK FRONT NEXT CASE 1!"); } else { shifted_next = pn_curr - dirn / FT(2); - if (m_debug) std::cout << "- including iedge, next" << std::endl; + if (m_parameters.debug) std::cout << "- including iedge, next" << std::endl; // CGAL_assertion_msg(false, "TODO: CHECK FRONT NEXT CASE 2!"); } } else { const auto pn_last = m_data.point_2(next, next_time); const auto dirn = Vector_2(pn_last, pn_curr); shifted_next = pn_curr - dirn / FT(10); - if (m_debug) std::cout << "- including iedge, next" << std::endl; + if (m_parameters.debug) std::cout << "- including iedge, next" << std::endl; } - if (m_debug) { + if (m_parameters.debug) { std::cout << "- shifting next: " << m_data.to_3d(pvertex.first, shifted_next) << std::endl; } @@ -1919,7 +1920,7 @@ private: const bool is_bbox_reached = ( m_data.collision_occured(pvertex, iedge) ).second; const bool is_limit_reached = ( m_data.line_idx(iedge) == other_side_limit ); - if (m_debug) { + if (m_parameters.debug) { std::cout << "- bbox: " << is_bbox_reached << "; limit: " << is_limit_reached << std::endl; } @@ -1935,7 +1936,7 @@ private: } CGAL_assertion(crossed_iedges.size() > 0); - if (m_debug) { + if (m_parameters.debug) { std::cout << "- crossed " << crossed_iedges.size() << " iedges: " << std::endl; for (const auto& crossed_iedge : crossed_iedges) { std::cout << m_data.str(crossed_iedge.first) << ": " << @@ -1955,11 +1956,11 @@ private: { // future point and direction bool is_parallel = false; if (KSR::distance(m_data.point_2(front), m_data.point_2(next)) < KSR::point_tolerance()) { - if (m_debug) std::cout << "- front = next, equal points case" << std::endl; + if (m_parameters.debug) std::cout << "- front = next, equal points case" << std::endl; CGAL_assertion_msg(false, "TODO: FRONT, FIX CASE WITH EQUAL FRONT AND NEXT! SEE BACK CASE FOR REFERENCE!"); } else { - if (m_debug) std::cout << "- front, next, not equal points case" << std::endl; + if (m_parameters.debug) std::cout << "- front, next, not equal points case" << std::endl; is_parallel = m_data.compute_future_point_and_direction( 0, ivertex, front, next, iedge_0, future_point, future_direction); } @@ -1977,7 +1978,7 @@ private: { // crop PVertex cropped = m_data.null_pvertex(); if (next_iedge == iedge_0) { - if (m_debug) std::cout << "- front, next, parallel case" << std::endl; + if (m_parameters.debug) std::cout << "- front, next, parallel case" << std::endl; // In case, we are parallel, we update the future point and direction. cropped = next; @@ -1986,7 +1987,7 @@ private: 0, ivertex, next, nnext, next_iedge, future_point, future_direction); } else { - if (m_debug) std::cout << "- front, next, standard case" << std::endl; + if (m_parameters.debug) std::cout << "- front, next, standard case" << std::endl; cropped = PVertex(pvertex.first, m_data.support_plane(pvertex).split_edge(pvertex.second, next.second)); } @@ -2003,7 +2004,7 @@ private: CGAL_assertion(future_direction != Vector_2()); m_data.support_plane(cropped).set_point(cropped.second, future_point); m_data.direction(cropped) = future_direction; - if (m_debug) std::cout << "- cropped: " << + if (m_parameters.debug) std::cout << "- cropped: " << m_data.str(cropped) << ", " << m_data.point_3(cropped) << std::endl; CGAL_assertion(m_data.is_correctly_oriented( cropped.first, future_direction, ivertex, iedge_0)); @@ -2029,7 +2030,7 @@ private: std::vector< std::pair >& crossed_iedges, std::vector& new_pvertices) { - if (m_debug) { + if (m_parameters.debug) { std::cout.precision(20); std::cout << "*** OPEN CASE" << std::endl; } @@ -2069,7 +2070,7 @@ private: Point_2 shifted_prev; const auto pp_curr = m_data.point_2(prev, curr_time); if (prev_diff < tol) { - if (m_debug) std::cout << "- open, same time events, prev" << std::endl; + if (m_parameters.debug) std::cout << "- open, same time events, prev" << std::endl; CGAL_assertion(CGAL::abs(ntime - curr_time) >= tol); const auto pp_futr = m_data.point_2(prev, ntime); const auto dirp = Vector_2(pp_curr, pp_futr); @@ -2085,31 +2086,31 @@ private: // std::cout << "fiedge: " << (fiedges.size() > 0) << std::endl; // std::cout << "fiedge: " << m_data.segment_3(fiedges.back()) << std::endl; if (fiedges.size() > 0 && iedge == fiedges.back()) { - if (m_debug) std::cout << "- found same time iedge, prev" << std::endl; + if (m_parameters.debug) std::cout << "- found same time iedge, prev" << std::endl; found_iedge = true; break; } } if (found_iedge) { shifted_prev = pp_curr + dirp / FT(2); - if (m_debug) std::cout << "- excluding iedge, prev" << std::endl; + if (m_parameters.debug) std::cout << "- excluding iedge, prev" << std::endl; // CGAL_assertion_msg(false, "TODO: CHECK OPEN PREV CASE 1!"); } else { shifted_prev = pp_curr - dirp / FT(2); - if (m_debug) std::cout << "- including iedge, prev" << std::endl; + if (m_parameters.debug) std::cout << "- including iedge, prev" << std::endl; CGAL_assertion_msg(false, "TODO: CHECK OPEN PREV CASE 2!"); } } else { const auto pp_last = m_data.point_2(prev, prev_time); const auto dirp = Vector_2(pp_last, pp_curr); shifted_prev = pp_curr - dirp / FT(10); - if (m_debug) std::cout << "- including iedge, prev" << std::endl; + if (m_parameters.debug) std::cout << "- including iedge, prev" << std::endl; } Point_2 shifted_next; const auto pn_curr = m_data.point_2(next, curr_time); if (next_diff < tol) { - if (m_debug) std::cout << "- open, same time events, next" << std::endl; + if (m_parameters.debug) std::cout << "- open, same time events, next" << std::endl; CGAL_assertion(CGAL::abs(ntime - curr_time) >= tol); const auto pn_futr = m_data.point_2(next, ntime); const auto dirn = Vector_2(pn_curr, pn_futr); @@ -2125,28 +2126,28 @@ private: // std::cout << "biedge: " << (biedges.size() > 0) << std::endl; // std::cout << "biedge: " << m_data.segment_3(biedges.front()) << std::endl; if (biedges.size() > 0 && iedge == biedges.front()) { - if (m_debug) std::cout << "- found same time iedge, next" << std::endl; + if (m_parameters.debug) std::cout << "- found same time iedge, next" << std::endl; found_iedge = true; break; } } if (found_iedge) { shifted_next = pn_curr + dirn / FT(2); - if (m_debug) std::cout << "- excluding iedge, next" << std::endl; + if (m_parameters.debug) std::cout << "- excluding iedge, next" << std::endl; // CGAL_assertion_msg(false, "TODO: CHECK OPEN NEXT CASE 1!"); } else { shifted_next = pn_curr - dirn / FT(2); - if (m_debug) std::cout << "- including iedge, next" << std::endl; + if (m_parameters.debug) std::cout << "- including iedge, next" << std::endl; CGAL_assertion_msg(false, "TODO: CHECK OPEN NEXT CASE 2!"); } } else { const auto pn_last = m_data.point_2(next, next_time); const auto dirn = Vector_2(pn_last, pn_curr); shifted_next = pn_curr - dirn / FT(10); - if (m_debug) std::cout << "- including iedge, next" << std::endl; + if (m_parameters.debug) std::cout << "- including iedge, next" << std::endl; } - if (m_debug) { + if (m_parameters.debug) { std::cout << "- shifting prev: " << m_data.to_3d(pvertex.first, shifted_prev) << std::endl; std::cout << "- shifting next: " << m_data.to_3d(pvertex.first, shifted_next) << std::endl; } @@ -2200,7 +2201,7 @@ private: } CGAL_assertion(crossed_iedges.size() > 0); - if (m_debug) { + if (m_parameters.debug) { std::cout << "- crossed " << crossed_iedges.size() << " iedges: " << std::endl; for (const auto& crossed_iedge : crossed_iedges) { std::cout << m_data.str(crossed_iedge.first) << ": " << @@ -2218,27 +2219,27 @@ private: new_pvertices.clear(); new_pvertices.resize(crossed_iedges.size(), m_data.null_pvertex()); - if (m_debug) std::cout << "- open, 1 edge case" << std::endl; + if (m_parameters.debug) std::cout << "- open, 1 edge case" << std::endl; Point_2 future_point; Vector_2 future_direction; bool is_parallel = false; if (KSR::distance(m_data.point_2(prev), m_data.point_2(next)) < KSR::point_tolerance()) { - if (m_debug) std::cout << "- prev = next, equal points case" << std::endl; + if (m_parameters.debug) std::cout << "- prev = next, equal points case" << std::endl; CGAL_assertion_msg(false, "TODO: OPEN, 1 EDGE CASE, FIX CASE WITH EQUAL PREV AND NEXT! SEE BACK CASE FOR REFERENCE!"); } else { - if (m_debug) std::cout << "- prev, next, not equal points case" << std::endl; + if (m_parameters.debug) std::cout << "- prev, next, not equal points case" << std::endl; is_parallel = m_data.compute_future_point_and_direction( pvertex, ivertex, prev, next, crossed_iedges[0].first, future_point, future_direction); } if (is_parallel) { - if (m_debug) std::cout << "- parallel case" << std::endl; + if (m_parameters.debug) std::cout << "- parallel case" << std::endl; CGAL_assertion_msg(!is_parallel, "TODO: OPEN, 1 EDGE CASE, ADD PARALLEL CASE!"); } else { - if (m_debug) std::cout << "- standard case" << std::endl; + if (m_parameters.debug) std::cout << "- standard case" << std::endl; } const auto cropped1 = PVertex(pvertex.first, m_data.support_plane(pvertex).split_edge(pvertex.second, next.second)); @@ -2262,7 +2263,7 @@ private: CGAL_assertion(future_direction != Vector_2()); m_data.support_plane(cropped).set_point(cropped.second, future_point); m_data.direction(cropped) = future_direction; - if (m_debug) std::cout << "- cropped: " << + if (m_parameters.debug) std::cout << "- cropped: " << m_data.str(cropped) << ", " << m_data.point_3(cropped) << std::endl; CGAL_assertion(m_data.is_correctly_oriented( cropped.first, future_direction, ivertex, crossed_iedges[0].first)); @@ -2284,14 +2285,14 @@ private: m_data.point_2(pvertex.first, m_data.target(crossed_iedges.front().first))) >= KSR::point_tolerance(), "TODO: OPEN, FRONT, HANDLE ZERO-LENGTH IEDGE!"); - if (m_debug) std::cout << "- getting future point and direction, front" << std::endl; + if (m_parameters.debug) std::cout << "- getting future point and direction, front" << std::endl; bool is_parallel = false; if (KSR::distance(m_data.point_2(prev), m_data.point_2(next)) < KSR::point_tolerance()) { - if (m_debug) std::cout << "- prev = next, equal points case" << std::endl; + if (m_parameters.debug) std::cout << "- prev = next, equal points case" << std::endl; CGAL_assertion_msg(false, "TODO: OPEN, FRONT, FIX CASE WITH EQUAL PREV AND NEXT! SEE BACK CASE FOR REFERENCE!"); } else { - if (m_debug) std::cout << "- prev, next, not equal points case" << std::endl; + if (m_parameters.debug) std::cout << "- prev, next, not equal points case" << std::endl; is_parallel = m_data.compute_future_point_and_direction( pvertex, ivertex, prev, next, crossed_iedges.front().first, future_points.front(), future_directions.front()); @@ -2313,14 +2314,14 @@ private: m_data.point_2(pvertex.first, m_data.target(crossed_iedges.back().first))) >= KSR::point_tolerance(), "TODO: OPEN, BACK, HANDLE ZERO-LENGTH IEDGE!"); - if (m_debug) std::cout << "- getting future point and direction, back" << std::endl; + if (m_parameters.debug) std::cout << "- getting future point and direction, back" << std::endl; bool is_parallel = false; if (KSR::distance(m_data.point_2(prev), m_data.point_2(next)) < KSR::point_tolerance()) { - if (m_debug) std::cout << "- prev = next, equal points case" << std::endl; + if (m_parameters.debug) std::cout << "- prev = next, equal points case" << std::endl; CGAL_assertion_msg(false, "TODO: OPEN, BACK, FIX CASE WITH EQUAL PREV AND NEXT! SEE BACK CASE FOR REFERENCE!"); } else { - if (m_debug) std::cout << "- prev, next, not equal points case" << std::endl; + if (m_parameters.debug) std::cout << "- prev, next, not equal points case" << std::endl; is_parallel = m_data.compute_future_point_and_direction( pvertex, ivertex, prev, next, crossed_iedges.back().first, future_points.back(), future_directions.back()); @@ -2342,7 +2343,7 @@ private: { // first crop PVertex cropped = m_data.null_pvertex(); if (next_iedge == crossed_iedges.front().first) { - if (m_debug) std::cout << "- open, next, parallel case" << std::endl; + if (m_parameters.debug) std::cout << "- open, next, parallel case" << std::endl; // In case, we are parallel, we update the future point and direction. cropped = next; @@ -2351,7 +2352,7 @@ private: 0, ivertex, next, nnext, next_iedge, future_points.front(), future_directions.front()); } else { - if (m_debug) std::cout << "- open, next, standard case" << std::endl; + if (m_parameters.debug) std::cout << "- open, next, standard case" << std::endl; cropped = PVertex(pvertex.first, m_data.support_plane(pvertex).split_edge(pvertex.second, next.second)); } @@ -2368,7 +2369,7 @@ private: CGAL_assertion(future_directions.front() != Vector_2()); m_data.support_plane(cropped).set_point(cropped.second, future_points.front()); m_data.direction(cropped) = future_directions.front(); - if (m_debug) std::cout << "- cropped 1: " << + if (m_parameters.debug) std::cout << "- cropped 1: " << m_data.str(cropped) << ", " << m_data.point_3(cropped) << std::endl; CGAL_assertion(m_data.is_correctly_oriented( cropped.first, future_directions.front(), ivertex, crossed_iedges.front().first)); @@ -2377,7 +2378,7 @@ private: { // second crop PVertex cropped = m_data.null_pvertex(); if (prev_iedge == crossed_iedges.back().first) { - if (m_debug) std::cout << "- open, prev, parallel case" << std::endl; + if (m_parameters.debug) std::cout << "- open, prev, parallel case" << std::endl; // In case, we are parallel, we update the future point and direction. cropped = prev; @@ -2386,7 +2387,7 @@ private: 0, ivertex, prev, pprev, prev_iedge, future_points.back(), future_directions.back()); } else { - if (m_debug) std::cout << "- open, prev, standard case" << std::endl; + if (m_parameters.debug) std::cout << "- open, prev, standard case" << std::endl; cropped = PVertex(pvertex.first, m_data.support_plane(pvertex).split_edge(pvertex.second, prev.second)); } @@ -2403,7 +2404,7 @@ private: CGAL_assertion(future_directions.back() != Vector_2()); m_data.support_plane(cropped).set_point(cropped.second, future_points.back()); m_data.direction(cropped) = future_directions.back(); - if (m_debug) std::cout << "- cropped 2: " << + if (m_parameters.debug) std::cout << "- cropped 2: " << m_data.str(cropped) << ", " << m_data.point_3(cropped) << std::endl; CGAL_assertion(m_data.is_correctly_oriented( cropped.first, future_directions.back(), ivertex, crossed_iedges.back().first)); diff --git a/Kinetic_shape_reconstruction/include/CGAL/Kinetic_shape_reconstruction_3.h b/Kinetic_shape_reconstruction/include/CGAL/Kinetic_shape_reconstruction_3.h index 6b2ddfafd99..1e9b36af9f8 100644 --- a/Kinetic_shape_reconstruction/include/CGAL/Kinetic_shape_reconstruction_3.h +++ b/Kinetic_shape_reconstruction/include/CGAL/Kinetic_shape_reconstruction_3.h @@ -29,6 +29,8 @@ // Internal includes. #include #include +#include + #include #include #include @@ -61,11 +63,10 @@ private: using Polygon_mesh = CGAL::Surface_mesh; using Vertex_index = typename Polygon_mesh::Vertex_index; using Timer = CGAL::Real_timer; + using Parameters = KSR::Parameters_3; private: - const bool m_verbose; - const bool m_export; - const bool m_debug; + Parameters m_parameters; Data_structure m_data; std::size_t m_num_events; @@ -73,10 +74,8 @@ public: Kinetic_shape_reconstruction_3( const bool verbose = true, const bool debug = false) : - m_verbose(verbose), - m_export(false), - m_debug(debug), - m_data(m_debug), + m_parameters(verbose, debug, false), + m_data(m_parameters), m_num_events(0) { } @@ -90,14 +89,16 @@ public: const NamedParameters& np) { Timer timer; - const unsigned int k = parameters::choose_parameter( + m_parameters.k = parameters::choose_parameter( parameters::get_parameter(np, internal_np::k_intersections), 1); - unsigned int n = parameters::choose_parameter( + m_parameters.n = parameters::choose_parameter( parameters::get_parameter(np, internal_np::n_subdivisions), 0); - FT enlarge_bbox_ratio = parameters::choose_parameter( + m_parameters.enlarge_bbox_ratio = parameters::choose_parameter( parameters::get_parameter(np, internal_np::enlarge_bbox_ratio), FT(11) / FT(10)); - const bool reorient = parameters::choose_parameter( + m_parameters.reorient = parameters::choose_parameter( parameters::get_parameter(np, internal_np::reorient), false); + m_parameters.use_hybrid_mode = parameters::choose_parameter( + parameters::get_parameter(np, internal_np::use_hybrid_mode), false); std::cout.precision(20); if (input_range.size() == 0) { @@ -106,34 +107,34 @@ public: return false; } - if (n != 0) { + if (m_parameters.n != 0) { CGAL_assertion_msg(false, "TODO: IMPLEMENT KINETIC SUBDIVISION!"); - if (n > 3) { - CGAL_warning_msg(n <= 3, + if (m_parameters.n > 3) { + CGAL_warning_msg(m_parameters.n <= 3, "WARNING: DOES IT MAKE SENSE TO HAVE MORE THAN 64 INPUT BLOCKS? SETTING N TO 3!"); - n = 3; + m_parameters.n = 3; } } - if (enlarge_bbox_ratio < FT(1)) { - CGAL_warning_msg(enlarge_bbox_ratio >= FT(1), + if (m_parameters.enlarge_bbox_ratio < FT(1)) { + CGAL_warning_msg(m_parameters.enlarge_bbox_ratio >= FT(1), "WARNING: YOU SET ENLARGE_BBOX_RATIO < 1.0! THE VALID RANGE IS [1.0, +INF). SETTING TO 1.0!"); - enlarge_bbox_ratio = FT(1); + m_parameters.enlarge_bbox_ratio = FT(1); } - if (m_verbose) { - const unsigned int num_blocks = std::pow(n + 1, 3); - const std::string is_reorient = (reorient ? "true" : "false"); + if (m_parameters.verbose) { + const unsigned int num_blocks = std::pow(m_parameters.n + 1, 3); + const std::string is_reorient = (m_parameters.reorient ? "true" : "false"); std::cout << std::endl << "--- PARTITION OPTIONS: " << std::endl; - std::cout << "* number of intersections k: " << k << std::endl; - std::cout << "* number of subdivisions per bbox side: " << n << std::endl; - std::cout << "* number of subdivision blocks: " << num_blocks << std::endl; - std::cout << "* enlarge bbox ratio: " << enlarge_bbox_ratio << std::endl; - std::cout << "* reorient: " << is_reorient << std::endl; + std::cout << "* number of intersections k: " << m_parameters.k << std::endl; + std::cout << "* number of subdivisions per bbox side: " << m_parameters.n << std::endl; + std::cout << "* number of subdivision blocks: " << num_blocks << std::endl; + std::cout << "* enlarge bbox ratio: " << m_parameters.enlarge_bbox_ratio << std::endl; + std::cout << "* reorient: " << is_reorient << std::endl; } - if (m_verbose) { + if (m_parameters.verbose) { std::cout << std::endl << "--- INITIALIZING PARTITION:" << std::endl; } @@ -141,13 +142,12 @@ public: timer.reset(); timer.start(); m_data.clear(); - Initializer initializer(m_verbose, m_export, m_debug, m_data); - const FT time_step = static_cast(initializer.initialize( - input_range, polygon_map, k, CGAL::to_double(enlarge_bbox_ratio), reorient)); + Initializer initializer(m_data, m_parameters); + const FT time_step = static_cast(initializer.initialize(input_range, polygon_map)); timer.stop(); const double time_to_initialize = timer.time(); - // if (m_verbose) { + // if (m_parameters.verbose) { // std::cout << std::endl << "* initialization (sec.): " << time_to_initialize << std::endl; // std::cout << "INITIALIZATION SUCCESS!" << std::endl << std::endl; // } @@ -158,13 +158,13 @@ public: // std::cout << m_data.support_plane(i).plane() << std::endl; // } - if (k == 0) { // for k = 0, we skip propagation - CGAL_warning_msg(k > 0, + if (m_parameters.k == 0) { // for k = 0, we skip propagation + CGAL_warning_msg(m_parameters.k > 0, "WARNING: YOU SET K TO 0! THAT MEANS NO PROPAGATION! THE VALID VALUES ARE {1,2,...}. INTERSECT AND RETURN!"); return false; } - if (m_verbose) { + if (m_parameters.verbose) { std::cout << std::endl << "--- RUNNING THE QUEUE:" << std::endl; std::cout << "* propagation started" << std::endl; } @@ -173,54 +173,54 @@ public: timer.reset(); timer.start(); std::size_t num_queue_calls = 0; - Propagation propagation(m_verbose, m_export, m_debug, m_data); + Propagation propagation(m_data, m_parameters); std::tie(num_queue_calls, m_num_events) = propagation.propagate(time_step); timer.stop(); const double time_to_propagate = timer.time(); - if (m_verbose) { + if (m_parameters.verbose) { std::cout << "* propagation finished" << std::endl; std::cout << "* number of queue calls: " << num_queue_calls << std::endl; std::cout << "* number of events handled: " << m_num_events << std::endl; } - if (m_verbose) { + if (m_parameters.verbose) { std::cout << std::endl << "--- FINALIZING PARTITION:" << std::endl; } // Finalization. timer.reset(); timer.start(); - if (m_debug) dump(m_data, "jiter-final-a-result"); + if (m_parameters.debug) dump(m_data, "jiter-final-a-result"); - Finalizer finalizer(m_verbose, m_export, m_debug, m_data); + Finalizer finalizer(m_data, m_parameters); finalizer.clean(); - if (m_verbose) std::cout << "* checking final mesh integrity ..."; + if (m_parameters.verbose) std::cout << "* checking final mesh integrity ..."; CGAL_assertion(m_data.check_integrity(true, true, true)); - if (m_verbose) std::cout << " done" << std::endl; + if (m_parameters.verbose) std::cout << " done" << std::endl; - if (m_debug) dump(m_data, "jiter-final-b-result"); + if (m_parameters.debug) dump(m_data, "jiter-final-b-result"); // std::cout << std::endl << "CLEANING SUCCESS!" << std::endl << std::endl; // exit(EXIT_SUCCESS); - if (m_verbose) std::cout << "* getting volumes ..." << std::endl; + if (m_parameters.verbose) std::cout << "* getting volumes ..." << std::endl; finalizer.create_polyhedra(); timer.stop(); const double time_to_finalize = timer.time(); - if (m_verbose) { + if (m_parameters.verbose) { std::cout << "* found all together " << m_data.number_of_volumes(-1) << " volumes" << std::endl; } // std::cout << std::endl << "CREATING VOLUMES SUCCESS!" << std::endl << std::endl; // exit(EXIT_SUCCESS); // Timing. - if (m_verbose) { + if (m_parameters.verbose) { std::cout << std::endl << "--- TIMING (sec.):" << std::endl; } const double total_time = time_to_initialize + time_to_propagate + time_to_finalize; - if (m_verbose) { + if (m_parameters.verbose) { std::cout << "* initialization: " << time_to_initialize << std::endl; std::cout << "* propagation: " << time_to_propagate << std::endl; std::cout << "* finalization: " << time_to_finalize << std::endl; @@ -246,7 +246,7 @@ public: InputRange, PointMap, VectorMap, SemanticMap, Kernel>; Reconstruction reconstruction( - input_range, point_map, normal_map, semantic_map, m_data, m_verbose, m_debug); + input_range, point_map, normal_map, semantic_map, m_data, m_parameters.verbose, m_parameters.debug); bool success = reconstruction.detect_planar_shapes(np); if (!success) { CGAL_assertion_msg(false, "ERROR: RECONSTRUCTION, DETECTING PLANAR SHAPES FAILED!");