BWAPI
|
00001 // Copyright (c) 2008 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 // $URL: svn+ssh://scm.gforge.inria.fr/svn/cgal/branches/CGAL-3.5-branch/Circular_kernel_3/include/CGAL/Circular_arc_point_3.h $ 00015 // $Id: Circular_arc_point_3.h 46053 2008-10-02 15:39:30Z pmachado $ 00016 // 00017 // Author(s) : Monique Teillaud, Sylvain Pion, Pedro Machado, 00018 // Julien Hazebrouck, Damien Leroy 00019 00020 // Partially supported by the IST Programme of the EU as a 00021 // STREP (FET Open) Project under Contract No IST-006413 00022 // (ACS -- Algorithms for Complex Shapes) 00023 00024 #ifndef CGAL_CIRCULAR_ARC_POINT_3_H 00025 #define CGAL_CIRCULAR_ARC_POINT_3_H 00026 00027 namespace CGAL { 00028 00029 template < typename SphericalKernel > 00030 class Circular_arc_point_3 00031 : public SphericalKernel::Kernel_base::Circular_arc_point_3 00032 { 00033 typedef typename SphericalKernel::Kernel_base::Circular_arc_point_3 00034 RCircular_arc_point_3; 00035 00036 typedef typename SphericalKernel::Root_of_2 Root_of_2; 00037 typedef typename SphericalKernel::Point_3 Point_3; 00038 typedef typename SphericalKernel::Plane_3 Plane_3; 00039 typedef typename SphericalKernel::Line_3 Line_3; 00040 typedef typename SphericalKernel::Circle_3 Circle_3; 00041 typedef typename SphericalKernel::Sphere_3 Sphere_3; 00042 00043 public: 00044 typedef typename SphericalKernel::Root_for_spheres_2_3 00045 Root_for_spheres_2_3; 00046 typedef SphericalKernel R; 00047 typedef RCircular_arc_point_3 Rep; 00048 00049 const Rep& rep() const 00050 { 00051 return *this; 00052 } 00053 00054 Rep& rep() 00055 { 00056 return *this; 00057 } 00058 00059 Circular_arc_point_3() 00060 : RCircular_arc_point_3( 00061 typename R::Construct_circular_arc_point_3()()) 00062 {} 00063 00064 Circular_arc_point_3(const Root_of_2 & x, 00065 const Root_of_2 & y, 00066 const Root_of_2 & z) 00067 : RCircular_arc_point_3( 00068 typename R::Construct_circular_arc_point_3()(x,y,z)) 00069 {} 00070 00071 00072 Circular_arc_point_3(const Root_for_spheres_2_3 & np) 00073 : RCircular_arc_point_3( 00074 typename R::Construct_circular_arc_point_3()(np)) 00075 {} 00076 00077 Circular_arc_point_3(const RCircular_arc_point_3 & p) 00078 : RCircular_arc_point_3(p) 00079 {} 00080 00081 Circular_arc_point_3(const Point_3 & p) 00082 : RCircular_arc_point_3( 00083 typename R::Construct_circular_arc_point_3()(p)) 00084 {} 00085 00086 // Not Documented 00087 Circular_arc_point_3(const Sphere_3 & s1, 00088 const Sphere_3 & s2, 00089 const Sphere_3 & s3, 00090 const bool less_xyz = true) 00091 : RCircular_arc_point_3( 00092 typename R::Construct_circular_arc_point_3()(s1,s2,s3,less_xyz)) 00093 {} 00094 00095 // Not Documented 00096 Circular_arc_point_3(const Plane_3 & p, 00097 const Sphere_3 & s1, 00098 const Sphere_3 & s2, 00099 const bool less_xyz = true) 00100 : RCircular_arc_point_3( 00101 typename R::Construct_circular_arc_point_3()(p,s1,s2,less_xyz)) 00102 {} 00103 00104 // Not Documented 00105 Circular_arc_point_3(const Sphere_3 & s1, 00106 const Plane_3 & p, 00107 const Sphere_3 & s2, 00108 const bool less_xyz = true) 00109 : RCircular_arc_point_3( 00110 typename R::Construct_circular_arc_point_3()(s1,p,s2,less_xyz)) 00111 {} 00112 00113 // Not Documented 00114 Circular_arc_point_3(const Sphere_3 & s1, 00115 const Sphere_3 & s2, 00116 const Plane_3 & p, 00117 const bool less_xyz = true) 00118 : RCircular_arc_point_3( 00119 typename R::Construct_circular_arc_point_3()(s1,s2,p,less_xyz)) 00120 {} 00121 00122 // Not Documented 00123 Circular_arc_point_3(const Plane_3 & p1, 00124 const Plane_3 & p2, 00125 const Sphere_3 & s, 00126 const bool less_xyz = true) 00127 : RCircular_arc_point_3( 00128 typename R::Construct_circular_arc_point_3()(p1,p2,s,less_xyz)) 00129 {} 00130 00131 // Not Documented 00132 Circular_arc_point_3(const Plane_3 & p1, 00133 const Sphere_3 & s, 00134 const Plane_3 & p2, 00135 const bool less_xyz = true) 00136 : RCircular_arc_point_3( 00137 typename R::Construct_circular_arc_point_3()(p1,s,p2,less_xyz)) 00138 {} 00139 00140 // Not Documented 00141 Circular_arc_point_3(const Sphere_3 & s, 00142 const Plane_3 & p1, 00143 const Plane_3 & p2, 00144 const bool less_xyz = true) 00145 : RCircular_arc_point_3( 00146 typename R::Construct_circular_arc_point_3()(s,p1,p2,less_xyz)) 00147 {} 00148 00149 // Not Documented 00150 Circular_arc_point_3(const Line_3 & l, 00151 const Sphere_3 & s, 00152 const bool less_xyz = true) 00153 : RCircular_arc_point_3( 00154 typename R::Construct_circular_arc_point_3()(l,s,less_xyz)) 00155 {} 00156 00157 // Not Documented 00158 Circular_arc_point_3(const Sphere_3 & s, 00159 const Line_3 & l, 00160 const bool less_xyz = true) 00161 : RCircular_arc_point_3( 00162 typename R::Construct_circular_arc_point_3()(s,l,less_xyz)) 00163 {} 00164 00165 // Not Documented 00166 Circular_arc_point_3(const Circle_3 & c, 00167 const Sphere_3 & s, 00168 const bool less_xyz = true) 00169 : RCircular_arc_point_3( 00170 typename R::Construct_circular_arc_point_3()(c,s,less_xyz)) 00171 {} 00172 00173 // Not Documented 00174 Circular_arc_point_3(const Sphere_3 & s, 00175 const Circle_3 & c, 00176 const bool less_xyz = true) 00177 : RCircular_arc_point_3( 00178 typename R::Construct_circular_arc_point_3()(s,c,less_xyz)) 00179 {} 00180 00181 // Not Documented 00182 Circular_arc_point_3(const Circle_3 & c, 00183 const Plane_3 & p, 00184 const bool less_xyz = true) 00185 : RCircular_arc_point_3( 00186 typename R::Construct_circular_arc_point_3()(c,p,less_xyz)) 00187 {} 00188 00189 // Not Documented 00190 Circular_arc_point_3(const Sphere_3 & s, 00191 const Plane_3 & p, 00192 const bool less_xyz = true) 00193 : RCircular_arc_point_3( 00194 typename R::Construct_circular_arc_point_3()(s,p,less_xyz)) 00195 {} 00196 00197 00198 00199 typename Qualified_result_of<typename R::Compute_circular_x_3,Circular_arc_point_3>::type 00200 //const Root_of_2 & 00201 x() const 00202 { return typename R::Compute_circular_x_3()(*this);} 00203 00204 typename Qualified_result_of<typename R::Compute_circular_y_3,Circular_arc_point_3>::type 00205 //const Root_of_2 & 00206 y() const 00207 { return typename R::Compute_circular_y_3()(*this);} 00208 00209 typename Qualified_result_of<typename R::Compute_circular_z_3,Circular_arc_point_3>::type 00210 //const Root_of_2 & 00211 z() const 00212 { return typename R::Compute_circular_z_3()(*this);} 00213 00214 Bbox_3 bbox() const 00215 { return typename R::Construct_bbox_3()(*this); } 00216 00217 }; 00218 00219 template < class SK > 00220 std::ostream& 00221 operator<<(std::ostream &os, const Circular_arc_point_3<SK> &p) 00222 { 00223 return os << p.x() << " " << p.y() << " " << p.z() << " " ; 00224 } 00225 00226 template < typename SK > 00227 std::istream & 00228 operator>>(std::istream & is, Circular_arc_point_3<SK> &p) 00229 { 00230 typedef typename SK::Root_of_2 Root_of_2; 00231 typedef typename SK::Root_for_spheres_2_3 Root_for_spheres_2_3; 00232 00233 Root_for_spheres_2_3 r; 00234 is >> r; 00235 if(is) 00236 p = Circular_arc_point_3<SK>(r); 00237 return is; 00238 } 00239 00240 template < typename SK > 00241 inline 00242 bool 00243 operator==(const Circular_arc_point_3<SK> &p, 00244 const Circular_arc_point_3<SK> &q) 00245 { 00246 return SK().equal_3_object()(p, q); 00247 } 00248 00249 template < typename SK > 00250 inline 00251 bool 00252 operator!=(const Circular_arc_point_3<SK> &p, 00253 const Circular_arc_point_3<SK> &q) 00254 { 00255 return ! (p == q); 00256 } 00257 00258 template < typename SK > 00259 inline 00260 bool 00261 operator<(const Circular_arc_point_3<SK> &p, 00262 const Circular_arc_point_3<SK> &q) 00263 { 00264 return SK().compare_xyz_3_object()(p, q) == CGAL::SMALLER; 00265 } 00266 00267 template < typename SK > 00268 inline 00269 bool 00270 operator>(const Circular_arc_point_3<SK> &p, 00271 const Circular_arc_point_3<SK> &q) 00272 { 00273 return SK().compare_xyz_3_object()(p, q) == CGAL::LARGER; 00274 } 00275 00276 template < typename SK > 00277 inline 00278 bool 00279 operator<=(const Circular_arc_point_3<SK> &p, 00280 const Circular_arc_point_3<SK> &q) 00281 { 00282 CGAL::Comparison_result c = SK().compare_xyz_3_object()(p, q); 00283 return (c == CGAL::SMALLER) || (c == CGAL::EQUAL); 00284 } 00285 00286 template < typename SK > 00287 inline 00288 bool 00289 operator>=(const Circular_arc_point_3<SK> &p, 00290 const Circular_arc_point_3<SK> &q) 00291 { 00292 CGAL::Comparison_result c = SK().compare_xyz_3_object()(p, q); 00293 return (c == CGAL::LARGER) || (c == CGAL::EQUAL); 00294 } 00295 00296 } 00297 00298 #endif