-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path3d3.c
97 lines (69 loc) · 2.36 KB
/
3d3.c
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
95
96
97
#include "mapping.h"
int main() {
/*
make sure mapping.h has the following:
#define DIM 3
#define NUMBITS 32
#define WORDBITS 32
make sure mapping.c has the following:
const U_int g_mask[] = {4, 2, 1};
*/
Point pt1, pt2;
int a,b,c;
for (a = 0; a < DIM; a )
for (b = 0; b < DIM; b )
for (c = 0; c < DIM; c )
{
pt1.hcode[0] = a;
pt1.hcode[1] = b;
pt1.hcode[2] = c;
printf("%d\t%d\t%d\n", pt1.hcode[0], pt1.hcode[1], pt1.hcode[2]);
pt2 = H_decode(H_encode(pt1));
printf("%d\t%d\t%d\n\n", pt2.hcode[0], pt2.hcode[1], pt2.hcode[2]);
}
return 0;
}
/*
....produces the following output....
0 0 0 (coordinates of the original point)
0 0 0 (coordinates of the original point, having been 'encoded' and 'decoded' again)
0 0 1
0 0 1
0 0 2
0 0 2
0 1 0
0 1 0
0 1 1
0 1 1
0 1 2
0 1 2
0 2 0
0 2 0
0 2 1
0 2 1
0 2 2
0 2 2
1 0 0
1 0 0
1 0 1
1 0 1
1 0 2
1 0 2
1 1 0
1 1 0
1 1 1
1 1 1
1 1 2
1 1 2
1 2 0
1 2 0
1 2 1
1 2 1
1 2 2
1 2 2
2 0 0
2 0 0
......
........
etc
*/