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/Line_arc_3.h $ 00015 // $Id: Line_arc_3.h 46052 2008-10-02 15:15:17Z 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_LINE_ARC_3_H 00025 #define CGAL_LINE_ARC_3_H 00026 00027 namespace CGAL { 00028 template <class SK> 00029 class Line_arc_3 00030 : public SK::Kernel_base::Line_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::Sphere_3 Sphere_3; 00039 typedef typename SK::Segment_3 Segment_3; 00040 typedef typename SK::Circular_arc_point_3 Circular_arc_point_3; 00041 typedef typename SK::Kernel_base::Line_arc_3 RLine_arc_3; 00042 00043 00044 public: 00045 typedef RLine_arc_3 Rep; 00046 typedef SK R; 00047 00048 const Rep& rep() const 00049 { 00050 return *this; 00051 } 00052 00053 Rep& rep() 00054 { 00055 return *this; 00056 } 00057 00058 Line_arc_3() 00059 : RLine_arc_3(typename R::Construct_line_arc_3()()) 00060 {} 00061 00062 Line_arc_3(const Line_3& l, 00063 const Circular_arc_point_3& s, 00064 const Circular_arc_point_3& t) 00065 : RLine_arc_3(typename R::Construct_line_arc_3()(l,s,t)) 00066 {} 00067 00068 Line_arc_3(const Point_3& s, 00069 const Point_3& t) 00070 : RLine_arc_3(typename R::Construct_line_arc_3()(s,t)) 00071 {} 00072 00073 Line_arc_3(const Segment_3 &s) 00074 : RLine_arc_3(typename R::Construct_line_arc_3()(s)) 00075 {} 00076 00077 // Not Documented 00078 Line_arc_3(const Line_3 &l, 00079 const Sphere_3 &s, 00080 bool less_xyz_first = true) 00081 : RLine_arc_3(typename R::Construct_line_arc_3()(l,s,less_xyz_first)) 00082 {} 00083 00084 // Not Documented 00085 Line_arc_3(const Sphere_3 &s, 00086 const Line_3 &l, 00087 bool less_xyz_first = true) 00088 : RLine_arc_3(typename R::Construct_line_arc_3()(s,l,less_xyz_first)) 00089 {} 00090 00091 // Not Documented 00092 Line_arc_3(const Line_3 &l, 00093 const Sphere_3 &s1, bool less_xyz_s1, 00094 const Sphere_3 &s2, bool less_xyz_s2) 00095 : RLine_arc_3(typename R::Construct_line_arc_3()(l,s1,less_xyz_s1, 00096 s2,less_xyz_s2)) 00097 {} 00098 00099 // Not Documented 00100 Line_arc_3(const Sphere_3 &s1, bool less_xyz_s1, 00101 const Sphere_3 &s2, bool less_xyz_s2, 00102 const Line_3 &l) 00103 : RLine_arc_3(typename R::Construct_line_arc_3()(s1,less_xyz_s1, 00104 s2,less_xyz_s2,l)) 00105 {} 00106 00107 // Not Documented 00108 Line_arc_3(const Line_3 &l, 00109 const Plane_3 &p1, 00110 const Plane_3 &p2) 00111 : RLine_arc_3(typename R::Construct_line_arc_3()(l,p1,p2)) 00112 {} 00113 00114 // Not Documented 00115 Line_arc_3(const Plane_3 &p1, 00116 const Plane_3 &p2, 00117 const Line_3 &l) 00118 : RLine_arc_3(typename R::Construct_line_arc_3()(p1,p2,l)) 00119 {} 00120 00121 Line_arc_3(const RLine_arc_3 &a) 00122 : RLine_arc_3(a) 00123 {} 00124 00125 typename Qualified_result_of 00126 <typename R::Construct_circular_source_vertex_3,Line_arc_3>::type 00127 source() const 00128 { 00129 return typename R::Construct_circular_source_vertex_3()(*this); 00130 } 00131 00132 typename Qualified_result_of 00133 <typename R::Construct_circular_target_vertex_3,Line_arc_3>::type 00134 target() const 00135 { 00136 return typename R::Construct_circular_target_vertex_3()(*this); 00137 } 00138 00139 typename Qualified_result_of 00140 <typename R::Construct_circular_min_vertex_3,Line_arc_3>::type 00141 lower_xyz_extremity() const 00142 { 00143 return typename R::Construct_circular_min_vertex_3()(*this); 00144 } 00145 00146 typename Qualified_result_of 00147 <typename R::Construct_circular_max_vertex_3,Line_arc_3>::type 00148 higher_xyz_extremity() const 00149 { 00150 return typename R::Construct_circular_max_vertex_3()(*this); 00151 } 00152 00153 typename Qualified_result_of 00154 <typename R::Construct_line_3,Line_arc_3>::type 00155 supporting_line() const 00156 { 00157 return typename R::Construct_line_3()(*this); 00158 } 00159 00160 Bbox_3 bbox() const 00161 { return typename R::Construct_bbox_3()(*this); } 00162 00163 }; 00164 00165 template < typename SK > 00166 inline 00167 bool 00168 operator==(const Line_arc_3<SK> &p, 00169 const Line_arc_3<SK> &q) 00170 { 00171 return SK().equal_3_object()(p, q); 00172 } 00173 00174 template < typename SK > 00175 inline 00176 bool 00177 operator!=(const Line_arc_3<SK> &p, 00178 const Line_arc_3<SK> &q) 00179 { 00180 return ! (p == q); 00181 } 00182 00183 template < typename SK > 00184 std::ostream & 00185 operator<<(std::ostream & os, const Line_arc_3<SK> &a) 00186 { 00187 00188 return os << a.supporting_line() << " " 00189 << a.source() << " " 00190 << a.target() << " "; 00191 } 00192 00193 template < typename SK > 00194 std::istream & 00195 operator>>(std::istream & is, Line_arc_3<SK> &a) 00196 { 00197 typename SK::Line_3 l; 00198 typename SK::Circular_arc_point_3 p1; 00199 typename SK::Circular_arc_point_3 p2; 00200 is >> l >> p1 >> p2 ; 00201 if (is) 00202 a = Line_arc_3<SK>(l, p1, p2); 00203 return is; 00204 } 00205 } 00206 00207 #endif