Computational Geometry Algorithms Library  1.0
Computational Geometry Algorithms Library Documentation
FaceList.h
Go to the documentation of this file.
1 #include "DCELFace.h"
2 
3 using namespace std;
4 class FaceList
5 {
6 public:
7  FaceList();
8  ~FaceList();
11 
12  void addToList(DCELFace* newFace);
13  int length();
14  void removeFromList(DCELFace* face);
15 };
16 
17 FaceList::FaceList() : head(NULL)
18 {
19 }
20 
22 {
23 }
25 
28 void FaceList::addToList(DCELFace* newFace) {
29  if (head)
30  {
31  tail->next = newFace;
32  DCELFace *walker = newFace;
33  while (walker->next) walker = walker->next;
34  tail = walker;
35  }
36  else {
37  head = newFace;
38  tail = newFace;
39  }
40 }
41 
43  if (head) {
44  DCELFace* walker = head;
45  int length = 1;
46  while (walker->next) {
47  walker = walker->next;
48  length++;
49  }
50  return length - 1;
51  }
52  else return 0;
53 }
55 
59  if (face == head) {
60  head = head->next;
61  return;
62  }
63  DCELFace* walker = head;
64  while (walker) {
65  if (walker->next == face)
66  break;
67  walker = walker->next;
68  }
69  walker->next = walker->next->next;
70 }
71 
72 
73 
Definition: FaceList.h:4
void removeFromList(DCELFace *face)
CREATE FACES.
Definition: FaceList.h:58
Definition: DCELFace.h:1
void addToList(DCELFace *newFace)
CREATE FACES.
Definition: FaceList.h:28
DCELFace * head
Definition: FaceList.h:9
FaceList()
Definition: FaceList.h:17
int length()
Definition: FaceList.h:42
DCELFace * next
Definition: DCELFace.h:9
DCELFace * tail
Definition: FaceList.h:10
~FaceList()
Definition: FaceList.h:21