BWAPI
|
00001 // Copyright (c) 1997 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/Triangulation_2/include/CGAL/Constrained_triangulation_face_base_2.h $ 00015 // $Id: Constrained_triangulation_face_base_2.h 48844 2009-04-21 18:28:04Z spion $ 00016 // 00017 // 00018 // Author(s) : Mariette Yvinec 00019 00020 #ifndef CGAL_CONSTRAINED_TRIANGULATION_FACE_BASE_2_H 00021 #define CGAL_CONSTRAINED_TRIANGULATION_FACE_BASE_2_H 00022 00023 #include <CGAL/triangulation_assertions.h> 00024 #include <CGAL/Triangulation_ds_face_base_2.h> 00025 00026 CGAL_BEGIN_NAMESPACE 00027 00028 template <class Gt, class Fb = Triangulation_face_base_2<Gt> > 00029 class Constrained_triangulation_face_base_2 00030 : public Fb 00031 { 00032 typedef Fb Base; 00033 typedef typename Fb::Triangulation_data_structure TDS; 00034 public: 00035 typedef Gt Geom_traits; 00036 typedef TDS Triangulation_data_structure; 00037 typedef typename TDS::Vertex_handle Vertex_handle; 00038 typedef typename TDS::Face_handle Face_handle; 00039 00040 template < typename TDS2 > 00041 struct Rebind_TDS { 00042 typedef typename Fb::template Rebind_TDS<TDS2>::Other Fb2; 00043 typedef Constrained_triangulation_face_base_2<Gt,Fb2> Other; 00044 }; 00045 00046 00047 protected: 00048 bool C[3]; 00049 00050 public: 00051 Constrained_triangulation_face_base_2() 00052 : Base() 00053 { 00054 set_constraints(false,false,false); 00055 } 00056 00057 Constrained_triangulation_face_base_2(Vertex_handle v0, 00058 Vertex_handle v1, 00059 Vertex_handle v2) 00060 : Base(v0,v1,v2) 00061 { 00062 set_constraints(false,false,false); 00063 } 00064 00065 Constrained_triangulation_face_base_2(Vertex_handle v0, 00066 Vertex_handle v1, 00067 Vertex_handle v2, 00068 Face_handle n0, 00069 Face_handle n1, 00070 Face_handle n2) 00071 : Base(v0,v1,v2,n0,n1,n2) 00072 { 00073 set_constraints(false,false,false); 00074 } 00075 00076 00077 Constrained_triangulation_face_base_2(Vertex_handle v0, 00078 Vertex_handle v1, 00079 Vertex_handle v2, 00080 Face_handle n0, 00081 Face_handle n1, 00082 Face_handle n2, 00083 bool c0, 00084 bool c1, 00085 bool c2 ) 00086 : Base(v0,v1,v2,n0,n1,n2) 00087 { 00088 set_constraints(c0,c1,c2); 00089 } 00090 00091 00092 bool is_constrained(int i) const ; 00093 void set_constraints(bool c0, bool c1, bool c2) ; 00094 void set_constraint(int i, bool b); 00095 void reorient(); 00096 void ccw_permute(); 00097 void cw_permute(); 00098 00099 }; 00100 00101 template <class Gt, class Fb> 00102 inline void 00103 Constrained_triangulation_face_base_2<Gt,Fb>:: 00104 set_constraints(bool c0, bool c1, bool c2) 00105 { 00106 C[0]=c0; 00107 C[1]=c1; 00108 C[2]=c2; 00109 } 00110 00111 template <class Gt, class Fb> 00112 inline void 00113 Constrained_triangulation_face_base_2<Gt,Fb>:: 00114 set_constraint(int i, bool b) 00115 { 00116 CGAL_triangulation_precondition( i == 0 || i == 1 || i == 2); 00117 C[i] = b; 00118 } 00119 00120 template <class Gt, class Fb> 00121 inline bool 00122 Constrained_triangulation_face_base_2<Gt,Fb>:: 00123 is_constrained(int i) const 00124 { 00125 return(C[i]); 00126 } 00127 00128 template <class Gt, class Fb> 00129 inline void 00130 Constrained_triangulation_face_base_2<Gt,Fb>:: 00131 reorient() 00132 { 00133 Base::reorient(); 00134 set_constraints(C[1],C[0],C[2]); 00135 } 00136 00137 template <class Gt, class Fb> 00138 inline void 00139 Constrained_triangulation_face_base_2<Gt,Fb>:: 00140 ccw_permute() 00141 { 00142 Base::ccw_permute(); 00143 set_constraints(C[2],C[0],C[1]); 00144 } 00145 00146 template <class Gt, class Fb> 00147 inline void 00148 Constrained_triangulation_face_base_2<Gt,Fb>:: 00149 cw_permute() 00150 { 00151 Base::cw_permute(); 00152 set_constraints(C[1],C[2],C[0]); 00153 } 00154 00155 CGAL_END_NAMESPACE 00156 00157 #endif //CGAL_CONSTRAINED_TRIANGULATION_FACE_BASE_2_H 00158 00159 00160 00161 00162 00163 00164