-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvertex.h
More file actions
39 lines (31 loc) · 754 Bytes
/
vertex.h
File metadata and controls
39 lines (31 loc) · 754 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#ifndef VERTEX
#define VERTEX
#include <stdlib.h>
#include <stdbool.h>
#include "point.h"
typedef struct tVertexStructure tsVertex; // Used only in NEW()
typedef tsVertex *tVertex;
struct tVertexStructure {
int vnum; // index
tPointi v; // Coordinates
bool ear; // True iff an ear
tVertex next,prev;
};
tVertex vertices; // Head of ciruclar list
#define NEW(p,type) \
if((p = (type *) malloc(sizeof(type))) == NULL) { \
printf("New: Out of memory\n"); \
exit(EXIT_FAILURE); \
}
#define ADD(head,p) \
if(head) { \
p->next = head; \
p->prev = head->prev; \
head->prev = p; \
p->prev->next = p; \
} else { \
head = p; \
head->next = head->prev = p; \
}
#define FREE(p) p ? free((char *) p) : p = NULL;
#endif