-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathprim.h
94 lines (79 loc) · 1.56 KB
/
prim.h
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
#pragma once
#include "linalg.h"
typedef int Id;
typedef struct bdSolid bdSolid;
typedef struct bdFace bdFace;
typedef struct bdLoop bdLoop;
typedef struct bdHalfEdge bdHalfEdge;
typedef struct bdVertex bdVertex;
typedef struct bdEdge bdEdge;
typedef union bdNode bdNode;
#define SOLID 0
#define FACE 1
#define LOOP 2
#define HALFEDGE 3
#define EDGE 4
#define VERTEX 5
struct bdSolid {
Id solidno;
bdFace* sfaces;
bdEdge* sedges;
bdVertex* sverts;
bdSolid* nexts;
bdSolid* prevs;
};
struct bdFace {
Id faceno;
bdSolid* fsolid;
bdLoop* flout;
bdLoop* floops;
bdVector feq;
bdFace* nextf;
bdFace* prevf;
};
struct bdLoop {
bdHalfEdge* ledg;
bdFace* lface;
bdLoop* nextl;
bdLoop* prevl;
};
struct bdEdge {
bdHalfEdge* he1;
bdHalfEdge* he2;
bdEdge* nexte;
bdEdge* preve;
};
struct bdHalfEdge {
bdEdge* edg;
bdVertex* vtx;
bdLoop* wloop;
bdHalfEdge* nxt;
bdHalfEdge* prv;
};
struct bdVertex {
Id vertexno;
bdHalfEdge* vedge;
bdVector vcoord;
bdVertex* nextv;
bdVertex* prevv;
};
union bdNode {
bdSolid s;
bdFace f;
bdLoop l;
bdHalfEdge h;
bdVertex v;
bdEdge e;
};
bdNode* CreateNode(int what, bdNode* where);
void DeleteNode(int what, bdNode* which, bdNode* where);
void Append(int what, bdNode* which, bdNode* where);
void Remove(int what, bdNode* which, bdNode* where);
bdHalfEdge* AppendHalfEdge(bdEdge* e, bdVertex* v, bdHalfEdge* where, int sign);
bdHalfEdge* RemoveHalfEdge(bdHalfEdge* he);
extern bdSolid* firsts;
extern Id maxs;
extern Id maxf;
extern Id maxv;
extern double EPS;
extern double BIGEPS;