-
Notifications
You must be signed in to change notification settings - Fork 0
/
templates.js
265 lines (197 loc) · 12 KB
/
templates.js
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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
// Case 1: The satellite is correctly oriented - the upper half of the image is the sky, the lower half is the Earth.
// Should return that the satellite is correctly oriented and does not need to be rotated.
// prettier-ignore
const correctlyOrientedTemplate = [
// --- Upper half - sky should be here ---
-40,-40,-40,-40, -40,-40,-40,-40, -40,-40,-40,-40, -40,-40,-40,-40,
-40,-40,-40,-40, -40,-40,-40,-40, -40,-40,-40,-40, -40,-40,-40,-40,
-40,-40,-40,-40, -40,-40,-40,-40, -40,-40,-40,-40, -40,-40,-40,-40,
-40,-40,-40,-40, -40,-40,-40,-40, -40,-40,-40,-40, -40,-40,-40,-40,
-40,-40,-40,-40, -40,-40,-40,-40, -40,-40,-40,-40, -40,-40,-40,-40,
-40,-40,-40,-40, -40,-40,-40,-40, -40,-40,-40,-40, -40,-40,-40,-40,
// --- Lower half - Earth should be here ---
10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
];
// Case 2: The satellite is slightly rotated in the axis perpendicular to the camera direction. The upper half of the image shows the sky AND Earth, and the lower half shows Earth.
// Should return that the satellite is slightly rotated in the perpendicular axis, but not in the parallel axis.
// prettier-ignore
const tiltedPerpendicularTemplate = [
// --- Upper half ---
-40,-40,-40,-40, -40,-40,-40,-40, -40,-40,-40,-40, -40,-40,-40,-40,
-40,-40,-40,-40, -40,-40,-40,-40, -40,-40,-40,-40, -40,-40,-40,-40,
-40,-40,-40,-40, -40,-40,-40,-40, -40,-40,-40,-40, -40,-40,-40,-40,
-40,-40,-40,-40, -40,-40,-40,-40, -40,-40,-40,-40, -40,-40,-40,-40,
10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
// --- Lower half ---
10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
];
// Case 3: The satellite is rotated in the axis parallel to the camera direction. The image is tilted by 45 degrees.
// As the image is tilted clockwise, the satellite is tilted in the counter-clockwise direction from the camera's perspective.
// Should return that the satellite is rotated in the parallel axis, but not in the perpendicular axis.
// prettier-ignore
const tiltedParallelAxisTemplate = [
// --- Upper half ---
10, -40,-40,-40, -40,-40,-40,-40, -40,-40,-40,-40, -40,-40,-40,-40,
10, 10, -40,-40, -40,-40,-40,-40, -40,-40,-40,-40, -40,-40,-40,-40,
10, 10, 10, -40, -40,-40,-40,-40, -40,-40,-40,-40, -40,-40,-40,-40,
10, 10, 10, 10, -40,-40,-40,-40, -40,-40,-40,-40, -40,-40,-40,-40,
10, 10, 10, 10, 10, -40,-40,-40, -40,-40,-40,-40, -40,-40,-40,-40,
10, 10, 10, 10, 10, 10, -40,-40, -40,-40,-40,-40, -40,-40,-40,-40,
// --- Lower half ---
10, 10, 10, 10, 10, 10, 10, 10, 10, 10,-40,-40, -40,-40,-40,-40,
10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,-40, -40,-40,-40,-40,
10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, -40,-40,-40,-40,
10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,-40,-40,-40,
10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,-40,-40,
10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,-40
];
// Case 4: The satellite is rotated in both axes. The image partly shows the sky in the upper right corner.
// As the image is tilted clockwise, the satellite is tilted in the counter-clockwise direction from the camera's perspective.
// Should return that the satellite is rotated in both axes.
// prettier-ignore
const tiltedBothAxesTemplate = [
// --- Upper half ---
10, 10, 10, 10, 10, 10, 10, 10, 10, 10,-40,-40, -40,-40,-40,-40,
10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,-40, -40,-40,-40,-40,
10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, -40,-40,-40,-40,
10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,-40,-40,-40,
10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,-40,-40,
10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,-40,
// --- Lower half ---
10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
];
// Case 5: The satellite is rotated in the axis perpendicular to the camera direction. The upper half of the image shows the sky, and the lower half shows Earth and sky.
// Should return that the satellite is slightly rotated in the perpendicular axis, but not in the parallel axis, and should return negative value for the rotation in the perpendicular axis.
// prettier-ignore
const tiltedPerpendicularAxisReverseTemplate = [
// --- Upper half ---
-40,-40,-40,-40, -40,-40,-40,-40, -40,-40,-40,-40, -40,-40,-40,-40,
-40,-40,-40,-40, -40,-40,-40,-40, -40,-40,-40,-40, -40,-40,-40,-40,
-40,-40,-40,-40, -40,-40,-40,-40, -40,-40,-40,-40, -40,-40,-40,-40,
-40,-40,-40,-40, -40,-40,-40,-40, -40,-40,-40,-40, -40,-40,-40,-40,
-40,-40,-40,-40, -40,-40,-40,-40, -40,-40,-40,-40, -40,-40,-40,-40,
-40,-40,-40,-40, -40,-40,-40,-40, -40,-40,-40,-40, -40,-40,-40,-40,
// --- Lower half ---
-40,-40,-40,-40, -40,-40,-40,-40, -40,-40,-40,-40, -40,-40,-40,-40,
-40,-40,-40,-40, -40,-40,-40,-40, -40,-40,-40,-40, -40,-40,-40,-40,
10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
];
// Case 6: similar to case 4, but the sky is visible in the upper left corner instead.
// Should return that the satellite is rotated in both axes, but the parallel axis rotation should be negative.
// prettier-ignore
const tiltedBothAxesReverseTemplate = [
// --- Upper half ---
-40,-40,-40,-40, -40,-40,10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
-40,-40,-40,-40, -40,10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
-40,-40,-40,-40, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
-40,-40,-40, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
-40,-40,10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
-40,10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
// --- Lower half ---
10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
];
// Case 7: the Earth is visible only in the lower right corner, rest is sky
// Should return that the satellite is rotated in both axes, but the perpendicular axis rotation should be negative.
// prettier-ignore
const tiltedBothAxesMostlySkyTemplate = [
-40,-40,-40,-40, -40,-40,-40,-40, -40,-40,-40,-40, -40,-40,-40,-40,
-40,-40,-40,-40, -40,-40,-40,-40, -40,-40,-40,-40, -40,-40,-40,-40,
-40,-40,-40,-40, -40,-40,-40,-40, -40,-40,-40,-40, -40,-40,-40,-40,
-40,-40,-40,-40, -40,-40,-40,-40, -40,-40,-40,-40, -40,-40,-40,-40,
-40,-40,-40,-40, -40,-40,-40,-40, -40,-40,-40,-40, -40,-40,-40,-40,
-40,-40,-40,-40, -40,-40,-40,-40, -40,-40,-40,-40, -40,-40,-40,-40,
-40,-40,-40,-40, -40,-40,-40,-40, -40,-40,-40,-40, -40,-40,-40,-40,
-40,-40,-40,-40, -40,-40,-40,-40, -40,-40,-40,-40, -40,-40,-40,-40,
-40,-40,-40,-40, -40,-40,-40,-40, -40,-40,-40,-40, -40,-40,-40, 10,
-40,-40,-40,-40, -40,-40,-40,-40, -40,-40,-40,-40, -40,-40, 10, 10,
-40,-40,-40,-40, -40,-40,-40,-40, -40,-40,-40,-40, -40, 10, 10, 10,
-40,-40,-40,-40, -40,-40,-40,-40, -40,-40,-40,-40, 10, 10, 10, 10,
];
// Case 8 (degenerate): only sky is visible.
// Should return that the satellite needs to be rotated in the perpendicular axis, but it's unknown how much it should be rotated in the parallel axis, and the rotation direction should be negative.
// prettier-ignore
const onlySkyTemplate = [
-40,-40,-40,-40, -40,-40,-40,-40, -40,-40,-40,-40, -40,-40,-40,-40,
-40,-40,-40,-40, -40,-40,-40,-40, -40,-40,-40,-40, -40,-40,-40,-40,
-40,-40,-40,-40, -40,-40,-40,-40, -40,-40,-40,-40, -40,-40,-40,-40,
-40,-40,-40,-40, -40,-40,-40,-40, -40,-40,-40,-40, -40,-40,-40,-40,
-40,-40,-40,-40, -40,-40,-40,-40, -40,-40,-40,-40, -40,-40,-40,-40,
-40,-40,-40,-40, -40,-40,-40,-40, -40,-40,-40,-40, -40,-40,-40,-40,
-40,-40,-40,-40, -40,-40,-40,-40, -40,-40,-40,-40, -40,-40,-40,-40,
-40,-40,-40,-40, -40,-40,-40,-40, -40,-40,-40,-40, -40,-40,-40,-40,
-40,-40,-40,-40, -40,-40,-40,-40, -40,-40,-40,-40, -40,-40,-40,-40,
-40,-40,-40,-40, -40,-40,-40,-40, -40,-40,-40,-40, -40,-40,-40,-40,
-40,-40,-40,-40, -40,-40,-40,-40, -40,-40,-40,-40, -40,-40,-40,-40,
-40,-40,-40,-40, -40,-40,-40,-40, -40,-40,-40,-40, -40,-40,-40,-40,
];
// Case 9 (degenerate): only Earth is visible.
// Should return that the satellite needs to be rotated in the perpendicular axis, but it's unknown how much it should be rotated in the parallel axis, and the rotation direction should be positive.
// prettier-ignore
const onlyEarthTemplate = [
10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
];
// Case 9 (edge case): the Earth is visible in the upper half of the image, and the sky is visible in the lower half. The satellite is upside down relative to its correct orientation.
// prettier-ignore
const upsideDownTemplate = [
// --- Upper half ---
10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
// --- Lower half ---
-40,-40,-40,-40, -40,-40,-40,-40, -40,-40,-40,-40, -40,-40,-40,-40,
-40,-40,-40,-40, -40,-40,-40,-40, -40,-40,-40,-40, -40,-40,-40,-40,
-40,-40,-40,-40, -40,-40,-40,-40, -40,-40,-40,-40, -40,-40,-40,-40,
-40,-40,-40,-40, -40,-40,-40,-40, -40,-40,-40,-40, -40,-40,-40,-40,
-40,-40,-40,-40, -40,-40,-40,-40, -40,-40,-40,-40, -40,-40,-40,-40,
-40,-40,-40,-40, -40,-40,-40,-40, -40,-40,-40,-40, -40,-40,-40,-40,
];
module.exports = {
correctlyOrientedTemplate,
tiltedPerpendicularTemplate,
tiltedParallelAxisTemplate,
tiltedBothAxesTemplate,
tiltedPerpendicularAxisReverseTemplate,
tiltedBothAxesReverseTemplate,
tiltedBothAxesMostlySkyTemplate,
onlySkyTemplate,
onlyEarthTemplate,
upsideDownTemplate,
};