BWAPI
|
00001 // Copyright (c) 2005-2006 INRIA Sophia-Antipolis (France). 00002 // All rights reserved. 00003 // 00004 // This file is part of CGAL (www.cgal.org); you may redistribute it under 00005 // the terms of the Q Public License version 1.0. 00006 // See the file LICENSE.QPL distributed with CGAL. 00007 // 00008 // Licensees holding a valid commercial license may use this file in 00009 // accordance with the commercial license agreement provided with the software. 00010 // 00011 // This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 00012 // WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 00013 // 00014 // Partially supported by the IST Programme of the EU as a Shared-cost 00015 // RTD (FET Open) Project under Contract No IST-2000-26473 00016 // (ECG - Effective Computational Geometry for Curves and Surfaces) 00017 // and a STREP (FET Open) Project under Contract No IST-006413 00018 // (ACS -- Algorithms for Complex Shapes) 00019 // 00020 // $URL: svn+ssh://scm.gforge.inria.fr/svn/cgal/branches/CGAL-3.5-branch/Algebraic_kernel_for_spheres/include/CGAL/Algebraic_kernel_for_spheres/function_objects_on_roots_and_polynomials_2_3.h $ 00021 // $Id: function_objects_on_roots_and_polynomials_2_3.h 46224 2008-10-13 11:22:46Z pmachado $ 00022 // 00023 // Author(s) : Monique Teillaud <Monique.Teillaud@sophia.inria.fr> 00024 // Sylvain Pion 00025 // Pedro Machado 00026 00027 #ifndef CGAL_ALGEBRAIC_KERNEL_FOR_SPHERES_FUNCTION_OBJECTS_ON_ROOTS_AND_POLYNOMIALS_3_H 00028 #define CGAL_ALGEBRAIC_KERNEL_FOR_SPHERES_FUNCTION_OBJECTS_ON_ROOTS_AND_POLYNOMIALS_3_H 00029 00030 #include <CGAL/Algebraic_kernel_for_spheres/internal_functions_comparison_root_for_spheres_2_3.h> 00031 #include <CGAL/Algebraic_kernel_for_spheres/internal_functions_on_roots_and_polynomials_2_3.h> 00032 #include <CGAL/Algebraic_kernel_for_spheres/internal_functions_on_roots_and_polynomial_1_3_and_2_3.h> 00033 #include <CGAL/Algebraic_kernel_for_spheres/internal_functions_on_roots_and_polynomials_1_3.h> 00034 CGAL_BEGIN_NAMESPACE 00035 00036 namespace AlgebraicSphereFunctors { 00037 00038 template < class AK > 00039 class Solve 00040 { 00041 00042 typedef typename AK::Polynomial_for_spheres_2_3 00043 Polynomial_for_spheres_2_3; 00044 typedef typename AK::Polynomial_1_3 00045 Polynomial_1_3; 00046 typedef std::pair< 00047 Polynomial_for_spheres_2_3, 00048 Polynomial_1_3> Equation_Circle; 00049 typedef typename AK::Polynomials_for_line_3 Polynomials_for_line_3; 00050 00051 public: 00052 template < class OutputIterator > 00053 OutputIterator 00054 operator() 00055 (const Equation_Circle & e1, 00056 const Equation_Circle & e2, 00057 OutputIterator res) const 00058 { return AlgebraicSphereFunctors::solve<AK> ( e1, e2, res); } 00059 00060 template < class OutputIterator > 00061 OutputIterator 00062 operator() 00063 (const Equation_Circle & e1, 00064 const Polynomials_for_line_3 & e2, 00065 OutputIterator res) const 00066 { return AlgebraicSphereFunctors::solve<AK> ( e1, e2, res); } 00067 00068 template < class OutputIterator > 00069 OutputIterator 00070 operator() 00071 (const Polynomials_for_line_3 & e1, 00072 const Equation_Circle & e2, 00073 OutputIterator res) const 00074 { return AlgebraicSphereFunctors::solve<AK> ( e1, e2, res); } 00075 00076 template < class OutputIterator > 00077 OutputIterator 00078 operator() 00079 (const Equation_Circle & e1, 00080 const Polynomial_1_3 & e2, 00081 OutputIterator res) const 00082 { return AlgebraicSphereFunctors::solve<AK> ( e1, e2, res); } 00083 00084 template < class OutputIterator > 00085 OutputIterator 00086 operator() 00087 (const Polynomial_1_3 & e1, 00088 const Equation_Circle & e2, 00089 OutputIterator res) const 00090 { return AlgebraicSphereFunctors::solve<AK> (e1, e2, res); } 00091 00092 template < class OutputIterator > 00093 OutputIterator 00094 operator() 00095 (const Equation_Circle & e1, 00096 const Polynomial_for_spheres_2_3 & e2, 00097 OutputIterator res) const 00098 { return AlgebraicSphereFunctors::solve<AK> ( e1, e2, res); } 00099 00100 template < class OutputIterator > 00101 OutputIterator 00102 operator() 00103 (const Polynomial_for_spheres_2_3 & e1, 00104 const Equation_Circle & e2, 00105 OutputIterator res) const 00106 { return AlgebraicSphereFunctors::solve<AK> ( e1, e2, res); } 00107 00108 template < class OutputIterator > 00109 OutputIterator 00110 operator() 00111 (const Polynomial_for_spheres_2_3 & e1, 00112 const Polynomial_1_3 & e2, 00113 const Polynomial_1_3 & e3, 00114 OutputIterator res) const 00115 { return AlgebraicSphereFunctors::solve<AK> ( e1, e2, e3, res); } 00116 00117 template < class OutputIterator > 00118 OutputIterator 00119 operator() 00120 (const Polynomial_for_spheres_2_3 & e1, 00121 const Polynomials_for_line_3 & e2, 00122 OutputIterator res) const 00123 { return AlgebraicSphereFunctors::solve<AK> ( e1, e2, res); } 00124 00125 template < class OutputIterator > 00126 OutputIterator 00127 operator() 00128 (const Polynomials_for_line_3 & e1, 00129 const Polynomial_for_spheres_2_3 & e2, 00130 OutputIterator res) const 00131 { return AlgebraicSphereFunctors::solve<AK> ( e1, e2, res); } 00132 00133 template < class OutputIterator > 00134 OutputIterator 00135 operator() 00136 (const Polynomial_for_spheres_2_3 & e1, 00137 const Polynomial_for_spheres_2_3 & e2, 00138 const Polynomial_1_3 & e3, 00139 OutputIterator res) const 00140 { return AlgebraicSphereFunctors::solve<AK> ( e1, e2, e3, res); } 00141 00142 template < class OutputIterator > 00143 OutputIterator 00144 operator() 00145 (const Polynomial_1_3 & e1, 00146 const Polynomial_for_spheres_2_3 & e2, 00147 const Polynomial_for_spheres_2_3 & e3, 00148 OutputIterator res) const 00149 { return AlgebraicSphereFunctors::solve<AK> ( e1, e2, e3, res); } 00150 00151 template < class OutputIterator > 00152 OutputIterator 00153 operator() 00154 (const Polynomial_1_3 & e1, 00155 const Polynomial_1_3 & e2, 00156 const Polynomial_for_spheres_2_3 & e3, 00157 OutputIterator res) const 00158 { return AlgebraicSphereFunctors::solve<AK> ( e1, e2, e3, res); } 00159 00160 template < class OutputIterator > 00161 OutputIterator 00162 operator() 00163 (const Polynomial_for_spheres_2_3 & e1, 00164 const Polynomial_for_spheres_2_3 & e2, 00165 const Polynomial_for_spheres_2_3 & e3, 00166 OutputIterator res) const 00167 { return AlgebraicSphereFunctors::solve<AK> ( e1, e2, e3, res); } 00168 00169 template < class OutputIterator > 00170 OutputIterator 00171 operator() 00172 (const Polynomial_1_3 & e1, 00173 const Polynomial_1_3 & e2, 00174 const Polynomial_1_3 & e3, 00175 OutputIterator res) const 00176 { return AlgebraicSphereFunctors::solve<AK> ( e1, e2, e3, res); } 00177 00178 00179 00180 00181 }; 00182 00183 template < class AK > 00184 class Construct_polynomial_for_spheres_2_3 00185 { 00186 typedef typename AK::RT RT; 00187 typedef typename AK::Polynomial_for_spheres_2_3 Polynomial_for_spheres_2_3; 00188 00189 public: 00190 Polynomial_for_spheres_2_3 00191 operator()(const RT& xc, const RT& yc,const RT& zc, const RT& r_sq) const 00192 { return Polynomial_for_spheres_2_3(xc, yc, zc, r_sq); } 00193 }; 00194 00195 00196 template < class AK > 00197 class Construct_polynomial_1_3 00198 { 00199 typedef typename AK::RT RT; 00200 typedef typename AK::Polynomial_1_3 Polynomial_1_3; 00201 00202 public: 00203 Polynomial_1_3 00204 operator()(const RT& a, const RT& b,const RT& c, const RT& d) const 00205 { return Polynomial_1_3(a, b, c, d); } 00206 }; 00207 00208 template < class AK > 00209 class Construct_polynomials_for_line_3 00210 { 00211 typedef typename AK::FT FT; 00212 typedef typename AK::Polynomials_for_line_3 Polynomials_for_line_3; 00213 00214 public: 00215 Polynomials_for_line_3 00216 operator()(const FT& a1, const FT& b1, 00217 const FT& a2, const FT& b2, 00218 const FT& a3, const FT& b3) const 00219 { return Polynomials_for_line_3(a1, b1, a2, b2, a3, b3); } 00220 }; 00221 00222 template < class AK > 00223 class Sign_at 00224 { 00225 typedef typename AK::Polynomial_1_3 Polynomial_1_3; 00226 typedef typename AK::Polynomial_for_spheres_2_3 Polynomial_for_spheres_2_3; 00227 typedef typename AK::Root_for_spheres_2_3 Root_for_spheres_2_3; 00228 00229 public: 00230 typedef CGAL::Sign result_type; 00231 00232 result_type 00233 operator()( const Polynomial_for_spheres_2_3 & equation, 00234 const Root_for_spheres_2_3 & r ) const 00235 { return AlgebraicSphereFunctors::sign_at<AK>(equation, r); } 00236 00237 result_type 00238 operator()( const Polynomial_1_3 & equation, 00239 const Root_for_spheres_2_3 & r ) const 00240 { return AlgebraicSphereFunctors::sign_at<AK>(equation, r); } 00241 00242 }; 00243 00244 00245 template < class AK > 00246 class X_critical_points 00247 { 00248 typedef typename AK::Root_of_2 Root_of_2; 00249 typedef typename AK::Root_for_spheres_2_3 Root_for_spheres_2_3; 00250 typedef typename AK::Polynomial_for_spheres_2_3 Polynomial_for_spheres_2_3; 00251 typedef typename AK::Polynomial_1_3 Polynomial_1_3; 00252 00253 public: 00254 typedef void result_type; 00255 00256 Root_for_spheres_2_3 00257 operator()(const Polynomial_for_spheres_2_3 & c, 00258 bool i) const 00259 { return AlgebraicSphereFunctors::x_critical_point<AK>(c,i); } 00260 00261 template <class OutputIterator> 00262 OutputIterator 00263 operator()(const Polynomial_for_spheres_2_3 & c, 00264 OutputIterator res) const 00265 { return AlgebraicSphereFunctors::x_critical_points<AK>(c,res); } 00266 00267 Root_for_spheres_2_3 00268 operator()(const std::pair< Polynomial_for_spheres_2_3, Polynomial_1_3 > & c, 00269 bool i) const 00270 { return AlgebraicSphereFunctors::x_critical_point<AK>(c,i); } 00271 00272 template <class OutputIterator> 00273 OutputIterator 00274 operator()(const std::pair< Polynomial_for_spheres_2_3, Polynomial_1_3 > & c, 00275 OutputIterator res) const 00276 { return AlgebraicSphereFunctors::x_critical_points<AK>(c,res); } 00277 }; 00278 00279 template < class AK > 00280 class Y_critical_points 00281 { 00282 typedef typename AK::Root_of_2 Root_of_2; 00283 typedef typename AK::Root_for_spheres_2_3 Root_for_spheres_2_3; 00284 typedef typename AK::Polynomial_for_spheres_2_3 Polynomial_for_spheres_2_3; 00285 typedef typename AK::Polynomial_1_3 Polynomial_1_3; 00286 00287 public: 00288 typedef void result_type; 00289 00290 Root_for_spheres_2_3 00291 operator()(const Polynomial_for_spheres_2_3 & c, 00292 bool i) const 00293 { return AlgebraicSphereFunctors::y_critical_point<AK>(c,i); } 00294 00295 template <class OutputIterator> 00296 OutputIterator 00297 operator()(const Polynomial_for_spheres_2_3 & c, 00298 OutputIterator res) const 00299 { return AlgebraicSphereFunctors::y_critical_points<AK>(c,res); } 00300 00301 Root_for_spheres_2_3 00302 operator()(const std::pair< Polynomial_for_spheres_2_3, Polynomial_1_3 > & c, 00303 bool i) const 00304 { return AlgebraicSphereFunctors::y_critical_point<AK>(c,i); } 00305 00306 template <class OutputIterator> 00307 OutputIterator 00308 operator()(const std::pair< Polynomial_for_spheres_2_3, Polynomial_1_3 > & c, 00309 OutputIterator res) const 00310 { return AlgebraicSphereFunctors::y_critical_points<AK>(c,res); } 00311 }; 00312 00313 template < class AK > 00314 class Z_critical_points 00315 { 00316 typedef typename AK::Root_of_2 Root_of_2; 00317 typedef typename AK::Root_for_spheres_2_3 Root_for_spheres_2_3; 00318 typedef typename AK::Polynomial_for_spheres_2_3 Polynomial_for_spheres_2_3; 00319 typedef typename AK::Polynomial_1_3 Polynomial_1_3; 00320 00321 public: 00322 typedef void result_type; 00323 00324 Root_for_spheres_2_3 00325 operator()(const Polynomial_for_spheres_2_3 & c, 00326 bool i) const 00327 { return AlgebraicSphereFunctors::z_critical_point<AK>(c,i); } 00328 00329 template <class OutputIterator> 00330 OutputIterator 00331 operator()(const Polynomial_for_spheres_2_3 & c, 00332 OutputIterator res) const 00333 { return AlgebraicSphereFunctors::z_critical_points<AK>(c,res); } 00334 00335 Root_for_spheres_2_3 00336 operator()(const std::pair< Polynomial_for_spheres_2_3, Polynomial_1_3 > & c, 00337 bool i) const 00338 { return AlgebraicSphereFunctors::z_critical_point<AK>(c,i); } 00339 00340 template <class OutputIterator> 00341 OutputIterator 00342 operator()(const std::pair< Polynomial_for_spheres_2_3, Polynomial_1_3 > & c, 00343 OutputIterator res) const 00344 { return AlgebraicSphereFunctors::z_critical_points<AK>(c,res); } 00345 00346 }; 00347 00348 template <typename RT> 00349 class Compare_x 00350 { 00351 public: 00352 Comparison_result 00353 operator()(const Root_for_spheres_2_3<RT>& r1, 00354 const Root_for_spheres_2_3<RT>& r2) const 00355 { return AlgebraicSphereFunctors::compare_x<RT>(r1, r2); } 00356 00357 }; 00358 00359 template <typename RT> 00360 class Compare_y 00361 { 00362 public: 00363 Comparison_result 00364 operator()(const Root_for_spheres_2_3<RT>& r1, 00365 const Root_for_spheres_2_3<RT>& r2) const 00366 { return AlgebraicSphereFunctors::compare_y<RT>(r1, r2); } 00367 }; 00368 00369 template <typename RT> 00370 class Compare_z 00371 { 00372 public: 00373 Comparison_result 00374 operator()(const Root_for_spheres_2_3<RT>& r1, 00375 const Root_for_spheres_2_3<RT>& r2) const 00376 { return AlgebraicSphereFunctors::compare_z<RT>(r1, r2); } 00377 }; 00378 00379 template <typename RT> 00380 class Compare_xy 00381 { 00382 public: 00383 Comparison_result 00384 operator()(const Root_for_spheres_2_3<RT>& r1, 00385 const Root_for_spheres_2_3<RT>& r2) const 00386 { return AlgebraicSphereFunctors::compare_xy<RT>(r1, r2); } 00387 }; 00388 00389 template <typename RT> 00390 class Compare_xyz 00391 { 00392 public: 00393 Comparison_result 00394 operator()(const Root_for_spheres_2_3<RT>& r1, 00395 const Root_for_spheres_2_3<RT>& r2) const 00396 { return AlgebraicSphereFunctors::compare_xyz<RT>(r1, r2); } 00397 }; 00398 00399 } // namespace AlgebraicSphereFunctors 00400 00401 CGAL_END_NAMESPACE 00402 00403 #endif // CGAL_ALGEBRAIC_KERNEL_FOR_SPHERES_FUNCTION_OBJECTS_ON_ROOTS_AND_POLYNOMIALS_3_H