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 75ce537e25c..0b8b0c97eee 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 @@ -165,8 +165,8 @@ int main(const int argc, const char** argv) { std::cout << "* number of events: " << num_events << std::endl; // Export. - std::cout << std::endl; - std::cout << "--- EXPORT: " << std::endl; + // std::cout << std::endl; + // std::cout << "--- EXPORT: " << std::endl; // Vertices. // std::string output_filename = "partition-vertices.xyz"; diff --git a/Kinetic_shape_reconstruction/include/CGAL/KSR/debug.h b/Kinetic_shape_reconstruction/include/CGAL/KSR/debug.h index db18e6bd2de..4cdf3d33240 100644 --- a/Kinetic_shape_reconstruction/include/CGAL/KSR/debug.h +++ b/Kinetic_shape_reconstruction/include/CGAL/KSR/debug.h @@ -312,7 +312,7 @@ public: using Random = CGAL::Random; Saver() : - m_path_prefix("/Users/monet/Documents/fork/pull-requests/kinetic/logs/"), + m_path_prefix(""), grey(Color(125, 125, 125)), red(Color(125, 0, 0)) { } diff --git a/Kinetic_shape_reconstruction/include/CGAL/KSR_3/Finalizer.h b/Kinetic_shape_reconstruction/include/CGAL/KSR_3/Finalizer.h index 246d9ff4e18..60f7c6f7eb7 100644 --- a/Kinetic_shape_reconstruction/include/CGAL/KSR_3/Finalizer.h +++ b/Kinetic_shape_reconstruction/include/CGAL/KSR_3/Finalizer.h @@ -962,14 +962,16 @@ private: if (m_verbose) { std::cout << "* created volumes: " << volumes.size() << std::endl; - if (m_export) dump_volumes(m_data, "volumes/final"); + if (m_export) 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); - std::cout << - " VOLUME " << std::to_string(i) << ": " - " pvertices: " << volume.pvertices.size() << - " pfaces: " << volume.pfaces.size() << std::endl; + if (m_debug) { + std::cout << + " VOLUME " << std::to_string(i) << ": " + " pvertices: " << volume.pvertices.size() << + " pfaces: " << volume.pfaces.size() << std::endl; + } } } @@ -1012,7 +1014,7 @@ private: volume_size, volume_centroid, map_volumes, queue); } - if (m_verbose) { + if (m_debug) { std::cout << "- FOUND VOLUME " << volume_index << ", (SIZE/BARYCENTER): " << volume_size << " / " << volume_centroid << std::endl; } @@ -1060,7 +1062,7 @@ private: false, query, volume_index, num_volumes, centroids, volume_size, volume_centroid, map_volumes, queue); } - if (m_verbose) { + if (m_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/Propagation.h b/Kinetic_shape_reconstruction/include/CGAL/KSR_3/Propagation.h index 1a2718565d2..f1854ab6631 100644 --- a/Kinetic_shape_reconstruction/include/CGAL/KSR_3/Propagation.h +++ b/Kinetic_shape_reconstruction/include/CGAL/KSR_3/Propagation.h @@ -984,7 +984,7 @@ private: PVertex crop_pvertex_along_iedge( const PVertex& pvertex, const IEdge& iedge) { - if (m_verbose) { + if (m_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; @@ -1010,7 +1010,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_verbose) std::cout << "- pvertex to iedge, parallel case" << std::endl; + if (m_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!"); } @@ -1018,7 +1018,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_verbose) { + if (m_debug) { std::cout << "- new pedge: " << m_data.str(pedge) << " between " << m_data.str(pvertex) << " and " << m_data.str(pother) << std::endl; } @@ -1032,7 +1032,7 @@ private: m_data.direction(pvertex) = future_direction_a; m_data.direction(pother) = future_direction_b; - if (m_verbose) std::cout << "- new pvertices: " << + if (m_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!"); @@ -1042,7 +1042,7 @@ private: std::array propagate_pvertex_beyond_iedge( const PVertex& pvertex, const IEdge& iedge) { - if (m_verbose) { + if (m_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; @@ -1056,7 +1056,7 @@ private: const PVertex propagated = m_data.add_pvertex(pvertex.first, original_point); m_data.direction(propagated) = original_direction; - if (m_verbose) { + if (m_debug) { std::cout << "- propagated: " << m_data.str(propagated) << ": " << m_data.point_3(propagated) << std::endl; } @@ -1068,7 +1068,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_verbose) { + if (m_debug) { std::cout << "- new pface " << m_data.str(new_pface) << ": " << m_data.centroid_of_pface(new_pface) << std::endl; } @@ -1080,7 +1080,7 @@ private: void crop_pedge_along_iedge( const PVertex& pvertex, const PVertex& pother, const IEdge& iedge) { - if (m_verbose) { + if (m_debug) { std::cout.precision(20); std::cout << "** cropping pedge [" << m_data.str(pvertex) << "-" << m_data.str(pother) << "] along " << m_data.str(iedge) << std::endl; @@ -1100,7 +1100,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_verbose) { + if (m_debug) { std::cout << "- prev pv: " << m_data.point_3(prev) << std::endl; std::cout << "- next pv: " << m_data.point_3(next) << std::endl; } @@ -1114,7 +1114,7 @@ private: } CGAL_assertion(pthird != m_data.null_pvertex()); - if (m_verbose) { + if (m_debug) { std::cout << "- pthird pv: " << m_data.point_3(pthird) << std::endl; } @@ -1122,7 +1122,7 @@ private: 0, IVertex(), pvertex, pthird, iedge, future_point, future_direction); CGAL_assertion(future_direction != Vector_2()); if (is_parallel) { - if (m_verbose) std::cout << "- pedge to iedge 1, parallel case" << std::endl; + if (m_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!"); } @@ -1136,7 +1136,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_verbose) { + if (m_debug) { std::cout << "- prev po: " << m_data.point_3(prev) << std::endl; std::cout << "- next po: " << m_data.point_3(next) << std::endl; } @@ -1150,7 +1150,7 @@ private: } CGAL_assertion(pthird != m_data.null_pvertex()); - if (m_verbose) { + if (m_debug) { std::cout << "- pthird po: " << m_data.point_3(pthird) << std::endl; } @@ -1158,7 +1158,7 @@ private: 0, IVertex(), pother, pthird, iedge, future_point, future_direction); CGAL_assertion(future_direction != Vector_2()); if (is_parallel) { - if (m_verbose) std::cout << "- pedge to iedge 2, parallel case" << std::endl; + if (m_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!"); } @@ -1177,7 +1177,7 @@ private: std::pair propagate_pedge_beyond_iedge( const PVertex& pvertex, const PVertex& pother, const IEdge& iedge) { - if (m_verbose) { + if (m_debug) { std::cout.precision(20); std::cout << "** propagating pedge [" << m_data.str(pvertex) << "-" << m_data.str(pother) << "] beyond " << m_data.str(iedge) << std::endl; @@ -1200,7 +1200,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_verbose) { + if (m_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) << ": " << @@ -1216,7 +1216,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_verbose) { + if (m_debug) { std::cout << "- new pface " << m_data.str(new_pface) << ": " << m_data.centroid_of_pface(new_pface) << std::endl; } @@ -1227,7 +1227,7 @@ private: bool transfer_pvertex_via_iedge( const PVertex& pvertex, const PVertex& pother) { - if (m_verbose) { + if (m_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 " @@ -1242,12 +1242,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_verbose) std::cout << "- swap pfaces" << std::endl; + if (m_debug) std::cout << "- swap pfaces" << std::endl; std::swap(source_pface, target_pface); } CGAL_assertion(common_pface == source_pface); - if (m_verbose) { + if (m_debug) { std::cout << "- initial pfaces: " << std::endl; if (source_pface != m_data.null_pface()) { std::cout << "source " << m_data.str(source_pface) << ": " << @@ -1262,7 +1262,7 @@ private: // Get pthird. PVertex pthird = m_data.next(pother); if (pthird == pvertex) pthird = m_data.prev(pother); - if (m_verbose) std::cout << "- pthird: " << m_data.point_3(pthird) << std::endl; + if (m_debug) std::cout << "- pthird: " << m_data.point_3(pthird) << std::endl; // Get future point and direction. CGAL_assertion(m_data.has_iedge(pvertex)); @@ -1280,7 +1280,7 @@ private: 0, IVertex(), pother, pthird, iedge, future_point, future_direction); CGAL_assertion(future_direction != Vector_2()); if (is_parallel) { - if (m_verbose) std::cout << "- transfer pvertex, parallel case" << std::endl; + if (m_debug) std::cout << "- transfer pvertex, parallel case" << std::endl; // CGAL_assertion_msg(!is_parallel, // "TODO: TRANSFER PVERTEX, HANDLE CASE WITH PARALLEL LINES!"); } @@ -1313,11 +1313,11 @@ private: CGAL_assertion(m_data.mesh(pedge).face(he) == common_pface.second); if (m_data.mesh(pedge).target(he) == pvertex.second) { - // if (m_verbose) std::cout << "- shifting target" << std::endl; + // if (m_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_verbose) std::cout << "- shifting source" << std::endl; + // if (m_debug) std::cout << "- shifting source" << std::endl; CGAL::Euler::shift_source(he, m_data.mesh(pedge)); } @@ -1335,7 +1335,7 @@ private: // "TODO: TRANSFER PVERTEX 2, ADD NEW FUTURE POINTS AND DIRECTIONS!"); } - if (m_verbose) { + if (m_debug) { std::cout << "- new pfaces: " << std::endl; if (source_pface != m_data.null_pface()) { std::cout << "source " << m_data.str(source_pface) << ": " << @@ -1356,7 +1356,7 @@ private: const PVertex& event_pvertex, const std::vector& pvertices, std::vector< std::pair >& crossed_iedges) { - if (m_verbose) { + if (m_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; @@ -1369,7 +1369,7 @@ private: const PVertex next = pvertices.back(); const PVertex pvertex = pvertices[1]; - if (m_verbose) { + if (m_debug) { const auto iedge = m_data.iedge(pvertex); if (iedge != m_data.null_iedge()) { std::cout << "- start from: " << m_data.str(iedge) << " " << @@ -1392,7 +1392,7 @@ private: CGAL_assertion_msg(false, "ERROR: INVALID CONNECTIVITY CASE!"); } - if (m_verbose) { + if (m_debug) { std::cout << "- found neighbors: " << std::endl << "prev = " << m_data.point_3(prev) << std::endl << "fron = " << m_data.point_3(front) << std::endl << @@ -1415,7 +1415,7 @@ private: m_data.support_plane(curr).set_point(curr.second, ipoint); } m_data.connect(pvertex, ivertex); - if (m_verbose) { + if (m_debug) { std::cout << "- frozen pvertex: " << m_data.str(pvertex) << " : " << m_data.point_3(pvertex) << std::endl; } @@ -1449,11 +1449,11 @@ private: } if (back_constrained && !front_constrained) { - if (m_verbose) std::cout << "- reverse iedges" << std::endl; + if (m_debug) std::cout << "- reverse iedges" << std::endl; std::reverse(iedges.begin(), iedges.end()); } - if (m_verbose) { + if (m_debug) { std::cout << "- initial iedges: " << iedges.size() << std::endl; for (const auto& iedge : iedges) { std::cout << m_data.str(iedge.first) << ": " << @@ -1493,7 +1493,7 @@ private: crossed_iedges.push_back(std::make_pair(m_data.iedge(pvertex), true)); } - if (m_verbose) { + if (m_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; @@ -1508,7 +1508,7 @@ private: void apply_closing_case(const PVertex& pvertex) const { - if (m_verbose) { + if (m_debug) { std::cout.precision(20); std::cout << "*** CLOSING CASE" << std::endl; } @@ -1527,7 +1527,7 @@ private: std::vector< std::pair >& crossed_iedges, std::vector& new_pvertices) { - if (m_verbose) { + if (m_debug) { std::cout.precision(20); std::cout << "*** BACK BORDER CASE" << std::endl; } @@ -1562,7 +1562,7 @@ private: Point_2 shifted_prev; const auto pp_curr = m_data.point_2(prev, curr_time); if (prev_diff < tol) { - if (m_verbose) std::cout << "- back, same time events, prev" << std::endl; + if (m_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); @@ -1579,28 +1579,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_verbose) std::cout << "- found same time iedge, prev" << std::endl; + if (m_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_verbose) std::cout << "- excluding iedge, prev" << std::endl; + if (m_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_verbose) std::cout << "- including iedge, prev" << std::endl; + if (m_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_verbose) std::cout << "- including iedge, prev" << std::endl; + if (m_debug) std::cout << "- including iedge, prev" << std::endl; } - if (m_verbose) { + if (m_debug) { std::cout << "- shifting prev: " << m_data.to_3d(pvertex.first, shifted_prev) << std::endl; } @@ -1634,7 +1634,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_verbose) { + if (m_debug) { std::cout << "- bbox: " << is_bbox_reached << "; limit: " << is_limit_reached << std::endl; } @@ -1650,7 +1650,7 @@ private: } CGAL_assertion(crossed_iedges.size() > 0); - if (m_verbose) { + if (m_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) << ": " << @@ -1672,12 +1672,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! - std::cout << "- back = prev, equal points case" << std::endl; + if (m_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 { - std::cout << "- back, prev, not equal points case" << std::endl; + if (m_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); } @@ -1695,7 +1695,7 @@ private: { // crop PVertex cropped = m_data.null_pvertex(); if (prev_iedge == iedge_0) { - if (m_verbose) std::cout << "- back, prev, parallel case" << std::endl; + if (m_debug) std::cout << "- back, prev, parallel case" << std::endl; // In case, we are parallel, we update the future point and direction. cropped = prev; @@ -1704,7 +1704,7 @@ private: 0, ivertex, prev, pprev, prev_iedge, future_point, future_direction); } else { - if (m_verbose) std::cout << "- back, prev, standard case" << std::endl; + if (m_debug) std::cout << "- back, prev, standard case" << std::endl; cropped = PVertex(pvertex.first, m_data.support_plane(pvertex).split_edge(pvertex.second, prev.second)); } @@ -1721,7 +1721,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_verbose) std::cout << "- cropped: " << + if (m_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)); @@ -1744,7 +1744,7 @@ private: std::vector< std::pair >& crossed_iedges, std::vector& new_pvertices) { - if (m_verbose) { + if (m_debug) { std::cout.precision(20); std::cout << "*** FRONT BORDER CASE" << std::endl; } @@ -1779,7 +1779,7 @@ private: Point_2 shifted_next; const auto pn_curr = m_data.point_2(next, curr_time); if (next_diff < tol) { - if (m_verbose) std::cout << "- front, same time events, next" << std::endl; + if (m_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); @@ -1795,28 +1795,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_verbose) std::cout << "- found same time iedge, next" << std::endl; + if (m_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_verbose) std::cout << "- excluding iedge, next" << std::endl; + if (m_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_verbose) std::cout << "- including iedge, next" << std::endl; + if (m_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_verbose) std::cout << "- including iedge, next" << std::endl; + if (m_debug) std::cout << "- including iedge, next" << std::endl; } - if (m_verbose) { + if (m_debug) { std::cout << "- shifting next: " << m_data.to_3d(pvertex.first, shifted_next) << std::endl; } @@ -1850,7 +1850,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_verbose) { + if (m_debug) { std::cout << "- bbox: " << is_bbox_reached << "; limit: " << is_limit_reached << std::endl; } @@ -1866,7 +1866,7 @@ private: } CGAL_assertion(crossed_iedges.size() > 0); - if (m_verbose) { + if (m_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) << ": " << @@ -1886,11 +1886,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()) { - std::cout << "- front = next, equal points case" << std::endl; + if (m_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 { - std::cout << "- front, next, not equal points case" << std::endl; + if (m_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); } @@ -1908,7 +1908,7 @@ private: { // crop PVertex cropped = m_data.null_pvertex(); if (next_iedge == iedge_0) { - if (m_verbose) std::cout << "- front, next, parallel case" << std::endl; + if (m_debug) std::cout << "- front, next, parallel case" << std::endl; // In case, we are parallel, we update the future point and direction. cropped = next; @@ -1917,7 +1917,7 @@ private: 0, ivertex, next, nnext, next_iedge, future_point, future_direction); } else { - if (m_verbose) std::cout << "- front, next, standard case" << std::endl; + if (m_debug) std::cout << "- front, next, standard case" << std::endl; cropped = PVertex(pvertex.first, m_data.support_plane(pvertex).split_edge(pvertex.second, next.second)); } @@ -1934,7 +1934,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_verbose) std::cout << "- cropped: " << + if (m_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)); @@ -1959,7 +1959,7 @@ private: std::vector< std::pair >& crossed_iedges, std::vector& new_pvertices) { - if (m_verbose) { + if (m_debug) { std::cout.precision(20); std::cout << "*** OPEN CASE" << std::endl; } @@ -1999,7 +1999,7 @@ private: Point_2 shifted_prev; const auto pp_curr = m_data.point_2(prev, curr_time); if (prev_diff < tol) { - if (m_verbose) std::cout << "- open, same time events, prev" << std::endl; + if (m_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); @@ -2015,31 +2015,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_verbose) std::cout << "- found same time iedge, prev" << std::endl; + if (m_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_verbose) std::cout << "- excluding iedge, prev" << std::endl; + if (m_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_verbose) std::cout << "- including iedge, prev" << std::endl; + if (m_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_verbose) std::cout << "- including iedge, prev" << std::endl; + if (m_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_verbose) std::cout << "- open, same time events, next" << std::endl; + if (m_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); @@ -2055,28 +2055,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_verbose) std::cout << "- found same time iedge, next" << std::endl; + if (m_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_verbose) std::cout << "- excluding iedge, next" << std::endl; + if (m_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_verbose) std::cout << "- including iedge, next" << std::endl; + if (m_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_verbose) std::cout << "- including iedge, next" << std::endl; + if (m_debug) std::cout << "- including iedge, next" << std::endl; } - if (m_verbose) { + if (m_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; } @@ -2130,7 +2130,7 @@ private: } CGAL_assertion(crossed_iedges.size() > 0); - if (m_verbose) { + if (m_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) << ": " << @@ -2148,23 +2148,27 @@ private: new_pvertices.clear(); new_pvertices.resize(crossed_iedges.size(), m_data.null_pvertex()); - if (m_verbose) std::cout << "- open, 1 edge case" << std::endl; + if (m_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; 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; + is_parallel = m_data.compute_future_point_and_direction( + pvertex, ivertex, prev, next, + crossed_iedges[0].first, future_point, future_direction); } - const bool 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_verbose) std::cout << "- parallel case" << std::endl; + if (m_debug) std::cout << "- parallel case" << std::endl; CGAL_assertion_msg(!is_parallel, "TODO: OPEN, 1 EDGE CASE, ADD PARALLEL CASE!"); } else { - if (m_verbose) std::cout << "- standard case" << std::endl; + if (m_debug) std::cout << "- standard case" << std::endl; } const auto cropped1 = PVertex(pvertex.first, m_data.support_plane(pvertex).split_edge(pvertex.second, next.second)); @@ -2188,7 +2192,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_verbose) std::cout << "- cropped: " << + if (m_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)); @@ -2210,14 +2214,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_verbose) std::cout << "- getting future point and direction, front" << std::endl; + if (m_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()) { - std::cout << "- prev = next, equal points case" << std::endl; + if (m_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 { - std::cout << "- prev, next, not equal points case" << std::endl; + if (m_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()); @@ -2239,14 +2243,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_verbose) std::cout << "- getting future point and direction, back" << std::endl; + if (m_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()) { - std::cout << "- prev = next, equal points case" << std::endl; + if (m_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 { - std::cout << "- prev, next, not equal points case" << std::endl; + if (m_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()); @@ -2268,7 +2272,7 @@ private: { // first crop PVertex cropped = m_data.null_pvertex(); if (next_iedge == crossed_iedges.front().first) { - if (m_verbose) std::cout << "- open, next, parallel case" << std::endl; + if (m_debug) std::cout << "- open, next, parallel case" << std::endl; // In case, we are parallel, we update the future point and direction. cropped = next; @@ -2277,7 +2281,7 @@ private: 0, ivertex, next, nnext, next_iedge, future_points.front(), future_directions.front()); } else { - if (m_verbose) std::cout << "- open, next, standard case" << std::endl; + if (m_debug) std::cout << "- open, next, standard case" << std::endl; cropped = PVertex(pvertex.first, m_data.support_plane(pvertex).split_edge(pvertex.second, next.second)); } @@ -2294,7 +2298,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_verbose) std::cout << "- cropped 1: " << + if (m_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)); @@ -2303,7 +2307,7 @@ private: { // second crop PVertex cropped = m_data.null_pvertex(); if (prev_iedge == crossed_iedges.back().first) { - if (m_verbose) std::cout << "- open, prev, parallel case" << std::endl; + if (m_debug) std::cout << "- open, prev, parallel case" << std::endl; // In case, we are parallel, we update the future point and direction. cropped = prev; @@ -2312,7 +2316,7 @@ private: 0, ivertex, prev, pprev, prev_iedge, future_points.back(), future_directions.back()); } else { - if (m_verbose) std::cout << "- open, prev, standard case" << std::endl; + if (m_debug) std::cout << "- open, prev, standard case" << std::endl; cropped = PVertex(pvertex.first, m_data.support_plane(pvertex).split_edge(pvertex.second, prev.second)); } @@ -2329,7 +2333,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_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 bffd680b426..6b2ddfafd99 100644 --- a/Kinetic_shape_reconstruction/include/CGAL/Kinetic_shape_reconstruction_3.h +++ b/Kinetic_shape_reconstruction/include/CGAL/Kinetic_shape_reconstruction_3.h @@ -209,7 +209,7 @@ public: timer.stop(); const double time_to_finalize = timer.time(); if (m_verbose) { - std::cout << "* found " << m_data.number_of_volumes(-1) << " volumes" << std::endl; + 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);