BALL  1.4.79
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
graphFace.h
Go to the documentation of this file.
1 // -*- Mode: C++; tab-width: 2; -*-
2 // vi: set ts=2:
3 //
4 
5 #ifndef BALL_STRUCTURE_GRAPHFACE_H
6 #define BALL_STRUCTURE_GRAPHFACE_H
7 
8 #ifndef BALL_COMMON_H
9 # include <BALL/common.h>
10 #endif
11 
12 #include <list>
13 #include <vector>
14 
15 namespace BALL
16 {
17 
18  template <typename Vertex, typename Edge, typename Face>
19  class GraphVertex;
20 
21  template <typename Vertex, typename Edge, typename Face>
22  class GraphEdge;
23 
27  template <typename Vertex, typename Edge, typename Face>
28  class GraphFace
29  {
30  public:
31 
38  friend class GraphVertex<Vertex,Edge,Face>;
39  friend class GraphEdge<Vertex,Edge,Face>;
40 
42 
43 
46 
47  typedef typename std::list<Vertex*>::iterator VertexIterator;
48  typedef typename std::list<Vertex*>::const_iterator ConstVertexIterator;
49  typedef typename std::list<Edge*>::iterator EdgeIterator;
50  typedef typename std::list<Edge*>::const_iterator ConstEdgeIterator;
51 
53 
56 
60  GraphFace();
61 
69  GraphFace(const GraphFace<Vertex,Edge,Face>& face, bool deep = false);
70 
74  virtual ~GraphFace();
75 
77 
80 
87  void set(const GraphFace<Vertex,Edge,Face>& face, bool deep = false);
88 
94  GraphFace<Vertex,Edge,Face>& operator =
95  (const GraphFace<Vertex,Edge,Face>& face);
96 
98 
101 
105  void insert(Vertex* vertex);
106 
110  void insert(Edge* edge);
111 
115  void remove(Vertex* vertex);
116 
120  void remove(Edge* edge);
121 
125  Position numberOfVertices() const;
126 
130  Position numberOfEdges() const;
131 
132 
136  void setIndex(Index index);
137 
141  Index getIndex() const;
142 
150  bool getEdges(const Vertex* vertex, Edge*& edge1, Edge*& edge2) const;
151 
159  bool getEdge
160  (const Vertex* vertex1,
161  const Vertex* vertex2,
162  Edge*& edge) const;
163 
169  Edge* getSimilarEdge(const Edge* edge) const;
170 
177  bool substitute(const Vertex* old_vertex, Vertex* new_vertex);
178 
185  bool substitute(const Edge* old_edge, Edge* new_edge);
186 
188 
191 
195  virtual bool operator == (const Face& face) const;
196 
200  virtual bool operator != (const Face& face) const;
201 
205  virtual bool operator *= (const Face& face) const;
206 
212  Vertex* has(Vertex* vertex) const;
213 
218  Edge* has(Edge* edge) const;
219 
221 
224 
225  VertexIterator beginVertex();
226  ConstVertexIterator beginVertex() const;
227  VertexIterator endVertex();
228  ConstVertexIterator endVertex() const;
229  EdgeIterator beginEdge();
230  ConstEdgeIterator beginEdge() const;
231  EdgeIterator endEdge();
232  ConstEdgeIterator endEdge() const;
233 
235 
236  protected:
237 
238  /*_ @name Attributes
239  */
241 
242  /*_ The vertices of the GraphFace
243  */
244  std::list<Vertex*> vertex_;
245  /*_ The edges of the GraphFace
246  */
247  std::list<Edge*> edge_;
248  /* The index of the GraphFace
249  */
251 
253 
254  };
255 
256 
257 
258  template <typename Vertex, typename Edge, typename Face>
259  GraphFace<Vertex,Edge,Face>::GraphFace()
260  : vertex_(),
261  edge_(),
262  index_(-1)
263  {
264  }
265 
266 
267  template <typename Vertex, typename Edge, typename Face>
269  (const GraphFace<Vertex,Edge,Face>& face, bool deep)
270  : vertex_(),
271  edge_(),
272  index_(face.index_)
273  {
274  if (deep)
275  {
276  vertex_ = face.vertex_;
277  edge_ = face.edge_;
278  }
279  }
280 
281 
282  template <typename Vertex, typename Edge, typename Face>
284  {
285  }
286 
287 
288  template <typename Vertex, typename Edge, typename Face>
290  (const GraphFace<Vertex,Edge,Face>& face, bool deep)
291  {
292  if (this != &face)
293  {
294  if (deep)
295  {
296  vertex_ = face.vertex_;
297  edge_ = face.edge_;
298  }
299  index_ = face.index_;
300  }
301  }
302 
303 
304  template <typename Vertex, typename Edge, typename Face>
307  {
308  if (this != &face)
309  {
310  vertex_ = face.vertex_;
311  edge_ = face.edge_;
312  index_ = face.index_;
313  }
314  return *this;
315  }
316 
317 
318  template <typename Vertex, typename Edge, typename Face>
320  {
321  typename std::list<Vertex*>::iterator v = vertex_.begin();
322  bool found = false;
323  while ((!found) && (v != vertex_.end()))
324  {
325  found = (*v == vertex);
326  v++;
327  }
328  if (!found)
329  {
330  vertex_.push_back(vertex);
331  }
332  }
333 
334 
335  template <typename Vertex, typename Edge, typename Face>
337  {
338  typename std::list<Edge*>::iterator e = edge_.begin();
339  bool found = false;
340  while ((!found) && (e != edge_.end()))
341  {
342  found = (*e == edge);
343  e++;
344  }
345  if (!found)
346  {
347  edge_.push_back(edge);
348  }
349  }
350 
351 
352  template <typename Vertex, typename Edge, typename Face>
354  {
355  vertex_.remove(vertex);
356  }
357 
358 
359  template <typename Vertex, typename Edge, typename Face>
361  {
362  edge_.remove(edge);
363  }
364 
365 
366  template <typename Vertex, typename Edge, typename Face>
368  {
369  return vertex_.size();
370  }
371 
372 
373  template <typename Vertex, typename Edge, typename Face>
375  {
376  return edge_.size();
377  }
378 
379 
380  template <typename Vertex, typename Edge, typename Face>
382  {
383  index_ = index;
384  }
385 
386 
387  template <typename Vertex, typename Edge, typename Face>
389  {
390  return index_;
391  }
392 
393 
394  template <typename Vertex, typename Edge, typename Face>
396  (const Vertex* vertex,
397  Edge*& edge1,
398  Edge*& edge2) const
399  {
400  bool found1 = false;
401  bool found2 = false;
402  typename std::list<Edge*>::const_iterator e = edge_.begin();
403  while ((!found1) && (e != edge_.end()))
404  {
405  if (((*e)->vertex_[0] == vertex) || ((*e)->vertex_[1] == vertex))
406  {
407  edge1 = *e;
408  found1 = true;
409  }
410  e++;
411  }
412  if (found1)
413  {
414  while ((!found2) && (e != edge_.end()))
415  {
416  if (((*e)->vertex_[0] == vertex) || ((*e)->vertex_[1] == vertex))
417  {
418  edge2 = *e;
419  found2 = true;
420  }
421  e++;
422  }
423  }
424  return (found1 && found2);
425  }
426 
427 
428  template <typename Vertex, typename Edge, typename Face>
430  (const Vertex* vertex1,
431  const Vertex* vertex2,
432  Edge*& edge) const
433  {
434  typename std::list<Edge*>::const_iterator e = edge_.begin();
435  bool found = false;
436  while ((!found) && (e != edge_.end()))
437  {
438  if ((((*e)->vertex_[0] == vertex1) && ((*e)->vertex_[1] == vertex2)) ||
439  (((*e)->vertex_[0] == vertex2) && ((*e)->vertex_[1] == vertex1)) )
440  {
441  edge = *e;
442  found = true;
443  }
444  e++;
445  }
446  return found;
447  }
448 
449 
450  template <typename Vertex, typename Edge, typename Face>
451  Edge* GraphFace<Vertex,Edge,Face>::getSimilarEdge(const Edge* edge) const
452  {
453  typename std::list<Edge*>::const_iterator e = edge_.begin();
454  while (e != edge_.end())
455  {
456  if (**e *= *edge)
457  {
458  return *e;
459  }
460  e++;
461  }
462  return NULL;
463  }
464 
465 
466  template <typename Vertex, typename Edge, typename Face>
468  (const Vertex* old_vertex, Vertex* new_vertex)
469  {
470  typename std::list<Vertex*>::iterator v = vertex_.begin();
471  while (v != vertex_.end())
472  {
473  if (*v == old_vertex)
474  {
475  *v = new_vertex;
476  return true;
477  }
478  v++;
479  }
480  return false;
481  }
482 
483 
484  template <typename Vertex, typename Edge, typename Face>
486  (const Edge* old_edge, Edge* new_edge)
487  {
488  typename std::list<Edge*>::iterator e = edge_.begin();
489  while (e != edge_.end())
490  {
491  if (*e == old_edge)
492  {
493  *e = new_edge;
494  return true;
495  }
496  e++;
497  }
498  return false;
499  }
500 
501 
502  template <typename Vertex, typename Edge, typename Face>
504  {
505  return true;
506  }
507 
508 
509  template <typename Vertex, typename Edge, typename Face>
511  {
512  return false;
513  }
514 
515 
516  template <typename Vertex, typename Edge, typename Face>
518  {
519  return true;
520  }
521 
522 
523  template <typename Vertex, typename Edge, typename Face>
525  {
526  typename std::list<Vertex*>::const_iterator v = vertex_.begin();
527  while (v != vertex_.end())
528  {
529  if (*v == vertex)
530  {
531  return *v;
532  }
533  v++;
534  }
535  return NULL;
536  }
537 
538 
539  template <typename Vertex, typename Edge, typename Face>
540  Edge* GraphFace<Vertex,Edge,Face>::has(Edge* edge) const
541  {
542  typename std::list<Edge*>::const_iterator e = edge_.begin();
543  while (e != edge_.end())
544  {
545  if (*e == edge)
546  {
547  return *e;
548  }
549  e++;
550  }
551  return NULL;
552  }
553 
554 
555  template <typename Vertex, typename Edge, typename Face>
558  {
559  return vertex_.begin();
560  }
561 
562 
563  template <typename Vertex, typename Edge, typename Face>
566  {
567  return vertex_.begin();
568  }
569 
570 
571  template <typename Vertex, typename Edge, typename Face>
574  {
575  return vertex_.end();
576  }
577 
578 
579  template <typename Vertex, typename Edge, typename Face>
582  {
583  return vertex_.end();
584  }
585 
586 
587  template <typename Vertex, typename Edge, typename Face>
590  {
591  return edge_.begin();
592  }
593 
594 
595  template <typename Vertex, typename Edge, typename Face>
598  {
599  return edge_.begin();
600  }
601 
602 
603  template <typename Vertex, typename Edge, typename Face>
606  {
607  return edge_.end();
608  }
609 
610 
611  template <typename Vertex, typename Edge, typename Face>
614  {
615  return edge_.end();
616  }
617 
618 
619 
623  template <typename Vertex, typename Edge, typename Face>
624  class GraphTriangle
625  {
626  public:
627 
634  friend class GraphVertex<Vertex,Edge,Face>;
635  friend class GraphEdge<Vertex,Edge,Face>;
636 
640 
642 
643 
646  GraphTriangle();
647 
655  GraphTriangle
656  (const GraphTriangle<Vertex,Edge,Face>& face, bool deep = false);
657 
668  GraphTriangle
669  (Vertex* vertex1, Vertex* vertex2, Vertex* vertex3,
670  Edge* edge1, Edge* edge2, Edge* edge3,
671  Index index);
672 
676  virtual ~GraphTriangle();
677 
679 
682 
690  void set(const GraphTriangle<Vertex,Edge,Face>& face, bool deep = false);
691 
697  GraphTriangle<Vertex,Edge,Face>& operator =
698  (const GraphTriangle<Vertex,Edge,Face>& face);
699 
709  void set
710  (Vertex* vertex1, Vertex* vertex2, Vertex* vertex3,
711  Edge* edge1, Edge* edge2, Edge* edge3,
712  Index index);
713 
715 
718 
724  void setVertex(Position i, Vertex* vertex)
725  throw(Exception::IndexOverflow);
726 
733  Vertex* getVertex(Position i) const
734  throw(Exception::IndexOverflow);
735 
741  void setEdge(Position i, Edge* edge)
742  throw(Exception::IndexOverflow);
743 
749  Edge* getEdge(Position i) const
750  throw(Exception::IndexOverflow);
751 
755  void setIndex(Index index);
756 
760  Index getIndex() const;
761 
769  bool getEdges(const Vertex* vertex, Edge*& edge1, Edge*& edge2) const;
770 
779  bool getEdge
780  (const Vertex* vertex1,
781  const Vertex* vertex2,
782  Edge*& edge) const;
783 
791  Index getSimilarEdge(const Edge* edge, Edge*& similar_edge) const;
792 
796  Index getRelativeIndex(const Vertex* vertex) const;
797 
801  Index getRelativeIndex(const Edge* edge) const;
802 
808  Vertex* third(const Vertex* v1, const Vertex* v2) const;
809 
815  Edge* third(const Edge* e1, const Edge* e2) const;
816 
817 
823  Edge* getOppositeEdge(const Vertex* vertex) const;
824 
825 
831  Vertex* getOppositeVertex(const Edge* edge) const;
832 
839  bool substitute(const Vertex* old_vertex, Vertex* new_vertex);
840 
847  bool substitute(const Edge* old_edge, Edge* new_edge);
848 
850 
853 
857  virtual bool operator == (const Face&) const;
858 
862  virtual bool operator != (const Face&) const;
863 
867  virtual bool operator *= (const Face&) const;
868 
874  Vertex* has(Vertex* vertex) const;
875 
880  Edge* has(Edge* edge) const;
881 
883 
884  protected:
885 
886  /*_ The vertices of the GraphTriangle
887  */
888  Vertex* vertex_[3];
889  /*_ The edges of the GraphTriangle
890  */
891  Edge* edge_[3];
892  /* The index of the GraphTriangle
893  */
895 
896  };
897 
898 
899 
900  template <typename Vertex, typename Edge, typename Face>
901  GraphTriangle<Vertex,Edge,Face>::GraphTriangle()
902  : index_(-1)
903  {
904  vertex_[0] = NULL;
905  vertex_[1] = NULL;
906  vertex_[2] = NULL;
907  edge_[0] = NULL;
908  edge_[1] = NULL;
909  edge_[2] = NULL;
910  }
911 
912 
913  template <typename Vertex, typename Edge, typename Face>
915  (const GraphTriangle<Vertex,Edge,Face>& face, bool deep)
916  : index_(face.index_)
917  {
918  if (deep)
919  {
920  vertex_[0] = face.vertex_[0];
921  vertex_[1] = face.vertex_[1];
922  vertex_[2] = face.vertex_[2];
923  edge_[0] = face.edge_[0];
924  edge_[1] = face.edge_[1];
925  edge_[2] = face.edge_[2];
926  }
927  else
928  {
929  vertex_[0] = NULL;
930  vertex_[1] = NULL;
931  vertex_[2] = NULL;
932  edge_[0] = NULL;
933  edge_[1] = NULL;
934  edge_[2] = NULL;
935  }
936  }
937 
938 
939  template <typename Vertex, typename Edge, typename Face>
941  (Vertex* vertex1, Vertex* vertex2, Vertex* vertex3,
942  Edge* edge1, Edge* edge2, Edge* edge3,
943  Index index)
944  : index_(index)
945  {
946  vertex_[0] = vertex1;
947  vertex_[1] = vertex2;
948  vertex_[2] = vertex3;
949  edge_[0] = edge1;
950  edge_[1] = edge2;
951  edge_[2] = edge3;
952  }
953 
954 
955  template <typename Vertex, typename Edge, typename Face>
957  {
958  }
959 
960 
961  template <typename Vertex, typename Edge, typename Face>
963  (const GraphTriangle<Vertex,Edge,Face>& face, bool deep)
964  {
965  if (this != &face)
966  {
967  if (deep)
968  {
969  vertex_[0] = face.vertex_[0];
970  vertex_[1] = face.vertex_[1];
971  vertex_[2] = face.vertex_[2];
972  edge_[0] = face.edge_[0];
973  edge_[1] = face.edge_[1];
974  edge_[2] = face.edge_[2];
975  }
976  else
977  {
978  vertex_[0] = NULL;
979  vertex_[1] = NULL;
980  vertex_[2] = NULL;
981  edge_[0] = NULL;
982  edge_[1] = NULL;
983  edge_[2] = NULL;
984  }
985  index_ = face.index_;
986  }
987  }
988 
989 
990  template <typename Vertex, typename Edge, typename Face>
993  {
994  if (this != &face)
995  {
996  vertex_[0] = face.vertex_[0];
997  vertex_[1] = face.vertex_[1];
998  vertex_[2] = face.vertex_[2];
999  edge_[0] = face.edge_[0];
1000  edge_[1] = face.edge_[1];
1001  edge_[2] = face.edge_[2];
1002  index_ = face.index_;
1003  }
1004  return *this;
1005  }
1006 
1007 
1008  template <typename Vertex, typename Edge, typename Face>
1010  (Vertex* vertex1, Vertex* vertex2, Vertex* vertex3,
1011  Edge* edge1, Edge* edge2, Edge* edge3,
1012  Index index)
1013  {
1014  vertex_[0] = vertex1;
1015  vertex_[1] = vertex2;
1016  vertex_[2] = vertex3;
1017  edge_[0] = edge1;
1018  edge_[1] = edge2;
1019  edge_[2] = edge3;
1020  index_ = index;
1021  }
1022 
1023 
1024  template <typename Vertex, typename Edge, typename Face>
1027  {
1028  if (i > 2)
1029  {
1030  throw Exception::IndexOverflow(__FILE__,__LINE__,i,2);
1031  }
1032  else
1033  {
1034  vertex_[i] = vertex;
1035  }
1036  }
1037 
1038 
1039  template <typename Vertex, typename Edge, typename Face>
1042  {
1043  if (i > 2)
1044  {
1045  throw Exception::IndexOverflow(__FILE__,__LINE__,i,2);
1046  }
1047  else
1048  {
1049  return vertex_[i];
1050  }
1051  }
1052 
1053 
1054  template <typename Vertex, typename Edge, typename Face>
1057  {
1058  if (i > 2)
1059  {
1060  throw Exception::IndexOverflow(__FILE__,__LINE__,i,2);
1061  }
1062  else
1063  {
1064  edge_[i] = edge;
1065  }
1066  }
1067 
1068 
1069  template <typename Vertex, typename Edge, typename Face>
1072  {
1073  if (i > 2)
1074  {
1075  throw Exception::IndexOverflow(__FILE__,__LINE__,i,2);
1076  }
1077  else
1078  {
1079  return edge_[i];
1080  }
1081  }
1082 
1083 
1084  template <typename Vertex, typename Edge, typename Face>
1086  {
1087  index_ = index;
1088  }
1089 
1090 
1091  template <typename Vertex, typename Edge, typename Face>
1093  {
1094  return index_;
1095  }
1096 
1097 
1098  template <typename Vertex, typename Edge, typename Face>
1100  (const Vertex* vertex,
1101  Edge*& edge1,
1102  Edge*& edge2) const
1103  {
1104  Position i = 0;
1105  bool found1 = false;
1106  bool found2 = false;
1107  while ((!found1) && (i < 3))
1108  {
1109  if (edge_[i] != NULL)
1110  {
1111  if ((edge_[i]->vertex_[0] == vertex) ||
1112  (edge_[i]->vertex_[1] == vertex) )
1113  {
1114  edge1 = edge_[i];
1115  found1 = true;
1116  }
1117  }
1118  i++;
1119  }
1120  if (found1)
1121  {
1122  while ((!found2) && (i < 3))
1123  {
1124  if (edge_[i] != NULL)
1125  {
1126  if ((edge_[i]->vertex_[0] == vertex) ||
1127  (edge_[i]->vertex_[1] == vertex) )
1128  {
1129  edge2 = edge_[i];
1130  found2 = true;
1131  }
1132  }
1133  i++;
1134  }
1135  }
1136  return (found1 && found2);
1137  }
1138 
1139 
1140  template <typename Vertex, typename Edge, typename Face>
1142  (const Vertex* vertex1,
1143  const Vertex* vertex2,
1144  Edge*& edge) const
1145  {
1146  Position i = 0;
1147  bool found = false;
1148  while ((!found) && (i < 3))
1149  {
1150  if (edge_[i] != NULL)
1151  {
1152  if (((edge_[i]->vertex_[0] == vertex1) &&
1153  (edge_[i]->vertex_[1] == vertex2) ) ||
1154  ((edge_[i]->vertex_[0] == vertex2) &&
1155  (edge_[i]->vertex_[1] == vertex1) ) )
1156  {
1157  edge = edge_[i];
1158  found = true;
1159  }
1160  }
1161  i++;
1162  }
1163  return found;
1164  }
1165 
1166 
1167  template <typename Vertex, typename Edge, typename Face>
1169  (const Edge* edge, Edge*& similar_edge) const
1170  {
1171  if (*edge_[0] *= *edge)
1172  {
1173  similar_edge = edge_[0];
1174  return 0;
1175  }
1176  if (*edge_[1] *= *edge)
1177  {
1178  similar_edge = edge_[1];
1179  return 1;
1180  }
1181  if (*edge_[2] *= *edge)
1182  {
1183  similar_edge = edge_[2];
1184  return 2;
1185  }
1186  similar_edge = NULL;
1187  return -1;
1188  }
1189 
1190 
1191  template <typename Vertex, typename Edge, typename Face>
1193  (const Vertex* vertex) const
1194  {
1195  for (Position i = 0; i < 3; i++)
1196  {
1197  if (vertex_[i] == vertex)
1198  {
1199  return i;
1200  }
1201  }
1202  return -1;
1203  }
1204 
1205 
1206  template <typename Vertex, typename Edge, typename Face>
1208  (const Edge* edge) const
1209  {
1210  for (Position i = 0; i < 3; i++)
1211  {
1212  if (edge_[i] == edge)
1213  {
1214  return i;
1215  }
1216  }
1217  return -1;
1218  }
1219 
1220 
1221  template <typename Vertex, typename Edge, typename Face>
1223  (const Vertex* v1, const Vertex* v2) const
1224  {
1225  if ((vertex_[0] == v1) || (vertex_[0] == v2))
1226  {
1227  if ((vertex_[1] == v1) || (vertex_[1] == v2))
1228  {
1229  return vertex_[2];
1230  }
1231  else
1232  {
1233  return vertex_[1];
1234  }
1235  }
1236  else
1237  {
1238  return vertex_[0];
1239  }
1240  }
1241 
1242 
1243  template <typename Vertex, typename Edge, typename Face>
1245  (const Edge* e1, const Edge* e2) const
1246  {
1247  if ((edge_[0] == e1) || (edge_[0] == e2))
1248  {
1249  if ((edge_[1] == e1) || (edge_[1] == e2))
1250  {
1251  return edge_[2];
1252  }
1253  else
1254  {
1255  return edge_[1];
1256  }
1257  }
1258  else
1259  {
1260  return edge_[0];
1261  }
1262  }
1263 
1264 
1265  template <typename Vertex, typename Edge, typename Face>
1267  (const Vertex* vertex) const
1268  {
1269  for (Position i = 0; i < 3; i++)
1270  {
1271  if ((edge_[i]->vertex_[0] != vertex) &&
1272  (edge_[i]->vertex_[1] != vertex) )
1273  {
1274  return edge_[i];
1275  }
1276  }
1277  return NULL;
1278  }
1279 
1280 
1281  template <typename Vertex, typename Edge, typename Face>
1283  (const Edge* edge) const
1284  {
1285  for (Position i = 0; i < 3; i++)
1286  {
1287  if ((vertex_[i] != edge->vertex_[0]) &&
1288  (vertex_[i] != edge->vertex_[1]) )
1289  {
1290  return vertex_[i];
1291  }
1292  }
1293  return NULL;
1294  }
1295 
1296 
1297  template <typename Vertex, typename Edge, typename Face>
1299  (const Vertex* old_vertex, Vertex* new_vertex)
1300  {
1301  for (Position i = 0; i < 3; i++)
1302  {
1303  if (vertex_[i] == old_vertex)
1304  {
1305  vertex_[i] = new_vertex;
1306  return true;
1307  }
1308  }
1309  return false;
1310  }
1311 
1312 
1313  template <typename Vertex, typename Edge, typename Face>
1315  (const Edge* old_edge, Edge* new_edge)
1316  {
1317  for (Position i = 0; i < 3; i++)
1318  {
1319  if (edge_[i] == old_edge)
1320  {
1321  edge_[i] = new_edge;
1322  return true;
1323  }
1324  }
1325  return false;
1326  }
1327 
1328 
1329  template <typename Vertex, typename Edge, typename Face>
1331  {
1332  return true;
1333  }
1334 
1335 
1336  template <typename Vertex, typename Edge, typename Face>
1338  {
1339  return false;
1340  }
1341 
1342 
1343  template <typename Vertex, typename Edge, typename Face>
1345  {
1346  return true;
1347  }
1348 
1349 
1350  template <typename Vertex, typename Edge, typename Face>
1352  {
1353  if (vertex_[0] == vertex)
1354  {
1355  return vertex_[0];
1356  }
1357  if (vertex_[1] == vertex)
1358  {
1359  return vertex_[1];
1360  }
1361  if (vertex_[2] == vertex)
1362  {
1363  return vertex_[2];
1364  }
1365  return NULL;
1366  }
1367 
1368 
1369  template <typename Vertex, typename Edge, typename Face>
1371  {
1372  if (edge_[0] == edge)
1373  {
1374  return edge_[0];
1375  }
1376  if (edge_[1] == edge)
1377  {
1378  return edge_[1];
1379  }
1380  if (edge_[2] == edge)
1381  {
1382  return edge_[2];
1383  }
1384  return NULL;
1385  }
1386 
1387 
1388 } // namespace BALL
1389 
1390 #endif // BALL_STRUCTURE_RSFACE_H
void set(const GraphTriangle< Vertex, Edge, Face > &face, bool deep=false)
Definition: graphFace.h:963
Position numberOfVertices() const
Definition: graphFace.h:367
std::list< SASVertex * >::iterator VertexIterator
Definition: graphFace.h:47
#define BALL_CREATE(name)
Definition: create.h:62
Vertex * vertex_[3]
Definition: graphFace.h:888
Edge * getSimilarEdge(const Edge *edge) const
Definition: graphFace.h:451
Index getSimilarEdge(const Edge *edge, Edge *&similar_edge) const
Definition: graphFace.h:1169
void insert(Vertex *vertex)
Definition: graphFace.h:319
std::list< SASEdge * >::iterator EdgeIterator
Definition: graphFace.h:49
std::list< Edge * > edge_
Definition: graphFace.h:247
bool substitute(const Vertex *old_vertex, Vertex *new_vertex)
Definition: graphFace.h:468
virtual ~GraphTriangle()
Definition: graphFace.h:956
bool getEdges(const Vertex *vertex, Edge *&edge1, Edge *&edge2) const
Definition: graphFace.h:396
Position numberOfEdges() const
Definition: graphFace.h:374
std::list< Vertex * > vertex_
Definition: graphFace.h:244
bool getEdges(const Vertex *vertex, Edge *&edge1, Edge *&edge2) const
Definition: graphFace.h:1100
virtual bool operator!=(const Face &face) const
Definition: graphFace.h:510
virtual ~GraphFace()
Definition: graphFace.h:283
Vertex * getOppositeVertex(const Edge *edge) const
Definition: graphFace.h:1283
void setEdge(Position i, Edge *edge)
Definition: graphFace.h:1055
Vertex * has(Vertex *vertex) const
Definition: graphFace.h:524
Index getIndex() const
Definition: graphFace.h:1092
EdgeIterator endEdge()
Definition: graphFace.h:605
virtual bool operator==(const Face &) const
Definition: graphFace.h:1330
VertexIterator beginVertex()
Definition: graphFace.h:557
void remove(Vertex *vertex)
Definition: graphFace.h:353
virtual bool operator*=(const Face &) const
Definition: graphFace.h:1344
void setIndex(Index index)
Definition: graphFace.h:381
virtual bool operator!=(const Face &) const
Definition: graphFace.h:1337
Vertex * third(const Vertex *v1, const Vertex *v2) const
Definition: graphFace.h:1223
void setIndex(Index index)
Definition: graphFace.h:1085
Edge * getOppositeEdge(const Vertex *vertex) const
Definition: graphFace.h:1267
Index getRelativeIndex(const Vertex *vertex) const
Definition: graphFace.h:1193
Vertex * getVertex(Position i) const
Definition: graphFace.h:1040
bool getEdge(const Vertex *vertex1, const Vertex *vertex2, Edge *&edge) const
Definition: graphFace.h:430
Edge * getEdge(Position i) const
Definition: graphFace.h:1070
virtual bool operator==(const Face &face) const
Definition: graphFace.h:503
VertexIterator endVertex()
Definition: graphFace.h:573
void setVertex(Position i, Vertex *vertex)
Definition: graphFace.h:1025
bool substitute(const Vertex *old_vertex, Vertex *new_vertex)
Definition: graphFace.h:1299
EdgeIterator beginEdge()
Definition: graphFace.h:589
void set(const GraphFace< Vertex, Edge, Face > &face, bool deep=false)
Definition: graphFace.h:290
Vertex * has(Vertex *vertex) const
Definition: graphFace.h:1351
virtual bool operator*=(const Face &face) const
Definition: graphFace.h:517
std::list< SASEdge * >::const_iterator ConstEdgeIterator
Definition: graphFace.h:50
Index getIndex() const
Definition: graphFace.h:388
std::list< SASVertex * >::const_iterator ConstVertexIterator
Definition: graphFace.h:48