Debian Codegraph @

Nasal/earthview.nas

raw
1 ###########################################################
2 # Earthview orbital rendering
3 ###########################################################
4
5
6 var lightning_table = [];
7
8 var entry = [2.85, 30.28, 0.35, 0.045];
9 append(lightning_table, entry);
10
11 entry = [9.3,8.0,0.1, 0.105];
12 append(lightning_table, entry);
13
14 entry = [6.0, -72.0, 0.2, 0.09];
15 append(lightning_table, entry);
16
17 entry = [30.89, -112.0, 0.72, 0.34];
18 append(lightning_table, entry);
19
20
21 var check_lightning_table = func (lat, lon) {
22
23 for (var i=0; i< size(lightning_table); i=i+1)
24 {
25 if (math.abs(lat - lightning_table[i][0]) < 15.0)
26 {
27 if (math.abs(lon - lightning_table[i][1]) < 15.0)
28 {
29 return i;
30 }
31 }
32 }
33 return -1;
34
35 }
36
37
38 var start = func() {
39
40 if (earthview_running_flag ==1) {return;}
41
42 earthview_running_flag = 1;
43
44 var lat = getprop("/position/latitude-deg");
45 var lon = getprop("/position/longitude-deg");
46
47
48
49
50 # the coordinates of the 7 tiles' junction points, from North to South
51 # and West to East on the geo sphere.
52 geojunctions[0] = geo.Coord.new();
53 geojunctions[0].set_latlon(90.0, 0.0);
54 geojunctions[1] = geo.Coord.new();
55 geojunctions[1].set_latlon(0.0, -180.0);
56 geojunctions[2] = geo.Coord.new();
57 geojunctions[2].set_latlon(0.0, -90.0);
58 geojunctions[3] = geo.Coord.new();
59 geojunctions[3].set_latlon(0.0, 0.0);
60 geojunctions[4] = geo.Coord.new();
61 geojunctions[4].set_latlon(0.0, 90.0);
62 geojunctions[5] = geo.Coord.new();
63 geojunctions[5].set_latlon(0.0, 180.0);
64 geojunctions[6] = geo.Coord.new();
65 geojunctions[6].set_latlon(-90.0, 0.0);
66
67
68 # tiles are uniquely defined by 3 junction points and we store their
69 # index. We also store the 3 corresponding indices of junction arcs as
70 # well as the name of the associated neighbouring tiles
71 ################################ <--- 0 identified
72 ## # # # ##
73 ## N1 # N2 # N3 # N4 ##
74 ## # # # ##
75 # 1 ### 2 #### 3 #### 4 #### 5 #
76 ## # # # ##
77 ## S1 # S2 # S3 # S4 ##
78 ## # # # ##
79 ################################ <--- 6 identified
80
81
82 tiling[0] = atile.new("N1",[0,1,2],["N3","S4","S2"],[[0,1],[1,2],[2,0]],["N4","S1","N2"]);
83 tiling[1] = atile.new("N2",[0,2,3],["N4","S1","S3"],[[0,2],[2,3],[3,0]],["N1","S2","N3"]);
84 tiling[2] = atile.new("N3",[0,3,4],["N1","S2","S4"],[[0,3],[3,4],[4,0]],["N2","S3","N4"]);
85 tiling[3] = atile.new("N4",[0,4,5],["N2","S3","S1"],[[0,4],[4,5],[5,0]],["N3","S4","N1"]);
86 tiling[4] = atile.new("S1",[1,2,6],["N4","N2","S3"],[[1,2],[2,6],[6,1]],["N1","S2","S4"]);
87 tiling[5] = atile.new("S2",[2,3,6],["N1","N3","S4"],[[2,3],[3,6],[6,2]],["N2","S3","S1"]);
88 tiling[6] = atile.new("S3",[3,4,6],["N2","N4","S1"],[[3,4],[4,6],[6,3]],["N3","S4","S2"]);
89 tiling[7] = atile.new("S4",[4,5,6],["N3","N1","S2"],[[4,5],[5,6],[6,4]],["N4","S1","S3"]);
90
91 tiling_visibility = {"N1":0,"N2":0,"N3":0,"N4":0,"S1":0,"S2":0,"S3":0,"S4":0};
92
93 # determine which tiles to show
94
95 setprop("/earthview/show-n1", 0);
96 setprop("/earthview/show-n2", 0);
97 setprop("/earthview/show-n3", 0);
98 setprop("/earthview/show-n4", 0);
99
100 setprop("/earthview/show-s1", 0);
101 setprop("/earthview/show-s2", 0);
102 setprop("/earthview/show-s3", 0);
103 setprop("/earthview/show-s4", 0);
104
105
106 aurora_model.node = earthview.place_earth_model("Models/Astro/aurora.xml",lat, lon, 0.0, 0.0, 0.0, 0.0);
107
108 # set Basic Weather off
109 props.globals.getNode("/environment/config/enabled").setBoolValue(0);
110 props.globals.getNode("/environment/params/metar-updates-environment").setBoolValue(0);
111
112
113
114 # set some reasonable defaults
115
116 setprop("/environment/visibility-m", 80000.0);
117 setprop("/sim/rendering/mie", 0.0);
118 setprop("/sim/rendering/rayleigh", 0.00002);
119 setprop("/sim/rendering/dome-density", 1.0);
120 setprop("/earthview/shade-effect", 0.5);
121
122 earth_model.l1 = setlistener("/earthview/show-n1", func(n) {load_sector (1, n);},0,0);
123 earth_model.l2 = setlistener("/earthview/show-n2", func(n) {load_sector (2, n);},0,0);
124 earth_model.l3 = setlistener("/earthview/show-n3", func(n) {load_sector (3, n);},0,0);
125 earth_model.l4 = setlistener("/earthview/show-n4", func(n) {load_sector (4, n);},0,0);
126 earth_model.l5 = setlistener("/earthview/show-s1", func(n) {load_sector (5, n);},0,0);
127 earth_model.l6 = setlistener("/earthview/show-s2", func(n) {load_sector (6, n);},0,0);
128 earth_model.l7 = setlistener("/earthview/show-s3", func(n) {load_sector (7, n);},0,0);
129 earth_model.l8 = setlistener("/earthview/show-s4", func(n) {load_sector (8, n);},0,0);
130
131
132 control_loop();
133
134 slow_loop();
135
136 }
137
138 var stop = func () {
139
140 #earth_model.node.remove();
141 #cloudsphere_model.node.remove();
142 aurora_model.node.remove();
143 setprop("/earthview/control_loop_flag",0);
144
145 # unload tiles not loaded via listeners
146
147 if (cloudsphere_rotated_flag == 1)
148 {clear_cloud_tiles();}
149
150 # unlock rotation flag to allow downloading of distance-managed tiles
151 cloudsphere_rotated_flag = 0;
152 setprop("/earthview/cloudsphere-angle",0.0);
153
154 setprop("/earthview/show-n1", 0);
155 setprop("/earthview/show-n2", 0);
156 setprop("/earthview/show-n3", 0);
157 setprop("/earthview/show-n4", 0);
158
159 setprop("/earthview/show-s1", 0);
160 setprop("/earthview/show-s2", 0);
161 setprop("/earthview/show-s3", 0);
162 setprop("/earthview/show-s4", 0);
163
164 settimer( func {
165 removelistener(earth_model.l1);
166 removelistener(earth_model.l2);
167 removelistener(earth_model.l3);
168 removelistener(earth_model.l4);
169 removelistener(earth_model.l5);
170 removelistener(earth_model.l6);
171 removelistener(earth_model.l7);
172 removelistener(earth_model.l8);
173 }, 1.0);
174
175
176
177 earthview_running_flag = 0;
178 }
179
180 var place_earth_model = func(path, lat, lon, alt, heading, pitch, roll) {
181
182
183
184 var m = props.globals.getNode("models", 1);
185 for (var i = 0; 1; i += 1)
186 if (m.getChild("model", i, 0) == nil)
187 break;
188 var model = m.getChild("model", i, 1);
189
190 var R1 = 5800000.0;
191 var R2 = 58000.0;
192
193 var altitude1 = getprop("/position/altitude-ft");
194 var altitude2 = R2/R1 * altitude1;
195 var model_alt = altitude1 - altitude2 - R2 * m_to_ft;
196
197 setprop("/earthview/latitude-deg", lat);
198 setprop("/earthview/longitude-deg", lon);
199 setprop("/earthview/elevation-ft", model_alt);
200 setprop("/earthview/heading-deg", heading);
201 setprop("/earthview/pitch-deg", pitch);
202 setprop("/earthview/roll-deg", roll);
203 setprop("/earthview/yaw-deg", 0.0);
204
205 var eview = props.globals.getNode("earthview", 1);
206 var latN = eview.getNode("latitude-deg",1);
207 var lonN = eview.getNode("longitude-deg",1);
208 var altN = eview.getNode("elevation-ft",1);
209 var headN = eview.getNode("heading-deg",1);
210 var pitchN = eview.getNode("pitch-deg",1);
211 var rollN = eview.getNode("roll-deg",1);
212
213
214
215 model.getNode("path", 1).setValue(path);
216 model.getNode("latitude-deg-prop", 1).setValue(latN.getPath());
217 model.getNode("longitude-deg-prop", 1).setValue(lonN.getPath());
218 model.getNode("elevation-ft-prop", 1).setValue(altN.getPath());
219 model.getNode("heading-deg-prop", 1).setValue(headN.getPath());
220 model.getNode("pitch-deg-prop", 1).setValue(pitchN.getPath());
221 model.getNode("roll-deg-prop", 1).setValue(rollN.getPath());
222 model.getNode("load", 1).remove();
223
224 setprop("/earthview/heading-deg",90);
225 setprop("/earthview/control_loop_flag",1);
226
227
228
229 return model;
230 }
231
232
233 var control_loop = func {
234
235 if (earthview_running_flag == 0) {return;}
236
237 var R1 = 5800000.0;
238 var R2 = 58000.0;
239
240 var altitude1 = getprop("/position/altitude-ft");
241 var altitude2 = R2/R1 * altitude1;
242 var model_alt = altitude1 - altitude2 - R2 * m_to_ft;
243
244 #var horizon = math.sqrt(2.0 * R1 * altitude1 * ft_to_m );
245 #if (horizon > 5000000.0) {horizon = 5000000.0;}
246
247 #horizon on the R1-ball for an altitude given by the real one
248 var horizon = 0.0;
249 if (altitude1 >= 0.0)
250 {
251 horizon = R1*math.acos(1.0/(1.0+altitude1*ft_to_m/R1));
252 }
253
254
255 setprop("/earthview/horizon-km", horizon/1000.0);
256
257 setprop("/earthview/elevation-ft", model_alt);
258
259 var lat = getprop("/position/latitude-deg");
260 var lon = getprop("/position/longitude-deg");
261
262 setprop("/earthview/latitude-deg", lat);
263 setprop("/earthview/longitude-deg", lon);
264
265 setprop("/earthview/roll-deg", -(90-lat));
266 setprop("/earthview/yaw-deg", -lon);
267
268
269 if (getprop("/earthview/show-force-all") == 1)
270 {
271
272 tiling_visibility = {"N1":1,"N2":1,"N3":1,"N4":1,"S1":1,"S2":1,"S3":1,"S4":1};
273
274 }
275 else
276 {
277
278 var shuttle_pos = geo.aircraft_position();
279
280
281 #horizon (in m) over the geo earth (for tests)
282 var geohorizon = shuttle_pos.horizon();
283
284 #fold back the distorsion induced by R2/ERAD != altitude2/altitude1 on
285 #the geo sphere.
286 var distorted_geohorizon = geo.ERAD*horizon/R1;
287
288 # over which tile are we?
289 var tile_index = math.floor((180.0+geo.normdeg180(shuttle_pos.lon()))/90.0);
290 if (shuttle_pos.lat() < 0.0)
291 {
292 tile_index += 4;
293 }
294
295
296 #print("lon= lat= ",shuttle_pos.lon()," ",shuttle_pos.lat());
297 #print("horizon= geohorizon= distorted_geohorizon= ",horizon/1000.0," ",geohorizon/1000.0," "
298 # ,distorted_geohorizon/1000.0);
299 #print("current tile_index= ",tile_index);
300 #print("tile name is ",tiling[tile_index].name);
301
302 tiling_visibility[tiling[tile_index].name] = 1;
303
304 # which neighbouring tiles are visible
305 # loops over junctions, i.e. arcs and points
306 for (var i=0; i < 3; i = i+1) {
307
308 var ia = tiling[tile_index].arcs.index[i][0];
309 var ib = tiling[tile_index].arcs.index[i][1];
310
311 # print("ti i= ",tile_index," ",i);
312 # print("ia= ib= ",ia," ",ib);
313 # print("line names= ",tiling[tile_index].arcs.names[i]);
314 # print("dist to arc= ",shuttle_pos.greatcircle_distance_to(geojunctions[ia],geojunctions[ib])/1000.0);
315
316 if (shuttle_pos.greatcircle_distance_to(geojunctions[ia],geojunctions[ib]) > distorted_geohorizon)
317 {
318 tiling_visibility[tiling[tile_index].arcs.names[i]] = 0;
319 }
320 else
321 {
322 tiling_visibility[tiling[tile_index].arcs.names[i]] = 1;
323 }
324
325
326 var ic = tiling[tile_index].points.index[i];
327
328 # print("ic= ",ic);
329 # print("point names= ",tiling[tile_index].points.names[i]);
330 # print("distance to point= ",shuttle_pos.distance_to(geojunctions[ic])/1000.0);
331 # print(" ");
332
333 if (shuttle_pos.distance_to(geojunctions[ic]) > distorted_geohorizon)
334 {
335 tiling_visibility[tiling[tile_index].points.names[i]] = 0;
336 }
337 else
338 {
339 tiling_visibility[tiling[tile_index].points.names[i]] = 1;
340 }
341 }
342
343 }
344
345
346 #print("N1 ",tiling_visibility["N1"]);
347 #print("N2 ",tiling_visibility["N2"]);
348 #print("N3 ",tiling_visibility["N3"]);
349 #print("N4 ",tiling_visibility["N4"]);
350 #print("S1 ",tiling_visibility["S1"]);
351 #print("S2 ",tiling_visibility["S2"]);
352 #print("S3 ",tiling_visibility["S3"]);
353 #print("S4 ",tiling_visibility["S4"]);
354
355
356 setprop("/earthview/show-n1",tiling_visibility["N1"]);
357 setprop("/earthview/show-n2",tiling_visibility["N2"]);
358 setprop("/earthview/show-n3",tiling_visibility["N3"]);
359 setprop("/earthview/show-n4",tiling_visibility["N4"]);
360 setprop("/earthview/show-s1",tiling_visibility["S1"]);
361 setprop("/earthview/show-s2",tiling_visibility["S2"]);
362 setprop("/earthview/show-s3",tiling_visibility["S3"]);
363 setprop("/earthview/show-s4",tiling_visibility["S4"]);
364
365
366 # now set scattering paramaters
367
368 if (getprop("/earthview/mrd-flag") == 1)
369 {
370 var rayleigh = 0.0002;
371 var mie = 0.001;
372 var density = 1.0;
373
374 if (altitude1 < 300000.0)
375 {
376 setprop("/sim/rendering/rayleigh",rayleigh);
377 setprop("/sim/rendering/mie",mie);
378 setprop("/sim/rendering/dome-density",density);
379 }
380 else if (altitude1 < 650000.0)
381 {
382 rayleigh = rayleigh - 0.00018 * (altitude1-300000.0)/350000.0;
383 mie = mie - 0.001 * (altitude1-300000.0)/350000.0;
384 density = 1.0;
385 setprop("/sim/rendering/rayleigh",rayleigh);
386 setprop("/sim/rendering/mie",mie);
387 setprop("/sim/rendering/dome-density",density);
388 }
389 else
390 {
391 rayleigh = 0.00002;
392 mie = 0.0;
393 density = 1.0;
394 setprop("/sim/rendering/rayleigh",rayleigh);
395 setprop("/sim/rendering/mie",mie);
396 setprop("/sim/rendering/dome-density",density);
397 }
398
399 }
400
401
402 if (getprop("/earthview/control_loop_flag") ==1) {settimer( func {control_loop(); },0);}
403 }
404
405
406 var slow_loop = func {
407
408 if (earthview_running_flag == 0) {return;}
409
410 # thunderstorms
411
412 var lat = getprop("/position/latitude-deg");
413 var lon = getprop("/position/longitude-deg") + getprop("/earthview/cloudsphere-angle");
414
415
416 var index = check_lightning_table(lat, lon);
417
418 if (index > -1)
419 {
420
421
422 rn = rand();
423
424 if (rn < 0.3)
425 {
426 var roi_x_base = lightning_table[index][2];
427 var roi_y_base = lightning_table[index][3];
428
429 var rn = 0.005 * (2.0 * rand() - 0.5);
430 setprop("/earthview/roi-x1", roi_x_base + rn);
431
432 rn = 0.005 * (2.0 * rand() - 0.5);
433 setprop("/earthview/roi-y1", roi_y_base + rn);
434
435
436 lightning_strike();
437
438 }
439 }
440
441 if (getprop("/earthview/control_loop_flag") ==1) {settimer( func {slow_loop(); },1.0);}
442 }
443
444
445
446 var lightning_strike = func {
447
448 var rn = rand();
449
450 var repeat = 1;
451
452 if (rn > 0.5) {repeat = 2;}
453
454 var duration = 0.1 + 0.1 * rand();
455 var strength = 0.5 + 1.0 * rand();
456
457 setprop("/earthview/lightning", strength);
458 settimer( func{ setprop("/earthview/lightning", 0.0);}, duration);
459
460 var duration1 = 0.1 + 0.1 * rand();
461
462 if (repeat == 2)
463 {
464 settimer( func{ setprop("/earthview/lightning", strength);}, duration + 0.1);
465 settimer( func{ setprop("/earthview/lightning", 0.0);}, duration + 0.1 + duration1);
466 }
467
468 }
469
470
471 # rotate position of cloud tiles
472
473 var adjust_cloud_tiles = func {
474
475 # we need to load all cloud tiles if we want to rotate the cloudsphere
476
477 if (getprop("/earthview/cloudsphere-angle") > 0.0)
478 {
479 if (cloudsphere_rotated_flag == 0)
480 {
481 var lat = getprop("/position/latitude-deg");
482 var lon = getprop("/position/longitude-deg");
483
484 if (getprop("/earthview/show-n1") == 0)
485 {cloudsphere_model.node1 = place_earth_model("Models/Astro/clouds_N1.xml",lat, lon, 0.0, 0.0, 0.0, 0.0);}
486 if (getprop("/earthview/show-n2") == 0)
487 {cloudsphere_model.node2 = place_earth_model("Models/Astro/clouds_N2.xml",lat, lon, 0.0, 0.0, 0.0, 0.0);}
488 if (getprop("/earthview/show-n3") == 0)
489 {cloudsphere_model.node3 = place_earth_model("Models/Astro/clouds_N3.xml",lat, lon, 0.0, 0.0, 0.0, 0.0);}
490 if (getprop("/earthview/show-n4") == 0)
491 {cloudsphere_model.node4 = place_earth_model("Models/Astro/clouds_N4.xml",lat, lon, 0.0, 0.0, 0.0, 0.0);}
492 if (getprop("/earthview/show-s1") == 0)
493 {cloudsphere_model.node5 = place_earth_model("Models/Astro/clouds_S1.xml",lat, lon, 0.0, 0.0, 0.0, 0.0);}
494 if (getprop("/earthview/show-s2") == 0)
495 {cloudsphere_model.node6 = place_earth_model("Models/Astro/clouds_S2.xml",lat, lon, 0.0, 0.0, 0.0, 0.0);}
496 if (getprop("/earthview/show-s3") == 0)
497 {cloudsphere_model.node7 = place_earth_model("Models/Astro/clouds_S3.xml",lat, lon, 0.0, 0.0, 0.0, 0.0);}
498 if (getprop("/earthview/show-s4") == 0)
499 {cloudsphere_model.node8 = place_earth_model("Models/Astro/clouds_S4.xml",lat, lon, 0.0, 0.0, 0.0, 0.0);}
500
501 cloudsphere_rotated_flag = 1;
502 }
503 }
504 else
505 {
506 clear_cloud_tiles();
507 cloudsphere_rotated_flag = 0;
508 }
509
510 }
511
512
513 var clear_cloud_tiles = func {
514
515
516 if (getprop("/earthview/show-n1") == 0)
517 {cloudsphere_model.node1.remove();}
518
519 if (getprop("/earthview/show-n2") == 0)
520 {cloudsphere_model.node2.remove();}
521
522 if (getprop("/earthview/show-n3") == 0)
523 {cloudsphere_model.node3.remove();}
524
525 if (getprop("/earthview/show-n4") == 0)
526 {cloudsphere_model.node4.remove();}
527
528 if (getprop("/earthview/show-s1") == 0)
529 {cloudsphere_model.node5.remove();}
530
531 if (getprop("/earthview/show-s2") == 0)
532 {cloudsphere_model.node6.remove();}
533
534 if (getprop("/earthview/show-s3") == 0)
535 {cloudsphere_model.node7.remove();}
536
537 if (getprop("/earthview/show-s4") == 0)
538 {cloudsphere_model.node8.remove();}
539
540 }
541
542 # load of individual tile
543
544 var load_sector = func (i, n) {
545
546 var action = n.getValue();
547
548 if (action)
549 {
550 var lat = getprop("/position/latitude-deg");
551 var lon = getprop("/position/longitude-deg");
552
553 if (i==1)
554 {
555 earth_model.node1 = place_earth_model("Models/Astro/earth_N1.xml",lat, lon, 0.0, 0.0, 0.0, 0.0);
556 if (cloudsphere_rotated_flag == 0)
557 {cloudsphere_model.node1 = place_earth_model("Models/Astro/clouds_N1.xml",lat, lon, 0.0, 0.0, 0.0, 0.0);}
558 }
559 else if (i==2)
560 {
561 earth_model.node2 = place_earth_model("Models/Astro/earth_N2.xml",lat, lon, 0.0, 0.0, 0.0, 0.0);
562 if (cloudsphere_rotated_flag == 0)
563 {cloudsphere_model.node2 = place_earth_model("Models/Astro/clouds_N2.xml",lat, lon, 0.0, 0.0, 0.0, 0.0);}
564 }
565 else if (i==3)
566 {
567 earth_model.node3 = place_earth_model("Models/Astro/earth_N3.xml",lat, lon, 0.0, 0.0, 0.0, 0.0);
568 if (cloudsphere_rotated_flag == 0)
569 {cloudsphere_model.node3 = place_earth_model("Models/Astro/clouds_N3.xml",lat, lon, 0.0, 0.0, 0.0, 0.0);}
570 }
571 else if (i==4)
572 {
573 earth_model.node4 = place_earth_model("Models/Astro/earth_N4.xml",lat, lon, 0.0, 0.0, 0.0, 0.0);
574 if (cloudsphere_rotated_flag == 0)
575 {cloudsphere_model.node4 = place_earth_model("Models/Astro/clouds_N4.xml",lat, lon, 0.0, 0.0, 0.0, 0.0);}
576 }
577 else if (i==5)
578 {
579 earth_model.node5 = place_earth_model("Models/Astro/earth_S1.xml",lat, lon, 0.0, 0.0, 0.0, 0.0);
580 if (cloudsphere_rotated_flag == 0)
581 {cloudsphere_model.node5 = place_earth_model("Models/Astro/clouds_S1.xml",lat, lon, 0.0, 0.0, 0.0, 0.0);}
582 }
583 else if (i==6)
584 {
585 earth_model.node6 = place_earth_model("Models/Astro/earth_S2.xml",lat, lon, 0.0, 0.0, 0.0, 0.0);
586 if (cloudsphere_rotated_flag == 0)
587 {cloudsphere_model.node6 = place_earth_model("Models/Astro/clouds_S2.xml",lat, lon, 0.0, 0.0, 0.0, 0.0);}
588 }
589 else if (i==7)
590 {
591 earth_model.node7 = place_earth_model("Models/Astro/earth_S3.xml",lat, lon, 0.0, 0.0, 0.0, 0.0);
592 if (cloudsphere_rotated_flag == 0)
593 {cloudsphere_model.node7 = place_earth_model("Models/Astro/clouds_S3.xml",lat, lon, 0.0, 0.0, 0.0, 0.0);}
594 }
595 else if (i==8)
596 {
597 earth_model.node8 = place_earth_model("Models/Astro/earth_S4.xml",lat, lon, 0.0, 0.0, 0.0, 0.0);
598 if (cloudsphere_rotated_flag == 0)
599 {cloudsphere_model.node8 = place_earth_model("Models/Astro/clouds_S4.xml",lat, lon, 0.0, 0.0, 0.0, 0.0);}
600 }
601 }
602 else
603 {
604 if (i==1)
605 {
606 earth_model.node1.remove();
607 if (cloudsphere_rotated_flag == 0)
608 {cloudsphere_model.node1.remove();}
609 }
610 else if (i==2)
611 {
612 earth_model.node2.remove();
613 if (cloudsphere_rotated_flag == 0)
614 {cloudsphere_model.node2.remove();}
615 }
616 else if (i==3)
617 {
618 earth_model.node3.remove();
619 if (cloudsphere_rotated_flag == 0)
620 {cloudsphere_model.node3.remove();}
621 }
622 else if (i==4)
623 {
624 earth_model.node4.remove();
625 if (cloudsphere_rotated_flag == 0)
626 {cloudsphere_model.node4.remove();}
627 }
628 else if (i==5)
629 {
630 earth_model.node5.remove();
631 if (cloudsphere_rotated_flag == 0)
632 {cloudsphere_model.node5.remove();}
633 }
634 else if (i==6)
635 {
636 earth_model.node6.remove();
637 if (cloudsphere_rotated_flag == 0)
638 {cloudsphere_model.node6.remove();}
639 }
640 else if (i==7)
641 {
642 earth_model.node7.remove();
643 if (cloudsphere_rotated_flag == 0)
644 {cloudsphere_model.node7.remove();}
645 }
646 else if (i==8)
647 {
648 earth_model.node8.remove();
649 if (cloudsphere_rotated_flag == 0)
650 {cloudsphere_model.node8.remove();}
651 }
652 }
653
654 }
655
656
657
658
659
660
661
662
663 var ft_to_m = 0.30480;
664 var m_to_ft = 1.0/ft_to_m;
665 var earth_model = {};
666 var cloudsphere_model = {};
667 var aurora_model = {};
668 var earthview_running_flag = 0;
669 var cloudsphere_rotated_flag = 0;
670
671 var geojunctions = [];
672 setsize(geojunctions, 7);
673
674
675 var boundary = {
676 new: func(bindex, bname) {
677 var m = { parents: [ boundary ] };
678 m.index = bindex;
679 m.names = bname;
680 return m;
681 },
682 };
683
684 var atile = {
685 new: func(tname, ptind, ptname, arcind, arcname) {
686 var m = { parents: [ atile ] };
687 m.name = tname;
688 m.points = boundary.new(ptind, ptname);
689 m.arcs = boundary.new(arcind, arcname);
690 return m;
691 },
692 };
693
694
695 var tiling = [];
696 setsize(tiling, 8);
697
698 var tiling_visibility = {};
699
700