diff --git a/Arrangement_on_surface_2/include/CGAL/Draw_aos/Arr_viewer.h b/Arrangement_on_surface_2/include/CGAL/Draw_aos/Arr_viewer.h index 4c17790b9ea..9c63f02524d 100644 --- a/Arrangement_on_surface_2/include/CGAL/Draw_aos/Arr_viewer.h +++ b/Arrangement_on_surface_2/include/CGAL/Draw_aos/Arr_viewer.h @@ -16,7 +16,8 @@ #ifndef ARR_VIEWER_H #define ARR_VIEWER_H -#include "CGAL/Draw_aos/type_utils.h" +#include + #include #include #include @@ -31,22 +32,22 @@ #include #include -#include #include #include #include #include -#include -#include +#include "CGAL/Draw_aos/type_utils.h" #include #include +#include +#include +#include namespace CGAL { namespace draw_aos { template -class Arr_viewer : public Qt::Basic_viewer -{ +class Arr_viewer : public Qt::Basic_viewer { using Basic_viewer = Qt::Basic_viewer; using Vertex_const_handle = typename Arrangement::Vertex_const_handle; using Halfedge_const_handle = typename Arrangement::Halfedge_const_handle; @@ -64,9 +65,7 @@ private: this->camera_->computeModelViewMatrix(); this->camera_->getProjectionMatrix(proj_mat.data()); this->camera_->getModelViewMatrix(mv_mat.data()); - if(proj_mat == m_last_proj_matrix && mv_mat == m_last_modelview_matrix) { - return false; - } + if (proj_mat == m_last_proj_matrix && mv_mat == m_last_modelview_matrix) return false; m_last_proj_matrix = proj_mat; m_last_modelview_matrix = mv_mat; return true; @@ -85,18 +84,19 @@ private: QMatrix4x4 inverse_mvp = (projection_matrix * modelview_matrix).inverted(); // Define 4 corners of the near plane in NDC (-1 to 1 in x and y) - QVector4D clip_space_corners[] = {QVector4D(-1.0, -1.0, 0.0, 1.0), QVector4D(-1.0, 1.0, 0.0, 1.0), - QVector4D(1.0, -1.0, 0.0, 1.0), QVector4D(1.0, 1.0, 0.0, 1.0)}; + QVector4D clip_space_corners[] = { + QVector4D(-1.0, -1.0, 0.0, 1.0), QVector4D(-1.0, 1.0, 0.0, 1.0), + QVector4D(1.0, -1.0, 0.0, 1.0), QVector4D(1.0, 1.0, 0.0, 1.0) + }; double xmin = std::numeric_limits::max(); double xmax = std::numeric_limits::lowest(); double ymin = std::numeric_limits::max(); double ymax = std::numeric_limits::lowest(); - for(const QVector4D& corner : clip_space_corners) { + for (const QVector4D& corner : clip_space_corners) { QVector4D world = inverse_mvp * corner; - if(world.w() != 0.0) - world /= world.w(); + if (world.w() != 0.0) world /= world.w(); double x = world.x(); double y = world.y(); @@ -109,10 +109,11 @@ private: return Bbox_2(xmin, ymin, xmax, ymax); } + /*! + */ double get_approx_error(const Bbox_2& bbox) const { - if constexpr(Traits_adaptor::Approximation_sizing_factor == 0.0) { + if constexpr(Traits_adaptor::Approximation_sizing_factor == 0.0) return std::numeric_limits::max(); - } std::array viewport; camera_->getViewport(viewport.data()); double viewport_width = static_cast(viewport[2]); @@ -121,16 +122,21 @@ private: } public: + /*! + */ Arr_viewer(QWidget* parent, const Arrangement& arr, Graphics_scene_options options, - const char* title = "Arrangement Viewer") - : Basic_viewer(parent, m_scene, title) - , m_scene_options(options) - , m_arr(arr) - , m_feature_portals(Arr_portals(*arr.geometry_traits()).create(arr)) - , m_pl(arr) {} + const char* title = "Arrangement Viewer") : + Basic_viewer(parent, m_scene, title), + m_scene_options(options), + m_arr(arr), + m_feature_portals(Arr_portals(*arr.geometry_traits()).create(arr)), + m_pl(arr) + {} + /*! + */ void render_arr(const Bbox_2& bbox) { Arr_render_context ctx(m_arr, m_pl, m_feature_portals, get_approx_error(bbox)); Arr_bounded_renderer renderer(ctx, bbox); @@ -143,60 +149,47 @@ public: #endif // add faces - for(const auto& [fh, face_tris] : cache.face_cache()) { + for (const auto& [fh, face_tris] : cache.face_cache()) { const auto& points = face_tris.points; const auto& tris = face_tris.triangles; bool draw_face = m_scene_options.colored_face(m_arr, fh); - for(const auto& t : tris) { - if(draw_face) { - m_scene.face_begin(m_scene_options.face_color(m_arr, fh)); - } else { - m_scene.face_begin(); - } - for(const auto idx : t) { - m_scene.add_point_in_face(points[idx]); - } + for (const auto& t : tris) { + if (draw_face) m_scene.face_begin(m_scene_options.face_color(m_arr, fh)); + else m_scene.face_begin(); + for (const auto idx : t) m_scene.add_point_in_face(points[idx]); m_scene.face_end(); } } // add edges - for(const auto& [he, polyline] : cache.halfedge_cache()) { - if(polyline.size() < 2) { - continue; - } + for (const auto& [he, polyline] : cache.halfedge_cache()) { + if (polyline.size() < 2) continue; bool draw_colored_edge = m_scene_options.colored_edge(m_arr, he); auto color = draw_colored_edge ? m_scene_options.edge_color(m_arr, he) : CGAL::IO::Color(); - for(size_t i = 0; i < polyline.size() - 1; ++i) { + for (size_t i = 0; i < polyline.size() - 1; ++i) { const auto& cur_pt = polyline[i]; const auto& next_pt = polyline[i + 1]; auto mid_pt = CGAL::midpoint(cur_pt, next_pt); - if(mid_pt.x() <= bbox.xmin() || mid_pt.x() > bbox.xmax() || mid_pt.y() <= bbox.ymin() || - mid_pt.y() > bbox.ymax()) + if (mid_pt.x() <= bbox.xmin() || mid_pt.x() > bbox.xmax() || mid_pt.y() <= bbox.ymin() || + mid_pt.y() > bbox.ymax()) { continue; } - if(draw_colored_edge) { - m_scene.add_segment(cur_pt, next_pt, color); - } else { - m_scene.add_segment(cur_pt, next_pt); - } + if (draw_colored_edge) m_scene.add_segment(cur_pt, next_pt, color); + else m_scene.add_segment(cur_pt, next_pt); } } // add vertices - for(const auto& [vh, pt] : cache.vertex_cache()) { - if(m_scene_options.colored_vertex(m_arr, vh)) { - m_scene.add_point(pt, m_scene_options.vertex_color(m_arr, vh)); - } else { - m_scene.add_point(pt); - } + for (const auto& [vh, pt] : cache.vertex_cache()) { + if (m_scene_options.colored_vertex(m_arr, vh)) m_scene.add_point(pt, m_scene_options.vertex_color(m_arr, vh)); + else m_scene.add_point(pt); } // If there's nothing to render, we fill the bbox with background color. // This is to keep the Basic_viewer working in 2D mode. - if(m_scene.empty()) { + if (m_scene.empty()) { m_scene.face_begin(CGAL::IO::Color(255, 255, 255)); // White, by now using Approx_point = typename Arr_approximation_geometry_traits::Approx_point; m_scene.add_point_in_face(Approx_point(bbox.xmin(), bbox.ymin())); @@ -207,14 +200,18 @@ public: } } + /*! + */ void rerender(Bbox_2 bbox) { m_scene.clear(); render_arr(bbox); Basic_viewer::redraw(); } + /*! + */ virtual void draw() override { - if(is_camera_changed()) { + if (is_camera_changed()) { Bbox_2 bbox = view_bbox_from_camera(); #if defined(CGAL_DRAW_AOS_DEBUG) double dx = (bbox.xmax() - bbox.xmin()) * 0.1; @@ -227,6 +224,8 @@ public: Basic_viewer::draw(); } + /*! + */ virtual ~Arr_viewer() {} private: diff --git a/Arrangement_on_surface_2/include/CGAL/Draw_aos/type_utils.h b/Arrangement_on_surface_2/include/CGAL/Draw_aos/type_utils.h index 778bdb8676e..379993d24d8 100644 --- a/Arrangement_on_surface_2/include/CGAL/Draw_aos/type_utils.h +++ b/Arrangement_on_surface_2/include/CGAL/Draw_aos/type_utils.h @@ -26,21 +26,17 @@ enum class Side_of_boundary { }; template > -struct has_construct_x_monotone_curve_2 : std::false_type -{}; +struct has_construct_x_monotone_curve_2 : std::false_type {}; template -struct has_construct_x_monotone_curve_2> : std::true_type -{}; +struct has_construct_x_monotone_curve_2> : std::true_type {}; template > -struct has_approximate_2_object : std::false_type -{}; +struct has_approximate_2_object : std::false_type {}; // Specialization: detection succeeds if decltype(T::approximate_2_object()) is valid template -struct has_approximate_2_object().approximate_2_object())>> : std::true_type -{}; +struct has_approximate_2_object().approximate_2_object())>> : std::true_type {}; // Convenience variable template @@ -49,13 +45,12 @@ inline constexpr bool has_approximate_2_object_v = has_approximate_2_object:: // Primary templates: detection fails by default // Does a class have operator()(const Point&)? template > -struct has_operator_point : std::false_type -{}; +struct has_operator_point : std::false_type {}; // Specialization: detection succeeds if decltype works out template -struct has_operator_point()(std::declval()))>> - : std::true_type +struct has_operator_point()(std::declval()))>> : + std::true_type {}; // Convenience variable @@ -65,9 +60,10 @@ inline constexpr bool has_operator_point_v = has_operator_point::value; // Primary templates: detection fails by default // Does a class have operator()(const X_monotone_curve&)? template > -struct has_operator_xcv : std::false_type -{}; +struct has_operator_xcv : std::false_type {}; +/*! + */ template struct has_operator_xcv constexpr bool has_operator_xcv_v = has_operator_xcv::value; +/*! + */ template -struct Traits_adaptor_base -{ +struct Traits_adaptor_base { public: using Geom_traits = GeomTraits; using Point_2 = typename Geom_traits::Point_2; @@ -94,12 +91,15 @@ public: using Compare_xy_2 = typename Geom_traits::Compare_xy_2; }; +/*! + */ template struct Traits_adaptor; +/*! + */ template -struct Traits_adaptor> : public Traits_adaptor_base> -{ +struct Traits_adaptor> : public Traits_adaptor_base> { private: using Geom_traits = Arr_segment_traits_2; @@ -113,10 +113,11 @@ public: using Approximate_point_2 = typename Geom_traits::Approximate_point_2; }; +/*! + */ template -struct Traits_adaptor> - : public Traits_adaptor_base> -{ +struct Traits_adaptor> : + public Traits_adaptor_base> { private: using Geom_traits = Arr_non_caching_segment_traits_2; @@ -130,10 +131,11 @@ public: using Approximate_point_2 = typename Geom_traits::Approximate_point_2; }; +/*! + */ template -struct Traits_adaptor> - : public Traits_adaptor_base> -{ +struct Traits_adaptor> : + public Traits_adaptor_base> { private: using Geom_traits = Arr_polyline_traits_2; using Sub_traits = SegmentTraits; @@ -149,10 +151,11 @@ public: using Approximate_point_2 = typename Adapted_sub_traits::Approximate_point_2; }; +/*! + */ template -struct Traits_adaptor> - : public Traits_adaptor_base> -{ +struct Traits_adaptor> : + public Traits_adaptor_base> { private: using Sub_traits = SubcurveTraits; using Geom_traits = Arr_polycurve_traits_2; @@ -168,9 +171,10 @@ public: using Approximate_point_2 = typename Adapted_sub_traits::Approximate_point_2; }; +/*! + */ template -struct Traits_adaptor> : public Traits_adaptor_base> -{ +struct Traits_adaptor> : public Traits_adaptor_base> { private: using Geom_traits = Arr_segment_traits_2; @@ -184,10 +188,11 @@ public: using Approximate_point_2 = typename Geom_traits::Approximate_point_2; }; +/*! + */ template -struct Traits_adaptor> - : public Traits_adaptor_base> -{ +struct Traits_adaptor> : + public Traits_adaptor_base> { private: using Geom_traits = Arr_conic_traits_2; @@ -201,10 +206,11 @@ public: using Approximate_point_2 = typename Geom_traits::Approximate_point_2; }; +/*! + */ template -struct Traits_adaptor> - : public Traits_adaptor_base> -{ +struct Traits_adaptor> : + public Traits_adaptor_base> { private: using Geom_traits = Arr_circle_segment_traits_2; using Base = Traits_adaptor_base; @@ -219,10 +225,11 @@ public: using Approximate_point_2 = typename Geom_traits::Approximate_point_2; }; +/*! + */ template -struct Traits_adaptor> - : public Traits_adaptor_base> -{ +struct Traits_adaptor> : + public Traits_adaptor_base> { private: using Geom_traits = Arr_rational_function_traits_2; @@ -238,18 +245,20 @@ public: using Approximate_point_2 = typename Approximate_kernel::Point_2; }; +/*! + */ template -class Construct_coordinate -{ +class Construct_coordinate { using FT = typename Traits_adaptor::FT; public: FT operator()(double val) const { return FT(val); } }; +/*! + */ template -class Construct_coordinate> -{ +class Construct_coordinate> { using FT = typename Traits_adaptor>::FT; using Bound = typename Kernel::Bound; @@ -257,9 +266,10 @@ public: FT operator()(double val) const { return FT(Bound(val)); } }; +/*! + */ template -class Arr_approximation_geometry_traits -{ +class Arr_approximation_geometry_traits { using Adapted_traits = Traits_adaptor; public: @@ -271,8 +281,7 @@ public: using Polyline_geom = Apporx_point_vec; using Triangle = std::array; using Triangle_vec = std::vector; - struct Triangulated_face - { + struct Triangulated_face { Apporx_point_vec points; Triangle_vec triangles; }; @@ -281,4 +290,4 @@ public: } // namespace draw_aos } // namespace CGAL -#endif // CGAL_DRAW_AOS_TYPE_UTILS_H \ No newline at end of file +#endif // CGAL_DRAW_AOS_TYPE_UTILS_H diff --git a/Arrangement_on_surface_2/include/CGAL/draw_arrangement_2.h b/Arrangement_on_surface_2/include/CGAL/draw_arrangement_2.h index 7812116c3e4..acbcc4415ce 100644 --- a/Arrangement_on_surface_2/include/CGAL/draw_arrangement_2.h +++ b/Arrangement_on_surface_2/include/CGAL/draw_arrangement_2.h @@ -16,6 +16,8 @@ #ifndef CGAL_DRAW_ARRANGEMENT_2_H #define CGAL_DRAW_ARRANGEMENT_2_H +#include + #include #include #include @@ -27,7 +29,6 @@ #include #include #include -#include #include #include @@ -44,13 +45,11 @@ namespace draw_function_for_arrangement_2 { // Primary templates: detection fails by default // Does the traits have approximate_2_object()? template > -struct has_approximate_2_object : std::false_type -{}; +struct has_approximate_2_object : std::false_type {}; // Specialization: detection succeeds if decltype(T::approximate_2_object()) is valid template -struct has_approximate_2_object().approximate_2_object())>> : std::true_type -{}; +struct has_approximate_2_object().approximate_2_object())>> : std::true_type {}; // Convenience variable template @@ -61,8 +60,7 @@ inline constexpr bool has_approximate_2_object_v = has_approximate_2_object:: // Primary templates: detection fails by default // Does a class have operator()(const Point&)? template > -struct has_operator_point : std::false_type -{}; +struct has_operator_point : std::false_type {}; // Specialization: detection succeeds if decltype works out template @@ -79,8 +77,7 @@ inline constexpr bool has_operator_point_v = has_operator_point::value; // Primary templates: detection fails by default // Does a class have operator()(const X_monotone_curve&)? template > -struct has_operator_xcv : std::false_type -{}; +struct has_operator_xcv : std::false_type {}; // Specialization: detection succeeds if decltype works out struct Dummy_output @@ -104,8 +101,7 @@ inline constexpr bool has_operator_xcv_v = has_operator_xcv::value; // Helper: detect whether T is or derives from Arr_geodesic_arc_on_sphere_traits_2<*, *, *> template -struct is_or_derived_from_agas -{ +struct is_or_derived_from_agas { private: template static std::true_type test(const Arr_geodesic_arc_on_sphere_traits_2*); @@ -123,8 +119,7 @@ inline constexpr bool is_or_derived_from_agas_v = is_or_derived_from_agas::va /// template -class Draw_arr_tool -{ +class Draw_arr_tool { public: using Halfedge_const_handle = typename Arr::Halfedge_const_handle; using Vertex_const_handle = typename Arr::Vertex_const_handle; @@ -138,18 +133,18 @@ public: /*! Construct */ - Draw_arr_tool(Arr& a_aos, CGAL::Graphics_scene& a_gs, const GSOptions& a_gso) - : m_aos(a_aos) - , m_gs(a_gs) - , m_gso(a_gso) {} + Draw_arr_tool(Arr& a_aos, CGAL::Graphics_scene& a_gs, const GSOptions& a_gso) : + m_aos(a_aos), + m_gs(a_gs), + m_gso(a_gso) + {} /// Add a face. void add_face(Face_const_handle face) { // std::cout << "add_face()\n"; - for(Inner_ccb_const_iterator it = face->inner_ccbs_begin(); it != face->inner_ccbs_end(); ++it) - add_ccb(*it); + for (Inner_ccb_const_iterator it = face->inner_ccbs_begin(); it != face->inner_ccbs_end(); ++it) add_ccb(*it); - for(Outer_ccb_const_iterator it = face->outer_ccbs_begin(); it != face->outer_ccbs_end(); ++it) { + for (Outer_ccb_const_iterator it = face->outer_ccbs_begin(); it != face->outer_ccbs_end(); ++it) { add_ccb(*it); draw_region(*it); } @@ -161,8 +156,7 @@ public: auto curr = circ; do { auto new_face = curr->twin()->face(); - if(m_visited.find(new_face) != m_visited.end()) - continue; + if (m_visited.find(new_face) != m_visited.end()) continue; m_visited[new_face] = true; add_face(new_face); } while(++curr != circ); @@ -186,10 +180,8 @@ public: * * For now we use C++14 features. */ - if(m_gso.colored_face(m_aos, circ->face())) - m_gs.face_begin(m_gso.face_color(m_aos, circ->face())); - else - m_gs.face_begin(); + if (m_gso.colored_face(m_aos, circ->face())) m_gs.face_begin(m_gso.face_color(m_aos, circ->face())); + else m_gs.face_begin(); const auto* traits = this->m_aos.geometry_traits(); auto ext = find_smallest(circ, *traits); @@ -197,8 +189,7 @@ public: do { // Skip halfedges that are "antenas": - while(curr->face() == curr->twin()->face()) - curr = curr->twin()->next(); + while(curr->face() == curr->twin()->face()) curr = curr->twin()->next(); draw_region_impl1(*traits, curr); curr = curr->next(); } while(curr != ext); @@ -210,22 +201,19 @@ public: /// template , int> = 0> - void draw_region_impl2(const T& /* traits */, const A& /* approximate */, Halfedge_const_handle curr) { - draw_exact_region(curr); - } + void draw_region_impl2(const T& /* traits */, const A& /* approximate */, Halfedge_const_handle curr) + { draw_exact_region(curr); } /// template , int> = 0> - auto draw_region_impl2(const T& /* traits */, const A& approx, Halfedge_const_handle curr) { - draw_approximate_region(curr, approx); - } + auto draw_region_impl2(const T& /* traits */, const A& approx, Halfedge_const_handle curr) + { draw_approximate_region(curr, approx); } /*! Draw a region, where the traits does not has approximate_2_object. */ template && !is_or_derived_from_agas_v, int> = 0> - void draw_region_impl1(const T& /* traits */, Halfedge_const_handle curr) { - draw_exact_region(curr); - } + void draw_region_impl1(const T& /* traits */, Halfedge_const_handle curr) + { draw_exact_region(curr); } /// template && !is_or_derived_from_agas_v, int> = 0> @@ -255,12 +243,10 @@ public: double error(0.01); // TODO? (this->pixel_ratio()); bool l2r = curr->direction() == ARR_LEFT_TO_RIGHT; approx(curr->curve(), error, std::back_inserter(polyline), l2r); - if(polyline.empty()) - return; + if (polyline.empty()) return; auto it = polyline.begin(); auto prev = it++; - for(; it != polyline.end(); prev = it++) - m_gs.add_point_in_face(*prev); + for (; it != polyline.end(); prev = it++) m_gs.add_point_in_face(*prev); } /*! Draw an exact curve. @@ -271,10 +257,8 @@ public: auto ctr_min = traits->construct_min_vertex_2_object(); auto ctr_max = traits->construct_max_vertex_2_object(); m_gs.add_segment(ctr_min(curve), ctr_max(curve)); - if(colored) - m_gs.add_segment(ctr_min(curve), ctr_max(curve), c); - else - m_gs.add_segment(ctr_min(curve), ctr_max(curve)); + if (colored) m_gs.add_segment(ctr_min(curve), ctr_max(curve), c); + else m_gs.add_segment(ctr_min(curve), ctr_max(curve)); } /*! Draw a region in an exact manner. @@ -284,10 +268,8 @@ public: /// Add all faces. template - void add_faces(const Traits&) { - for(auto it = m_aos.unbounded_faces_begin(); it != m_aos.unbounded_faces_end(); ++it) - add_face(it); - } + void add_faces(const Traits&) + { for (auto it = m_aos.unbounded_faces_begin(); it != m_aos.unbounded_faces_end(); ++it) add_face(it); } /// Compile time dispatching @@ -295,47 +277,39 @@ public: */ template void draw_approximate_point(const Point& p, const Approximate& approx, bool colored, const CGAL::IO::Color& color) { - if(colored) - m_gs.add_point(approx(p), color); - else - m_gs.add_point(approx(p)); + if (colored) m_gs.add_point(approx(p), color); + else m_gs.add_point(approx(p)); } /// void draw_exact_point(const Point& p, bool colored, const CGAL::IO::Color& color) { - if(colored) - m_gs.add_point(p, color); - else - m_gs.add_point(p); + if (colored) m_gs.add_point(p, color); + else m_gs.add_point(p); } /// template , int> = 0> - void draw_point_impl2( - const T& /* traits */, const A& /* approximate */, const Point& p, bool colored, const CGAL::IO::Color& c) { - draw_exact_point(p, colored, c); - } + void draw_point_impl2(const T& /* traits */, const A& /* approximate */, const Point& p, bool colored, + const CGAL::IO::Color& c) + { draw_exact_point(p, colored, c); } /// template , int> = 0> auto - draw_point_impl2(const T& /* traits */, const A& approx, const Point& p, bool colored, const CGAL::IO::Color& c) { - draw_approximate_point(p, approx, colored, c); - } + draw_point_impl2(const T& /* traits */, const A& approx, const Point& p, bool colored, const CGAL::IO::Color& c) + { draw_approximate_point(p, approx, colored, c); } /*! Draw a point, where the traits does not has approximate_2_object. */ template && !is_or_derived_from_agas_v, int> = 0> - void draw_point_impl1(const T& /* traits */, const Point& p, bool colored, const CGAL::IO::Color& c) { - draw_exact_point(p, colored, c); - } + void draw_point_impl1(const T& /* traits */, const Point& p, bool colored, const CGAL::IO::Color& c) + { draw_exact_point(p, colored, c); } /*! Draw a point, where the traits does have approximate_2_object. */ template && !is_or_derived_from_agas_v, int> = 0> - auto draw_point_impl1(const T& traits, const Point& p, bool colored, const CGAL::IO::Color& c) { - draw_point_impl2(traits, traits.approximate_2_object(), p, colored, c); - } + auto draw_point_impl1(const T& traits, const Point& p, bool colored, const CGAL::IO::Color& c) + { draw_point_impl2(traits, traits.approximate_2_object(), p, colored, c); } /*! Draw a geodesic point. */ @@ -352,10 +326,8 @@ public: auto z = ap.dz(); auto l = std::sqrt(x * x + y * y + z * z); Approx_point_3 p3(x / l, y / l, z / l); - if(colored) - m_gs.add_point(p3, color); - else - m_gs.add_point(p3); + if (colored) m_gs.add_point(p3, color); + else m_gs.add_point(p3); } /// Draw a point. @@ -367,9 +339,8 @@ public: /// template Halfedge_const_handle find_smallest(Ccb_halfedge_const_circulator circ, - Arr_geodesic_arc_on_sphere_traits_2 const&) { - return circ; - } + Arr_geodesic_arc_on_sphere_traits_2 const&) + { return circ; } /*! Find the halfedge incident to the lexicographically smallest vertex * along the CCB, such that there is no other halfedge underneath. @@ -383,9 +354,7 @@ public: // Find the first halfedge directed from left to right auto curr = circ; - do - if(curr->direction() == CGAL::ARR_LEFT_TO_RIGHT) - break; + do if (curr->direction() == CGAL::ARR_LEFT_TO_RIGHT) break; while(++curr != circ); Halfedge_const_handle ext = curr; @@ -393,25 +362,22 @@ public: // such that there is no other halfedge underneath. do { // Discard edges not directed from left to right: - if(curr->direction() != CGAL::ARR_LEFT_TO_RIGHT) - continue; + if (curr->direction() != CGAL::ARR_LEFT_TO_RIGHT) continue; auto res = cmp_xy(curr->source()->point(), ext->source()->point()); // Discard the edges inciden to a point strictly larger than the point // incident to the stored extreme halfedge: - if(res == LARGER) - continue; + if (res == LARGER) continue; // Store the edge inciden to a point strictly smaller: - if(res == SMALLER) { + if (res == SMALLER) { ext = curr; continue; } // The incident points are equal; compare the halfedges themselves: - if(cmp_y(curr->curve(), ext->curve(), curr->source()->point()) == SMALLER) - ext = curr; + if (cmp_y(curr->curve(), ext->curve(), curr->source()->point()) == SMALLER) ext = curr; } while(++curr != circ); return ext; @@ -423,33 +389,28 @@ public: // std::cout << "ratio: " << this->pixel_ratio() << std::endl; m_visited.clear(); - if(m_aos.is_empty()) - return; + if (m_aos.is_empty()) return; - if(m_gso.are_faces_enabled()) + if (m_gso.are_faces_enabled()) add_faces(*(this->m_aos.geometry_traits())); // Add edges that do not separate faces. - if(m_gso.are_edges_enabled()) { - for(auto it = m_aos.edges_begin(); it != m_aos.edges_end(); ++it) { - if(it->face() != it->twin()->face()) { - if(m_gso.draw_edge(m_aos, it)) { - if(m_gso.colored_edge(m_aos, it)) - draw_curve(it->curve(), true, m_gso.edge_color(m_aos, it)); - else - draw_curve(it->curve(), false, CGAL::IO::Color()); + if (m_gso.are_edges_enabled()) { + for (auto it = m_aos.edges_begin(); it != m_aos.edges_end(); ++it) { + if (it->face() != it->twin()->face()) { + if (m_gso.draw_edge(m_aos, it)) { + if (m_gso.colored_edge(m_aos, it)) draw_curve(it->curve(), true, m_gso.edge_color(m_aos, it)); + else draw_curve(it->curve(), false, CGAL::IO::Color()); } } } } // Add all points - if(m_gso.are_vertices_enabled()) { - for(auto it = m_aos.vertices_begin(); it != m_aos.vertices_end(); ++it) { - if(m_gso.colored_vertex(m_aos, it)) - draw_point(it->point(), true, m_gso.vertex_color(m_aos, it)); - else - draw_point(it->point(), false, CGAL::IO::Color()); + if (m_gso.are_vertices_enabled()) { + for (auto it = m_aos.vertices_begin(); it != m_aos.vertices_end(); ++it) { + if (m_gso.colored_vertex(m_aos, it)) draw_point(it->point(), true, m_gso.vertex_color(m_aos, it)); + else draw_point(it->point(), false, CGAL::IO::Color()); } } @@ -471,15 +432,12 @@ public: std::vector polyline; double error(0.01); // TODO? (this->pixel_ratio()); approx(curve, error, std::back_inserter(polyline)); - if(polyline.empty()) - return; + if (polyline.empty()) return; auto it = polyline.begin(); auto prev = it++; - for(; it != polyline.end(); prev = it++) { - if(colored) - m_gs.add_segment(*prev, *it, c); - else - m_gs.add_segment(*prev, *it); + for (; it != polyline.end(); prev = it++) { + if (colored) m_gs.add_segment(*prev, *it, c); + else m_gs.add_segment(*prev, *it); } } @@ -489,23 +447,20 @@ public: const A& /* approximate */, const X_monotone_curve& xcv, bool colored, - const CGAL::IO::Color& c) { - draw_exact_curve(xcv, colored, c); - } + const CGAL::IO::Color& c) + { draw_exact_curve(xcv, colored, c); } /// template , int> = 0> - auto draw_curve_impl2( - const T& /* traits */, const A& approx, const X_monotone_curve& xcv, bool colored, const CGAL::IO::Color& c) { - draw_approximate_curve(xcv, approx, colored, c); - } + auto draw_curve_impl2(const T& /* traits */, const A& approx, const X_monotone_curve& xcv, bool colored, + const CGAL::IO::Color& c) + { draw_approximate_curve(xcv, approx, colored, c); } /*! Draw a curve, where the traits does not has approximate_2_object. */ template && !is_or_derived_from_agas_v, int> = 0> - void draw_curve_impl1(const T& /* traits */, const X_monotone_curve& xcv, bool colored, const CGAL::IO::Color& c) { - draw_exact_curve(xcv, colored, c); - } + void draw_curve_impl1(const T& /* traits */, const X_monotone_curve& xcv, bool colored, const CGAL::IO::Color& c) + { draw_exact_curve(xcv, colored, c); } /*! Draw a curve, where the traits does have approximate_2_object. */ @@ -536,13 +491,13 @@ public: auto z = it->dz(); auto l = std::sqrt(x * x + y * y + z * z); Approx_point_3 prev(x / l, y / l, z / l); - for(++it; it != apoints.end(); ++it) { + for (++it; it != apoints.end(); ++it) { auto x = it->dx(); auto y = it->dy(); auto z = it->dz(); auto l = std::sqrt(x * x + y * y + z * z); Approx_point_3 next(x / l, y / l, z / l); - if(colored) + if (colored) m_gs.add_segment(prev, next, c); else m_gs.add_segment(prev, next);