1 // Copyright (c) 2005-2007 Tel-Aviv University (Israel). 2 // All rights reserved. 3 // 4 // This file is part of CGAL (www.cgal.org). 5 // 6 // $URL: https://github.com/CGAL/cgal/blob/v5.3/Envelope_3/include/CGAL/Env_tracing_traits_3.h $ 7 // $Id: Env_tracing_traits_3.h 0779373 2020-03-26T13:31:46+01:00 Sébastien Loriot 8 // SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-Commercial 9 // 10 // 11 // Author(s): Ophir Setter <ophir.setter@post.tau.ac.il> 12 // 13 14 /*! 15 \file Env_tracing_traits_3.h 16 \brief The file is used to trace envelope_3 trace classes 17 \todo Revise this file. 18 19 */ 20 21 22 #ifndef CGAL_ENV_TRACE_TRAITS_H 23 #define CGAL_ENV_TRACE_TRAITS_H 24 25 #include <CGAL/license/Envelope_3.h> 26 27 28 /*! \file 29 * This is the file containing a traits class used to trace other voronoi 30 * diagram traits. 31 */ 32 33 #include <list> 34 #include <CGAL/basic.h> 35 #include <CGAL/tags.h> 36 #include <CGAL/representation_tags.h> 37 #include <CGAL/functions_on_enums.h> 38 #include <CGAL/number_utils.h> 39 #include <CGAL/Envelope_3/Envelope_base.h> 40 41 namespace CGAL { 42 43 /*! 44 * \class The traits class 45 */ 46 template <class Traits_> 47 class Env_tracing_traits_3 : public Traits_ 48 { 49 public: 50 typedef Traits_ Base; 51 52 typedef typename Base::Multiplicity Multiplicity; 53 typedef typename Base::Point_2 Point_2; 54 typedef typename Base::Curve_2 Curve_2; 55 typedef typename Base::X_monotone_curve_2 X_monotone_curve_2; 56 57 typedef typename Base::Boundary_category Boundary_category; 58 59 typedef typename Base::Xy_monotone_surface_3 Xy_monotone_surface_3; 60 typedef typename Base::Surface_3 Surface_3; 61 62 typedef std::pair<X_monotone_curve_2, Multiplicity> Intersection_curve; 63 64 class Make_xy_monotone_3 65 { 66 public: 67 68 template <class OutputIterator> operator()69 OutputIterator operator()(const Surface_3& s, 70 bool is_lower, 71 OutputIterator o) const 72 { 73 Base base; 74 return base.make_xy_monotone_3_object() (s, is_lower, o); 75 } 76 }; 77 make_xy_monotone_3_object()78 Make_xy_monotone_3 make_xy_monotone_3_object() const 79 { 80 return Make_xy_monotone_3(); 81 } 82 83 class Compare_z_at_xy_3 84 { 85 public: 86 operator()87 Comparison_result operator()(const Point_2& p, 88 const Xy_monotone_surface_3& h1, 89 const Xy_monotone_surface_3& h2) const 90 { 91 Base base; 92 std::cerr << "Compare_z_at_xy_3:" << std::endl; 93 std::cerr << "Point: " << p << std::endl; 94 std::cerr << "Surface1: " << h1 << std::endl; 95 std::cerr << "Surface2: " << h2 << std::endl; 96 Comparison_result res = base.compare_z_at_xy_3_object() (p, h1, h2); 97 std::cerr << "Result: " << res << std::endl; 98 return res; 99 } 100 operator()101 Comparison_result operator()(const X_monotone_curve_2& cv, 102 const Xy_monotone_surface_3& h1, 103 const Xy_monotone_surface_3& h2) const 104 { 105 Base base; 106 std::cerr << "Compare_z_at_xy_3:" << std::endl; 107 std::cerr << "Curve: " << cv << std::endl; 108 std::cerr << "Surface1: " << h1 << std::endl; 109 std::cerr << "Surface2: " << h2 << std::endl; 110 Comparison_result res = base.compare_z_at_xy_3_object() (cv, h1, h2); 111 std::cerr << "Result: " << res << std::endl; 112 return res; 113 } 114 115 operator()116 Comparison_result operator()(const Xy_monotone_surface_3& h1, 117 const Xy_monotone_surface_3& h2) const 118 119 { 120 Base base; 121 std::cerr << "Compare_z_at_xy_3:" << std::endl; 122 std::cerr << "Surface1: " << h1 << std::endl; 123 std::cerr << "Surface2: " << h2 << std::endl; 124 Comparison_result res = base.compare_z_at_xy_3_object() (h1, h2); 125 std::cerr << "Result: " << res << std::endl; 126 return res; 127 } 128 129 }; 130 compare_z_at_xy_3_object()131 Compare_z_at_xy_3 compare_z_at_xy_3_object() const 132 { 133 return Compare_z_at_xy_3(); 134 } 135 136 class Compare_z_at_xy_above_3 137 { 138 public: operator()139 Comparison_result operator()(const X_monotone_curve_2& cv, 140 const Xy_monotone_surface_3& h1, 141 const Xy_monotone_surface_3& h2) const 142 { 143 Base base; 144 std::cerr << "Compare_z_at_xy_above_3:" << std::endl; 145 std::cerr << "Curve: " << cv << std::endl; 146 std::cerr << "Surface1: " << h1 << std::endl; 147 std::cerr << "Surface2: " << h2 << std::endl; 148 Comparison_result res = 149 base.compare_z_at_xy_above_3_object() (cv, h1, h2); 150 std::cerr << "Result: " << res << std::endl; 151 return res; 152 } 153 }; 154 compare_z_at_xy_above_3_object()155 Compare_z_at_xy_above_3 compare_z_at_xy_above_3_object() const 156 { 157 return Compare_z_at_xy_above_3(); 158 } 159 160 class Compare_z_at_xy_below_3 161 { 162 public: operator()163 Comparison_result operator()(const X_monotone_curve_2& cv, 164 const Xy_monotone_surface_3& h1, 165 const Xy_monotone_surface_3& h2) const 166 { 167 Base base; 168 std::cerr << "Compare_z_at_xy_below_3:" << std::endl; 169 std::cerr << "Curve: " << cv << std::endl; 170 std::cerr << "Surface1: " << h1 << std::endl; 171 std::cerr << "Surface2: " << h2 << std::endl; 172 Comparison_result res = 173 base.compare_z_at_xy_below_3_object() (cv, h1, h2); 174 std::cerr << "Result: " << res << std::endl; 175 return res; 176 } 177 178 }; 179 compare_z_at_xy_below_3_object()180 Compare_z_at_xy_below_3 compare_z_at_xy_below_3_object() const 181 { 182 return Compare_z_at_xy_below_3(); 183 } 184 185 186 class Construct_projected_boundary_2 187 { 188 public: 189 190 template <class OutputIterator> operator()191 OutputIterator operator()(const Xy_monotone_surface_3& s, 192 OutputIterator o) const 193 { 194 Base base; 195 std::cerr << "Construct_projected_boundary_2: JUST FIRST" << std::endl; 196 std::cerr << "Surface: " << s << std::endl; 197 std::list<CGAL::Object> l; 198 base.construct_projected_boundary_2_object() (s, std::back_inserter(l)); 199 200 if (l.size() > 0) 201 { 202 std::pair<X_monotone_curve_2, CGAL::Oriented_side> i; 203 if (CGAL::assign(i, l.front())) 204 std::cerr << "First: " << i.first << std::endl; 205 else 206 std::cerr << "First intersection is a point" << std::endl; 207 } 208 209 std::copy(l.begin(), l.end(), o); 210 return o; 211 } 212 }; 213 214 Construct_projected_boundary_2 construct_projected_boundary_2_object()215 construct_projected_boundary_2_object() const 216 { 217 return Construct_projected_boundary_2(); 218 } 219 220 221 class Construct_projected_intersections_2 222 { 223 public: 224 225 template <class OutputIterator> operator()226 OutputIterator operator()(const Xy_monotone_surface_3& s1, 227 const Xy_monotone_surface_3& s2, 228 OutputIterator o) const 229 { 230 Base base; 231 std::cerr << "Construct_projected_intersections_2: JUST FIRST" 232 << std::endl; 233 std::cerr << "Surface1: " << s1 << std::endl; 234 std::cerr << "Surface2: " << s2 << std::endl; 235 std::list<CGAL::Object> l; 236 base.construct_projected_intersections_2_object() (s1, s2, 237 std::back_inserter(l)); 238 239 if (l.size() > 0) 240 { 241 Intersection_curve i; 242 if (CGAL::assign(i, l.front())) 243 std::cerr << "First: " << i.first << std::endl; 244 else 245 std::cerr << "First intersection is not a point" << std::endl; 246 } 247 248 std::copy(l.begin(), l.end(), o); 249 return o; 250 } 251 }; 252 253 Construct_projected_intersections_2 construct_projected_intersections_2_object()254 construct_projected_intersections_2_object() const 255 { 256 return Construct_projected_intersections_2(); 257 } 258 259 }; 260 261 } //namespace CGAL 262 263 #endif 264