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_3.h $ 00015 // $Id: Circular_arc_3.h 50731 2009-07-21 09:08:07Z sloriot $ 00016 // 00017 // Author(s) : Monique Teillaud, Sylvain Pion, Pedro Machado, 00018 // Sebastien Loriot, 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_3_H 00025 #define CGAL_CIRCULAR_ARC_3_H 00026 00027 namespace CGAL { 00028 template <class SK> 00029 class Circular_arc_3 00030 : public SK::Kernel_base::Circular_arc_3 00031 { 00032 00033 typedef typename SK::RT RT; 00034 typedef typename SK::FT FT; 00035 typedef typename SK::Line_3 Line_3; 00036 typedef typename SK::Point_3 Point_3; 00037 typedef typename SK::Plane_3 Plane_3; 00038 typedef typename SK::Circle_3 Circle_3; 00039 typedef typename SK::Sphere_3 Sphere_3; 00040 typedef typename SK::Segment_3 Segment_3; 00041 typedef typename SK::Circular_arc_point_3 Circular_arc_point_3; 00042 typedef typename SK::Kernel_base::Circular_arc_3 RCircular_arc_3; 00043 00044 00045 public: 00046 typedef RCircular_arc_3 Rep; 00047 typedef SK R; 00048 00049 const Rep& rep() const 00050 { 00051 return *this; 00052 } 00053 00054 Rep& rep() 00055 { 00056 return *this; 00057 } 00058 00059 Circular_arc_3() 00060 : RCircular_arc_3(typename R::Construct_circular_arc_3()()) 00061 {} 00062 00063 Circular_arc_3(const Circle_3& c, 00064 const Circular_arc_point_3& s, 00065 const Circular_arc_point_3& t) 00066 : RCircular_arc_3(typename R::Construct_circular_arc_3()(c,s,t)) 00067 {} 00068 00069 explicit Circular_arc_3(const Circle_3& c) 00070 : RCircular_arc_3(typename R::Construct_circular_arc_3()(c)) 00071 {} 00072 00073 Circular_arc_3(const Circle_3& c,const Circular_arc_point_3& pt) 00074 : RCircular_arc_3(typename R::Construct_circular_arc_3()(c,pt)) 00075 {} 00076 00077 // Not Documented 00078 Circular_arc_3(const Circle_3 &c, 00079 const Sphere_3 &s1, bool less_xyz_s1, 00080 const Sphere_3 &s2, bool less_xyz_s2) 00081 : RCircular_arc_3(typename R::Construct_circular_arc_3()(c,s1,less_xyz_s1, 00082 s2,less_xyz_s2)) 00083 {} 00084 00085 // Not Documented 00086 Circular_arc_3(const Sphere_3 &s1, bool less_xyz_s1, 00087 const Sphere_3 &s2, bool less_xyz_s2, 00088 const Circle_3 &c) 00089 : RCircular_arc_3(typename R::Construct_circular_arc_3()(s1,less_xyz_s1, 00090 s2,less_xyz_s2, 00091 c)) 00092 {} 00093 00094 // Not Documented 00095 Circular_arc_3(const Circle_3 &c, 00096 const Plane_3 &p1, bool less_xyz_p1, 00097 const Plane_3 &p2, bool less_xyz_p2) 00098 : RCircular_arc_3(typename R::Construct_circular_arc_3()(c,p1,less_xyz_p1, 00099 p2,less_xyz_p2)) 00100 {} 00101 00102 // Not Documented 00103 Circular_arc_3(const Plane_3 &p1, bool less_xyz_p1, 00104 const Plane_3 &p2, bool less_xyz_p2, 00105 const Circle_3 &c) 00106 : RCircular_arc_3(typename R::Construct_circular_arc_3()(p1,less_xyz_p1, 00107 p2,less_xyz_p2, 00108 c)) 00109 {} 00110 00111 Circular_arc_3(const Point_3 &start, 00112 const Point_3 &middle, 00113 const Point_3 &end) 00114 : RCircular_arc_3(typename 00115 R::Construct_circular_arc_3()(start, middle, end)) 00116 {} 00117 00118 Circular_arc_3(const RCircular_arc_3 &a) 00119 : RCircular_arc_3(a) 00120 {} 00121 00122 typename Qualified_result_of 00123 <typename R::Construct_circular_source_vertex_3,Circular_arc_3>::type 00124 source() const 00125 { 00126 return typename R::Construct_circular_source_vertex_3()(*this); 00127 } 00128 00129 typename Qualified_result_of 00130 <typename R::Construct_circular_target_vertex_3,Circular_arc_3>::type 00131 target() const 00132 { 00133 return typename R::Construct_circular_target_vertex_3()(*this); 00134 } 00135 00136 typename Qualified_result_of 00137 <typename R::Construct_circle_3,Circular_arc_3>::type 00138 supporting_circle() const 00139 { 00140 return typename R::Construct_circle_3()(*this); 00141 } 00142 00143 Sphere_3 diametral_sphere() const 00144 { 00145 return typename R::Construct_sphere_3()(*this); 00146 } 00147 00148 Point_3 center() const 00149 { 00150 return typename R::Construct_sphere_3()(*this).center(); 00151 } 00152 00153 FT squared_radius() const 00154 { 00155 return typename R::Construct_sphere_3()(*this).squared_radius(); 00156 } 00157 00158 Plane_3 supporting_plane() const 00159 { 00160 return typename R::Construct_plane_3()(*this); 00161 } 00162 00163 Bbox_3 bbox() const 00164 { return typename R::Construct_bbox_3()(*this); } 00165 00166 }; 00167 00168 template < typename SK > 00169 inline 00170 bool 00171 operator==(const Circular_arc_3<SK> &p, 00172 const Circular_arc_3<SK> &q) 00173 { 00174 return SK().equal_3_object()(p, q); 00175 } 00176 00177 template < typename SK > 00178 inline 00179 bool 00180 operator!=(const Circular_arc_3<SK> &p, 00181 const Circular_arc_3<SK> &q) 00182 { 00183 return ! (p == q); 00184 } 00185 00186 template < typename SK > 00187 std::ostream & 00188 operator<<(std::ostream & os, const Circular_arc_3<SK> &a) 00189 { 00190 return os << a.supporting_circle() << " " 00191 << a.source() << " " 00192 << a.target() << " "; 00193 } 00194 00195 template < typename SK > 00196 std::istream & 00197 operator>>(std::istream & is, Circular_arc_3<SK> &a) 00198 { 00199 typename SK::Circle_3 s; 00200 typename SK::Circular_arc_point_3 p1; 00201 typename SK::Circular_arc_point_3 p2; 00202 is >> s >> p1 >> p2 ; 00203 if (is) 00204 a = Circular_arc_3<SK>(s, p1, p2); 00205 return is; 00206 } 00207 00208 } 00209 00210 #endif