StatusNodeMods.hh
00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00055 template< class MeshT >
00056 struct AreaNodeMod
00057 {
00059 static inline bool is_area(const MeshT& _m, typename MeshT::VertexHandle _vh)
00060 { return _m.status(_vh).is_bit_set(AREA); }
00061
00063 static inline bool is_area(const MeshT& _m, typename MeshT::FaceHandle _fh)
00064 { return _m.status(_fh).is_bit_set(AREA); }
00065
00067 static bool is_vertex_selected(const MeshT& _mesh, typename MeshT::VertexHandle _vh)
00068 {
00069 if (_mesh.is_isolated(_vh))
00070 return is_area(_mesh, _vh);
00071 else
00072 return false;
00073 }
00074
00075
00077 static bool is_edge_selected(const MeshT& , typename MeshT::EdgeHandle )
00078 {
00079 return false;
00080 }
00081
00082
00084 static bool is_face_selected(const MeshT& _mesh, typename MeshT::FaceHandle _fh)
00085 {
00086 return is_area(_mesh, _fh);
00087 }
00088 };
00089
00092 template< class MeshT >
00093 struct HandleNodeMod
00094 {
00095
00097 static inline bool is_handle(const MeshT& _m, typename MeshT::VertexHandle _vh)
00098 { return _m.status(_vh).is_bit_set(HANDLEAREA); }
00099
00101 static inline bool is_handle(const MeshT& _m, typename MeshT::FaceHandle _fh)
00102 { return _m.status(_fh).is_bit_set(HANDLEAREA); }
00103
00104
00106 static bool is_vertex_selected(const MeshT& _mesh, typename MeshT::VertexHandle _vh)
00107 {
00108 if (!is_handle(_mesh, _vh))
00109 return false;
00110
00111 for (typename MeshT::CVFIter vf_it(_mesh.cvf_iter(_vh)); vf_it; ++vf_it)
00112 if (is_handle(_mesh, vf_it))
00113 return false;
00114
00115 return true;
00116 }
00117
00119 static bool is_edge_selected(const MeshT& _mesh, typename MeshT::EdgeHandle _eh)
00120 {
00121 typename MeshT::HalfedgeHandle hh;
00122 typename MeshT::FaceHandle fh;
00123
00124 hh = _mesh.halfedge_handle(_eh, 0);
00125 if (!is_handle(_mesh, _mesh.to_vertex_handle(hh))) return false;
00126
00127 fh = _mesh.face_handle(hh);
00128 if (fh.is_valid() && is_handle(_mesh, fh)) return false;
00129
00130 hh = _mesh.halfedge_handle(_eh, 1);
00131 if (!is_handle(_mesh, _mesh.to_vertex_handle(hh))) return false;
00132
00133 fh = _mesh.face_handle(hh);
00134 if (fh.is_valid() && is_handle(_mesh, fh)) return false;
00135
00136 return true;
00137 }
00138
00139
00141 static bool is_face_selected(const MeshT& _mesh, typename MeshT::FaceHandle _fh)
00142 {
00143 return is_handle(_mesh, _fh);
00144 }
00145 };
00146
00149 template< class MeshT >
00150 struct FeatureNodeMod
00151 {
00152
00154 static bool is_vertex_selected(const MeshT& _mesh, typename MeshT::VertexHandle _vh)
00155 {
00156 return _mesh.status(_vh).feature();
00157 }
00158
00160 static bool is_edge_selected(const MeshT& _mesh, typename MeshT::EdgeHandle _eh)
00161 {
00162 return _mesh.status(_eh).feature();
00163 }
00164
00165
00167 static bool is_face_selected(const MeshT& _mesh, typename MeshT::FaceHandle _fh)
00168 {
00169 return _mesh.status(_fh).feature();
00170 }
00171
00172 };
00173