5 #ifndef BALL_STRUCTURE_GRAPHFACE_H
6 #define BALL_STRUCTURE_GRAPHFACE_H
18 template <
typename Vertex,
typename Edge,
typename Face>
21 template <
typename Vertex,
typename Edge,
typename Face>
27 template <
typename Vertex,
typename Edge,
typename Face>
87 void set(const GraphFace<Vertex,Edge,Face>& face,
bool deep = false);
94 GraphFace<Vertex,Edge,Face>& operator =
95 (const GraphFace<Vertex,Edge,Face>& face);
105 void insert(Vertex* vertex);
115 void remove(Vertex* vertex);
150 bool getEdges(const Vertex* vertex, Edge*& edge1, Edge*& edge2) const;
160 (const Vertex* vertex1,
161 const Vertex* vertex2,
177 bool substitute(const Vertex* old_vertex, Vertex* new_vertex);
185 bool substitute(const Edge* old_edge, Edge* new_edge);
195 virtual
bool operator == (const Face& face) const;
200 virtual
bool operator != (const Face& face) const;
205 virtual
bool operator *= (const Face& face) const;
212 Vertex*
has(Vertex* vertex) const;
218 Edge*
has(Edge* edge) const;
226 ConstVertexIterator beginVertex() const;
228 ConstVertexIterator endVertex() const;
230 ConstEdgeIterator beginEdge() const;
232 ConstEdgeIterator endEdge() const;
258 template <typename Vertex, typename Edge, typename Face>
259 GraphFace<Vertex,Edge,Face>::GraphFace()
267 template <
typename Vertex,
typename Edge,
typename Face>
282 template <
typename Vertex,
typename Edge,
typename Face>
288 template <
typename Vertex,
typename Edge,
typename Face>
304 template <
typename Vertex,
typename Edge,
typename Face>
318 template <
typename Vertex,
typename Edge,
typename Face>
321 typename std::list<Vertex*>::iterator v =
vertex_.begin();
323 while ((!found) && (v !=
vertex_.end()))
325 found = (*v == vertex);
335 template <
typename Vertex,
typename Edge,
typename Face>
338 typename std::list<Edge*>::iterator e =
edge_.begin();
340 while ((!found) && (e !=
edge_.end()))
342 found = (*e == edge);
347 edge_.push_back(edge);
352 template <
typename Vertex,
typename Edge,
typename Face>
359 template <
typename Vertex,
typename Edge,
typename Face>
366 template <
typename Vertex,
typename Edge,
typename Face>
373 template <
typename Vertex,
typename Edge,
typename Face>
380 template <
typename Vertex,
typename Edge,
typename Face>
387 template <
typename Vertex,
typename Edge,
typename Face>
394 template <
typename Vertex,
typename Edge,
typename Face>
402 typename std::list<Edge*>::const_iterator e =
edge_.begin();
403 while ((!found1) && (e !=
edge_.end()))
405 if (((*e)->vertex_[0] == vertex) || ((*e)->vertex_[1] == vertex))
414 while ((!found2) && (e !=
edge_.end()))
416 if (((*e)->vertex_[0] == vertex) || ((*e)->vertex_[1] == vertex))
424 return (found1 && found2);
428 template <
typename Vertex,
typename Edge,
typename Face>
434 typename std::list<Edge*>::const_iterator e =
edge_.begin();
436 while ((!found) && (e !=
edge_.end()))
438 if ((((*e)->vertex_[0] == vertex1) && ((*e)->vertex_[1] == vertex2)) ||
439 (((*e)->vertex_[0] == vertex2) && ((*e)->vertex_[1] == vertex1)) )
450 template <
typename Vertex,
typename Edge,
typename Face>
453 typename std::list<Edge*>::const_iterator e =
edge_.begin();
454 while (e !=
edge_.end())
466 template <
typename Vertex,
typename Edge,
typename Face>
470 typename std::list<Vertex*>::iterator v =
vertex_.begin();
473 if (*v == old_vertex)
484 template <
typename Vertex,
typename Edge,
typename Face>
486 (
const Edge* old_edge, Edge* new_edge)
488 typename std::list<Edge*>::iterator e =
edge_.begin();
489 while (e !=
edge_.end())
502 template <
typename Vertex,
typename Edge,
typename Face>
509 template <
typename Vertex,
typename Edge,
typename Face>
516 template <
typename Vertex,
typename Edge,
typename Face>
523 template <
typename Vertex,
typename Edge,
typename Face>
526 typename std::list<Vertex*>::const_iterator v =
vertex_.begin();
539 template <
typename Vertex,
typename Edge,
typename Face>
542 typename std::list<Edge*>::const_iterator e =
edge_.begin();
543 while (e !=
edge_.end())
555 template <
typename Vertex,
typename Edge,
typename Face>
563 template <
typename Vertex,
typename Edge,
typename Face>
571 template <
typename Vertex,
typename Edge,
typename Face>
579 template <
typename Vertex,
typename Edge,
typename Face>
587 template <
typename Vertex,
typename Edge,
typename Face>
591 return edge_.begin();
595 template <
typename Vertex,
typename Edge,
typename Face>
599 return edge_.begin();
603 template <
typename Vertex,
typename Edge,
typename Face>
611 template <
typename Vertex,
typename Edge,
typename Face>
623 template <
typename Vertex,
typename Edge,
typename Face>
656 (const GraphTriangle<
Vertex,Edge,Face>& face,
bool deep = false);
669 (Vertex* vertex1, Vertex* vertex2, Vertex* vertex3,
670 Edge* edge1, Edge* edge2, Edge* edge3,
676 virtual ~GraphTriangle();
690 void set(const GraphTriangle<Vertex,Edge,Face>& face,
bool deep = false);
697 GraphTriangle<Vertex,Edge,Face>& operator =
698 (const GraphTriangle<Vertex,Edge,Face>& face);
710 (Vertex* vertex1, Vertex* vertex2, Vertex* vertex3,
711 Edge* edge1, Edge* edge2, Edge* edge3,
724 void setVertex(
Position i, Vertex* vertex)
725 throw(Exception::IndexOverflow);
734 throw(Exception::IndexOverflow);
741 void setEdge(
Position i, Edge* edge)
742 throw(Exception::IndexOverflow);
750 throw(Exception::IndexOverflow);
769 bool getEdges(const Vertex* vertex, Edge*& edge1, Edge*& edge2) const;
780 (const Vertex* vertex1,
781 const Vertex* vertex2,
796 Index getRelativeIndex(const Vertex* vertex) const;
801 Index getRelativeIndex(const Edge* edge) const;
808 Vertex* third(const Vertex* v1, const Vertex* v2) const;
815 Edge* third(const Edge* e1, const Edge* e2) const;
823 Edge* getOppositeEdge(const Vertex* vertex) const;
831 Vertex* getOppositeVertex(const Edge* edge) const;
839 bool substitute(const Vertex* old_vertex, Vertex* new_vertex);
847 bool substitute(const Edge* old_edge, Edge* new_edge);
857 virtual
bool operator == (const Face&) const;
862 virtual
bool operator != (const Face&) const;
867 virtual
bool operator *= (const Face&) const;
874 Vertex*
has(Vertex* vertex) const;
880 Edge*
has(Edge* edge) const;
900 template <typename Vertex, typename Edge, typename Face>
901 GraphTriangle<Vertex,Edge,Face>::GraphTriangle()
913 template <
typename Vertex,
typename Edge,
typename Face>
939 template <
typename Vertex,
typename Edge,
typename Face>
942 Edge* edge1, Edge* edge2, Edge* edge3,
955 template <
typename Vertex,
typename Edge,
typename Face>
961 template <
typename Vertex,
typename Edge,
typename Face>
990 template <
typename Vertex,
typename Edge,
typename Face>
1008 template <
typename Vertex,
typename Edge,
typename Face>
1011 Edge* edge1, Edge* edge2, Edge* edge3,
1024 template <
typename Vertex,
typename Edge,
typename Face>
1039 template <
typename Vertex,
typename Edge,
typename Face>
1054 template <
typename Vertex,
typename Edge,
typename Face>
1069 template <
typename Vertex,
typename Edge,
typename Face>
1084 template <
typename Vertex,
typename Edge,
typename Face>
1091 template <
typename Vertex,
typename Edge,
typename Face>
1098 template <
typename Vertex,
typename Edge,
typename Face>
1105 bool found1 =
false;
1106 bool found2 =
false;
1107 while ((!found1) && (i < 3))
1109 if (
edge_[i] != NULL)
1122 while ((!found2) && (i < 3))
1124 if (
edge_[i] != NULL)
1136 return (found1 && found2);
1140 template <
typename Vertex,
typename Edge,
typename Face>
1148 while ((!found) && (i < 3))
1150 if (
edge_[i] != NULL)
1167 template <
typename Vertex,
typename Edge,
typename Face>
1169 (
const Edge* edge, Edge*& similar_edge)
const
1171 if (*
edge_[0] *= *edge)
1173 similar_edge =
edge_[0];
1176 if (*
edge_[1] *= *edge)
1178 similar_edge =
edge_[1];
1181 if (*
edge_[2] *= *edge)
1183 similar_edge =
edge_[2];
1186 similar_edge = NULL;
1191 template <
typename Vertex,
typename Edge,
typename Face>
1206 template <
typename Vertex,
typename Edge,
typename Face>
1208 (
const Edge* edge)
const
1212 if (
edge_[i] == edge)
1221 template <
typename Vertex,
typename Edge,
typename Face>
1243 template <
typename Vertex,
typename Edge,
typename Face>
1245 (
const Edge* e1,
const Edge* e2)
const
1265 template <
typename Vertex,
typename Edge,
typename Face>
1281 template <
typename Vertex,
typename Edge,
typename Face>
1283 (
const Edge* edge)
const
1287 if ((
vertex_[i] != edge->vertex_[0]) &&
1288 (
vertex_[i] != edge->vertex_[1]) )
1297 template <
typename Vertex,
typename Edge,
typename Face>
1313 template <
typename Vertex,
typename Edge,
typename Face>
1315 (
const Edge* old_edge, Edge* new_edge)
1319 if (
edge_[i] == old_edge)
1321 edge_[i] = new_edge;
1329 template <
typename Vertex,
typename Edge,
typename Face>
1336 template <
typename Vertex,
typename Edge,
typename Face>
1343 template <
typename Vertex,
typename Edge,
typename Face>
1350 template <
typename Vertex,
typename Edge,
typename Face>
1369 template <
typename Vertex,
typename Edge,
typename Face>
1372 if (
edge_[0] == edge)
1376 if (
edge_[1] == edge)
1380 if (
edge_[2] == edge)
1390 #endif // BALL_STRUCTURE_RSFACE_H
void set(const GraphTriangle< Vertex, Edge, Face > &face, bool deep=false)
Position numberOfVertices() const
std::list< SASVertex * >::iterator VertexIterator
#define BALL_CREATE(name)
Edge * getSimilarEdge(const Edge *edge) const
Index getSimilarEdge(const Edge *edge, Edge *&similar_edge) const
void insert(Vertex *vertex)
std::list< SASEdge * >::iterator EdgeIterator
std::list< Edge * > edge_
bool substitute(const Vertex *old_vertex, Vertex *new_vertex)
bool getEdges(const Vertex *vertex, Edge *&edge1, Edge *&edge2) const
Position numberOfEdges() const
std::list< Vertex * > vertex_
bool getEdges(const Vertex *vertex, Edge *&edge1, Edge *&edge2) const
virtual bool operator!=(const Face &face) const
Vertex * getOppositeVertex(const Edge *edge) const
void setEdge(Position i, Edge *edge)
Vertex * has(Vertex *vertex) const
virtual bool operator==(const Face &) const
VertexIterator beginVertex()
void remove(Vertex *vertex)
virtual bool operator*=(const Face &) const
void setIndex(Index index)
virtual bool operator!=(const Face &) const
Vertex * third(const Vertex *v1, const Vertex *v2) const
void setIndex(Index index)
Edge * getOppositeEdge(const Vertex *vertex) const
Index getRelativeIndex(const Vertex *vertex) const
Vertex * getVertex(Position i) const
bool getEdge(const Vertex *vertex1, const Vertex *vertex2, Edge *&edge) const
Edge * getEdge(Position i) const
virtual bool operator==(const Face &face) const
VertexIterator endVertex()
void setVertex(Position i, Vertex *vertex)
bool substitute(const Vertex *old_vertex, Vertex *new_vertex)
void set(const GraphFace< Vertex, Edge, Face > &face, bool deep=false)
Vertex * has(Vertex *vertex) const
virtual bool operator*=(const Face &face) const
std::list< SASEdge * >::const_iterator ConstEdgeIterator
std::list< SASVertex * >::const_iterator ConstVertexIterator