Orbiter 2022
Combinatorial Objects
animate.cpp
Go to the documentation of this file.
1/*
2 * animate.cpp
3 *
4 * Created on: Mar 13, 2019
5 * Author: betten
6 */
7
8
9
10#include "foundations.h"
11#include <math.h>
12
13
14using namespace std;
15
16
17namespace orbiter {
18namespace layer1_foundations {
19namespace graphics {
20
21
23{
25 S = NULL;
26 //output_mask;
27 fname_makefile[0] = 0;
28 nb_frames = 30;
29 Opt = NULL;
30 fpm = NULL;
32 extra_data = NULL;
33 Pov = NULL;
34}
35
37{
38
39
40}
41
43 povray_job_description *Povray_job_description,
44 void *extra_data,
45 int verbose_level)
46{
47 int f_v = (verbose_level >= 1);
48
49 if (f_v) {
50 cout << "animate::init" << endl;
51 }
52 if (Povray_job_description->S == NULL) {
53 cout << "animate::init S == NULL" << endl;
54 exit(1);
55 }
63 sprintf(fname_makefile, "makefile_animation");
64
65
66 if (f_v) {
67 cout << "animate::init done" << endl;
68 }
69}
70
71
73 int round,
74 int verbose_level)
75{
76 int f_v = (verbose_level >= 1);
77 numerics N;
78 int h, i, j;
79 int f_has_camera = FALSE;
80 double camera_sky[3];
81 double camera_location[3];
82 double camera_look_at[3];
83 int f_has_zoom = FALSE;
84 int zoom_start = 0;
85 int zoom_end = 0;
86 double zoom_clipping_start = 0.;
87 double zoom_clipping_end = 0.;
88 int f_has_zoom_sequence = FALSE;
89 double *zoom_sequence = NULL;
90 int zoom_sequence_length = 0;
91 double *zoom_sequence_value = NULL;
92 int *zoom_sequence_fst = NULL;
93 int *zoom_sequence_len = NULL;
94 int zoom_sequence_l = 0;
95 double angle = 0;
96 double clipping_radius = 0;
97 double zoom_increment = 0;
98 double zoom_clipping_increment = 0;
99 int nb_frames_this_round = 0;
100 int f_has_pan = FALSE;
101 int pan_f_reverse = FALSE;
102 double pan_from[3];
103 double pan_to[3];
104 double pan_center[3];
105 double pan_u[3];
106 double pan_v[3];
107 double pan_w[3];
108 double pan_z[3];
109 double pan_normal_uv[3];
110 double uu, suu = 0;
111 double uv;
112 double vv, svv = 0;
113 //double ww, sww;
114 double zz, szz = 0;
115 double pan_alpha = 0, pan_delta = 0;
116
117 if (f_v) {
118 cout << "animate::animate_one_round" << endl;
119 cout << "nb_frames=" << nb_frames << endl;
120 }
121 nb_frames_this_round = nb_frames;
122 for (i = 0; i < Opt->nb_camera; i++) {
123 if (Opt->camera_round[i] == round) {
124 f_has_camera = TRUE;
125 for (j = 0; j < 3; j++) {
126 camera_sky[j] = Opt->camera_sky[i * 3 + j];
127 camera_location[j] = Opt->camera_location[i * 3 + j];
128 camera_look_at[j] = Opt->camera_look_at[i * 3 + j];
129 }
130 }
131 }
132 for (i = 0; i < Opt->cnt_nb_frames; i++) {
133 if (Opt->nb_frames_round[i] == round) {
134 nb_frames_this_round = Opt->nb_frames_value[i];
135 }
136 }
137 for (i = 0; i < Opt->nb_zoom; i++) {
138 if (Opt->zoom_round[i] == round) {
139 f_has_zoom = TRUE;
140 zoom_start = Opt->zoom_start[i];
141 zoom_end = Opt->zoom_end[i];
142 zoom_clipping_start = Opt->zoom_clipping_start[i];
143 zoom_clipping_end = Opt->zoom_clipping_end[i];
144 zoom_increment = (double)(zoom_end - zoom_start) /
145 (double) nb_frames_this_round;
146 zoom_clipping_increment = (double)(zoom_clipping_end - zoom_clipping_start) /
147 (double) nb_frames_this_round;
148 }
149 }
150 for (i = 0; i < Opt->nb_zoom_sequence; i++) {
151 if (Opt->zoom_sequence_round[i] == round) {
152 f_has_zoom_sequence = TRUE;
154 zoom_sequence, zoom_sequence_length);
155 cout << "round " << round << " : zoom_sequence ";
156 N.vec_print(cout, zoom_sequence, zoom_sequence_length);
157 cout << endl;
158 if (EVEN(zoom_sequence_length)) {
159 cout << "zoom_sequence mast have odd length" << endl;
160 exit(1);
161 }
162 zoom_sequence_value = new double[zoom_sequence_length];
163 zoom_sequence_fst = NEW_int(zoom_sequence_length);
164 zoom_sequence_len = NEW_int(zoom_sequence_length);
165 zoom_sequence_l = zoom_sequence_length >> 1;
166 zoom_sequence_fst[0] = 0;
167 for (j = 0; j <= zoom_sequence_l; j++) {
168 zoom_sequence_value[j] = zoom_sequence[2 * j];
169 if (j < zoom_sequence_l) {
170 zoom_sequence_fst[j + 1] =
171 zoom_sequence_fst[j] +
172 (int) zoom_sequence[2 * j + 1];
173 zoom_sequence_len[j] =
174 zoom_sequence_fst[j + 1] -
175 zoom_sequence_fst[j];
176 }
177 }
178 cout << "zoom sequence: " << endl;
179 for (j = 0; j < zoom_sequence_l; j++) {
180 cout << zoom_sequence_fst[j] << " - "
181 << zoom_sequence_len[j] << " : "
182 << zoom_sequence_value[j] << endl;
183 }
184 cout << zoom_sequence_fst[zoom_sequence_l] << endl;
185 }
186 }
187 for (i = 0; i < Opt->nb_pan; i++) {
188 if (Opt->pan_round[i] == round) {
189 f_has_pan = TRUE;
190 pan_f_reverse = Opt->pan_f_reverse[i];
191 pan_from[0] = Opt->pan_from[i * 3 + 0];
192 pan_from[1] = Opt->pan_from[i * 3 + 1];
193 pan_from[2] = Opt->pan_from[i * 3 + 2];
194 pan_to[0] = Opt->pan_to[i * 3 + 0];
195 pan_to[1] = Opt->pan_to[i * 3 + 1];
196 pan_to[2] = Opt->pan_to[i * 3 + 2];
197 pan_center[0] = Opt->pan_center[i * 3 + 0];
198 pan_center[1] = Opt->pan_center[i * 3 + 1];
199 pan_center[2] = Opt->pan_center[i * 3 + 2];
200
201 cout << "pan_from: ";
202 N.vec_print(pan_from, 3);
203 cout << endl;
204 cout << "pan_to: ";
205 N.vec_print(pan_to, 3);
206 cout << endl;
207 cout << "pan_center: ";
208 N.vec_print(pan_center, 3);
209 cout << endl;
210 //zoom_increment = (double)(zoom_end - zoom_start) /
211 // (double) nb_frames_this_round;
212 pan_u[0] = pan_from[0] - pan_center[0];
213 pan_u[1] = pan_from[1] - pan_center[1];
214 pan_u[2] = pan_from[2] - pan_center[2];
215 pan_v[0] = pan_to[0] - pan_center[0];
216 pan_v[1] = pan_to[1] - pan_center[1];
217 pan_v[2] = pan_to[2] - pan_center[2];
218 cout << "pan_u: ";
219 N.vec_print(pan_u, 3);
220 cout << endl;
221 cout << "pan_v: ";
222 N.vec_print(pan_v, 3);
223 cout << endl;
224 uu = N.dot_product(pan_u, pan_u, 3);
225 uv = N.dot_product(pan_u, pan_v, 3);
226 vv = N.dot_product(pan_v, pan_v, 3);
227 suu = sqrt(uu);
228 svv = sqrt(vv);
229 if (ABS(vv) < 0.01) {
230 cout << "animate vector v is too short" << endl;
231 exit(1);
232 }
233 N.vec_linear_combination(1., pan_u,
234 -1 * uv / vv, pan_v, pan_w, 3);
235
236 cout << "pan_w: ";
237 N.vec_print(pan_w, 3);
238 cout << endl;
239
240
241
242 N.vec_scalar_multiple(pan_u, 1./suu, 3);
243 N.vec_scalar_multiple(pan_v, 1./svv, 3);
244
245
246#if 1
247 cout << "pan_u (normalized): ";
248 N.vec_print(pan_u, 3);
249 cout << endl;
250 cout << "pan_v (normalized): ";
251 N.vec_print(pan_v, 3);
252 cout << endl;
253 uu = N.dot_product(pan_u, pan_u, 3);
254 uv = N.dot_product(pan_u, pan_v, 3);
255 vv = N.dot_product(pan_v, pan_v, 3);
256#endif
257
258 pan_alpha = acos(uv /* / (suu * svv)*/);
259 cout << "pan_alpha=" << pan_alpha << " = "
260 << pan_alpha * 180. / M_PI << " deg" << endl;
261 pan_delta = pan_alpha / (double) (nb_frames_this_round - 1);
262 cout << "pan_delta=" << pan_delta << " = "
263 << pan_delta * 180. / M_PI << " deg" << endl;
264
265
266 N.cross_product(pan_u, pan_v, pan_normal_uv);
267
268 //ww = dot_product(pan_w, pan_w, 3);
269 //sww = sqrt(ww);
270 //double_vec_scalar_multiple(pan_w, 1./sww, 3);
271
272 double wv;
273
274 wv = N.dot_product(pan_w, pan_v, 3);
275 cout << "wv=" << wv << endl;
276 if (ABS(wv) > 0.01) {
277 cout << "error w is not orthogonal to v" << endl;
278 }
279
280
281 N.vec_linear_combination1(1/sin(pan_alpha) /*suu / sww*/, pan_w,
282 pan_z, 3);
283 cout << "pan_z: ";
284 N.vec_print(pan_z, 3);
285 cout << endl;
286 zz = N.dot_product(pan_z, pan_z, 3);
287 szz = sqrt(zz);
288
289 N.vec_scalar_multiple(pan_z, 1./szz, 3);
290
291 }
292 }
293 int f_with_background = TRUE;
294 for (i = 0; i < Opt->nb_no_background; i++) {
295 if (Opt->no_background_round[i] == round) {
296 f_with_background = FALSE;
297 }
298 }
299
300
301 for (h = 0; h < nb_frames_this_round; h++) {
302
303 char fname_pov[1000];
304 char fname_png[1000];
305 char povray_opts[1000];
307
308
309 povray_opts[0] = 0;
310 if (Opt->f_W) {
311 sprintf(povray_opts + strlen(povray_opts), "-W%d ", Opt->W);
312 }
313 if (Opt->f_H) {
314 sprintf(povray_opts + strlen(povray_opts), "-H%d ", Opt->H);
315 }
316 //sprintf(povray_opts, "");
317 // for instance -W1920 -H1200 for larger pictures
318 sprintf(fname_pov, output_mask.c_str(), round, h);
319 sprintf(fname_png, output_mask.c_str(), round, h);
320 ST.replace_extension_with(fname_png, ".png");
321
322 cout << "round " << round << ", frame " << h << " / "
323 << nb_frames_this_round << " in " << fname_pov << endl;
324 *fpm << "\t/usr/local/povray/bin/povray " << povray_opts
325 << " " << fname_pov << endl;
326
327 {
328 ofstream fp(fname_pov);
329
330
331 if (Opt->f_clipping_radius) {
332 clipping_radius = Opt->clipping_radius;
333 }
334 else {
335 clipping_radius = 2.7; // default
336 }
337 for (i = 0; i < Opt->nb_clipping; i++) {
338 if (Opt->clipping_round[i] == round) {
339 clipping_radius = Opt->clipping_value[i];
340 }
341 }
342
343 if (f_has_zoom) {
344 angle = ((double)zoom_start + (double) h * zoom_increment);
345 clipping_radius = zoom_clipping_start + (double) h * zoom_clipping_increment;
346 }
347 else {
348 if (f_has_zoom_sequence) {
349 angle = 0;
350 for (j = 0; j < zoom_sequence_l; j++) {
351 if (h >= zoom_sequence_fst[j] &&
352 h < zoom_sequence_fst[j] + zoom_sequence_len[j]) {
353 angle = zoom_sequence_value[j] +
354 (h - zoom_sequence_fst[j]) *
355 (zoom_sequence_value[j + 1] - zoom_sequence_value[j])
356 / zoom_sequence_len[j];
357 break;
358 }
359 }
360 if (j == zoom_sequence_l) {
361 cout << "cound not find frame " << h << " in zoom sequence" << endl;
362 exit(1);
363 }
364 if (zoom_sequence_fst[zoom_sequence_l] != nb_frames_this_round) {
365 cout << "zoom_sequence the frames dont add up" << endl;
366 cout << "have=" << zoom_sequence_fst[zoom_sequence_l] << endl;
367 cout << "should have " << nb_frames_this_round << endl;
368 exit(1);
369 }
370
371 }
372 else {
373 angle = Opt->default_angle;
374 }
375 }
376 cout << "frame " << h << " / " << nb_frames_this_round
377 << ", angle " << angle << endl;
378
379 if (f_has_pan) {
380 double pan_a[3];
381 double sky[3];
382 double location[3];
383 double direction_of_view[3];
384 double beta;
385 //char sky_string[1000];
386 //char location_string[1000];
387 //char look_at_string[1000];
388
389 if (pan_f_reverse) {
390 beta = pan_alpha - pan_delta *
391 (double) (nb_frames_this_round - 1 - h);
392 }
393 else {
394 beta = pan_alpha - pan_delta * (double) h;
395 }
396 cout << "h=" << h << " / " << nb_frames_this_round
397 << " beta=" << beta << endl;
398
400 cos(beta) * suu, pan_v,
401 sin(beta) * szz, pan_z,
402 pan_a, 3);
403 cout << "pan_a: ";
404 N.vec_print(pan_a, 3);
405 cout << endl;
406 cout << "pan_u: ";
407 N.vec_print(pan_u, 3);
408 cout << endl;
409
410
412 cos(beta) * suu, pan_v,
413 sin(beta) * szz, pan_z,
414 1., pan_center,
415 location, 3);
416
417 //sprintf(location_string, "<%lf,%lf,%lf>",
418 // location[0], location[1], location[2]);
419 //cout << "location_string=" << location_string << endl;
420
421
422
424 -1., location,
425 1., pan_center,
426 direction_of_view, 3);
427
428 N.cross_product(direction_of_view, pan_normal_uv, sky);
429 //sprintf(sky_string, "<%lf,%lf,%lf>",
430 // sky[0], sky[1], sky[2]);
431 //cout << "sky_string=" << sky_string << endl;
432
433 //sprintf(look_at_string, "<%lf,%lf,%lf>",
434 // pan_center[0], pan_center[1], pan_center[2]);
435 //cout << "look_at_string=" << look_at_string << endl;
436
437
438 Pov->beginning(fp,
439 angle,
440 sky,
441 location,
442 pan_center /* look_at*/,
443 //sky_string,
444 //location_string,
445 //look_at_string,
446 f_with_background);
447
448 }
449 else {
450 if (f_has_camera) {
451 Pov->beginning(fp,
452 angle,
453 camera_sky,
454 camera_location,
455 camera_look_at,
456 f_with_background);
457 }
458 else {
459 Pov->beginning(fp,
460 angle,
461 Opt->sky,
462 Opt->location,
463 Opt->look_at,
464 f_with_background);
465 }
466 }
467
468
469 if (draw_frame_callback == NULL) {
470 cout << "draw_frame_callback == NULL" << endl;
471 exit(1);
472 }
473 (*draw_frame_callback)(this, h /* frame */,
474 nb_frames_this_round, round,
475 clipping_radius,
476 fp,
477 verbose_level);
478
479
480
482 }
483 else {
484 int f_has_bottom_plane = TRUE;
485 for (i = 0; i < Opt->nb_no_bottom_plane; i++) {
486 if (Opt->no_bottom_plane_round[i] == round) {
487 f_has_bottom_plane = FALSE;
488 }
489 }
490
491 if (f_has_bottom_plane) {
492 Pov->bottom_plane(fp);
493 }
494 }
495 }
497
498 cout << "Written file " << fname_pov << " of size "
499 << Fio.file_size(fname_pov) << endl;
500
501
502 for (i = 0; i < Opt->nb_picture; i++) {
503 if (Opt->picture_round[i] == round) {
504 char cmd[5000];
505 double scale;
506
507 scale = Opt->picture_scale[i];
509 scale *= Opt->global_picture_scale;
510 }
511 scale *= 100.;
512 snprintf(cmd, 5000, "composite \\( %s "
513 "-resize %lf%% \\) %s %s tmp.png",
514 Opt->picture_fname[i].c_str(),
515 scale, //Opt->picture_scale[i] * 100.,
516 Opt->picture_options[i].c_str(),
517 fname_png);
518 //cout << "system: " << cmd << endl;
519 //system(cmd);
520 *fpm << "\t" << cmd << endl;
521
522 sprintf(cmd, "mv tmp.png %s", fname_png);
523 //cout << "system: " << cmd << endl;
524 //system(cmd);
525 *fpm << "\t" << cmd << endl;
526 }
527 }
528 for (i = 0; i < Opt->nb_round_text; i++) {
529
530 if (Opt->round_text_round[i] == round) {
531 char str[2000];
532
533 strcpy(str, Opt->round_text_text[i].c_str());
534 if ((int) strlen(str) > h) {
535 str[h] = 0;
536 }
537
539
540 if ((int) strlen(str) + Opt->round_text_sustain[i] > h &&
541 (int) strlen(str) && !ST.is_all_whitespace(str)) {
542 int font_size = 36;
543 int stroke_width = 1;
544
545 if (Opt->f_has_font_size) {
546 font_size = Opt->font_size;
547 }
548 if (Opt->f_has_stroke_width) {
549 stroke_width = Opt->stroke_width;
550 }
551
552 char cmd[10000];
553
554 snprintf(cmd, 10000, "convert -background none -fill white "
555 "-stroke black -strokewidth %d -font "
556 "Courier-10-Pitch-Bold -pointsize %d "
557 "label:'%s' overlay.png",
558 stroke_width, font_size, str);
559 //cout << "system: " << cmd << endl;
560 //system(cmd);
561 *fpm << "\t" << cmd << endl;
562
563
564 snprintf(cmd, 10000, "composite -gravity center overlay.png "
565 " %s tmp.png", fname_png);
566 //cout << "system: " << cmd << endl;
567 //system(cmd);
568 *fpm << "\t" << cmd << endl;
569
570 snprintf(cmd, 10000, "mv tmp.png %s", fname_png);
571 //cout << "system: " << cmd << endl;
572 //system(cmd);
573 *fpm << "\t" << cmd << endl;
574 }
575 }
576 } // end round text
577
578 for (i = 0; i < Opt->nb_label; i++) {
579
580 if (Opt->label_round[i] == round) {
581 string label;
582 string cmd;
583 char str[1000];
584
585 label.assign(Opt->label_text[i]);
586
587 if (h >= Opt->label_start[i]
588 && h < Opt->label_start[i] + Opt->label_sustain[i]) {
589 int font_size = 36;
590 int stroke_width = 1;
591
592 if (Opt->f_has_font_size) {
593 font_size = Opt->font_size;
594 }
595 if (Opt->f_has_stroke_width) {
596 stroke_width = Opt->stroke_width;
597 }
598 snprintf(str, 1000, "convert -background none -fill white "
599 "-stroke black -strokewidth %d -font "
600 "Courier-10-Pitch-Bold -pointsize %d "
601 "label:'%s' overlay.png",
602 stroke_width, font_size, label.c_str());
603 cmd.assign(str);
604 //cout << "system: " << cmd << endl;
605 //system(cmd);
606 *fpm << "\t" << cmd << endl;
607
608
609 snprintf(str, 1000, "composite %s overlay.png %s tmp.png",
610 Opt->label_gravity[i].c_str(), fname_png);
611 cmd.assign(str);
612 //cout << "system: " << cmd << endl;
613 //system(cmd);
614 *fpm << "\t" << cmd << endl;
615
616 snprintf(str, 10000, "mv tmp.png %s", fname_png);
617 cmd.assign(str);
618 //cout << "system: " << cmd << endl;
619 //system(cmd);
620 *fpm << "\t" << cmd << endl;
621 }
622 }
623 } // end label
624
625
626 for (i = 0; i < Opt->nb_latex_label; i++) {
627
628 if (Opt->latex_label_round[i] == round) {
629
630 if (h >= Opt->latex_label_start[i]
631 && h < Opt->latex_label_start[i] +
633
634
636
637 char str[1000];
639
640
641 cout << "creating latex label " << i << endl;
642 sprintf(str, output_mask.c_str(), round, h);
643
644 Opt->latex_fname_base[i].assign(str);
645
647 sprintf(str, "_%04d", i);
648 Opt->latex_fname_base[i].append(str);
649
650 //sprintf(Opt->latex_fname_base[i] +
651 // strlen(Opt->latex_fname_base[i]), "_%04d", i);
652
653 cout << "latex_fname_base=" <<
654 Opt->latex_fname_base[i] << endl;
655 string cmd;
656 string fname_tex;
657 string fname_pdf;
658
659 fname_tex.assign(Opt->latex_fname_base[i]);
660 fname_tex.append(".tex");
661 fname_pdf.assign(Opt->latex_fname_base[i]);
662 fname_pdf.append(".pdf");
663 //snprintf(fname_tex, 2000, "%s.tex", Opt->latex_fname_base[i]);
664 //snprintf(fname_pdf, 2000, "%s.pdf", Opt->latex_fname_base[i]);
665
666 cout << "begin latex source:" << endl;
667 cout << Opt->latex_label_text[i] << endl;
668 cout << "end latex source" << endl;
669 {
670 ofstream fp(fname_tex);
672 //latex_head_easy(fp);
674 Opt->latex_extras_for_praeamble[i].c_str());
675 fp << Opt->latex_label_text[i] << endl;
676 L.foot(fp);
677
678
679 }
680
681 cmd.assign("pdflatex ");
682 cmd.append(fname_tex);
683
684 //snprintf(cmd, 10000, "pdflatex %s", fname_tex);
685 //cout << "system: " << cmd << endl;
686 system(cmd.c_str());
687 //fpm << "\t" << cmd << endl;
688
690 }
691 else {
692
693 string cmd;
694 string fname_pdf;
695 string fname_label_png;
696
697 fname_pdf.assign(Opt->latex_fname_base[i]);
698 fname_pdf.append(".pdf");
699 fname_label_png.assign("label.png");
700
701 cmd.assign("convert -trim ");
702 cmd.append(fname_pdf);
703 cmd.append(" ");
704 cmd.append(fname_label_png);
705 //cout << "system: " << cmd << endl;
706 //system(cmd.c_str());
707 *fpm << "\t" << cmd << endl;
708
709
710 cmd.assign("composite ");
711 cmd.append(Opt->latex_label_gravity[i]);
712 cmd.append(" ");
713 cmd.append(fname_label_png);
714 cmd.append(" ");
715 cmd.append(fname_png);
716 cmd.append(" tmp.png");
717 //cout << "system: " << cmd << endl;
718 //system(cmd);
719 *fpm << "\t" << cmd << endl;
720
721 cmd.assign("mv tmp.png ");
722 cmd.append(fname_png);
723 //cout << "system: " << cmd << endl;
724 //system(cmd);
725 *fpm << "\t" << cmd << endl;
726 }
727
728 //Opt->latex_file_count++;
729 }
730 }
731 } // end label
732
733
734
735 }
736
737
738}
739
740
741void animate::draw_single_line(int line_idx, std::string &color, ostream &fp)
742{
743 int s[1];
744
745 s[0] = line_idx;
746 S->draw_lines_with_selection(s, 1, color, fp);
747}
748
749void animate::draw_single_quadric(int idx, std::string &color, ostream &fp)
750{
751 int s[1];
752
753 s[0] = idx;
754 S->draw_quadric_with_selection(s, 1, color, fp);
755}
756
757void animate::draw_single_surface(int surface_idx, ostream &fp)
758{
759 int s[1];
760
761 s[0] = surface_idx;
763}
764
765void animate::draw_single_surface_with_color(int surface_idx, std::string &color, ostream &fp)
766{
767 int s[1];
768
769 s[0] = surface_idx;
770 S->draw_cubic_with_selection(s, 1, color, fp);
771}
772
773void animate::draw_Hilbert_point(int point_idx, double rad,
774 std::string &options, ostream &fp)
775{
776 int s[1];
777
778 s[0] = point_idx;
779 S->draw_points_with_selection(s, 1, rad, options, fp);
780}
781
782void animate::draw_Hilbert_line(int line_idx, std::string &color, ostream &fp)
783{
784 int s[1];
785
786 s[0] = line_idx;
788 color,
789 fp);
790}
791
792void animate::draw_Hilbert_plane(int plane_idx, std::string &color, ostream &fp)
793{
794 int s[1];
795
796 s[0] = plane_idx;
797 S->draw_planes_with_selection(s, sizeof(s) / sizeof(int), color, fp);
798}
799
800void animate::draw_Hilbert_red_line(int idx_one_based, ostream &fp)
801{
802 int s[] = {12, 13, 14, 15, 16, 17};
803 S->draw_edges_with_selection(s + idx_one_based - 1, 1, Pov->color_red, fp);
804}
805
806void animate::draw_Hilbert_blue_line(int idx_one_based, ostream &fp)
807{
808 int s[] = {18, 19, 20, 21, 22, 23};
809 S->draw_edges_with_selection(s + idx_one_based - 1, 1, Pov->color_blue, fp);
810}
811
813{
814 int s[] = {12, 13, 14, 15, 16, 17};
815 S->draw_edges_with_selection(s, sizeof(s) / sizeof(int), Pov->color_red, fp);
816}
817
819{
820 int s[] = {18, 19, 20, 21, 22, 23};
821 S->draw_edges_with_selection(s, sizeof(s) / sizeof(int), Pov->color_blue, fp);
822}
823
825{
826 int s[] = {30,31,32,33,34,35,36,37,38,39,40,41};
827
829
830 S->draw_edges_with_selection(s, sizeof(s) / sizeof(int), Pov->color_black, fp);
831}
832
834{
835 int s[] = {0,1,2,3,4,5};
836 S->draw_faces_with_selection(s, sizeof(s) / sizeof(int), 0.01, Pov->color_pink, fp);
837}
838
840{
841 int s[] = {0,1,2,3,4,5,6,7,8,9,10,11};
842
844
845 S->draw_edges_with_selection(s, sizeof(s) / sizeof(int), Pov->color_black, fp);
846}
847
849{
850 int s[] = {24,25,26,27,28,29};
851
853
854 S->draw_edges_with_selection(s, sizeof(s) / sizeof(int), Pov->color_black, fp);
855}
856
858{
859 int s[] = {6,7,8,9};
860 S->draw_faces_with_selection(s, sizeof(s) / sizeof(int), 0.01, Pov->color_orange, fp);
861}
862
864 int h, int nb_frames, int round,
865 double clipping_radius,
866 ostream &fp,
867 int verbose_level)
868// round 0: cube + faces
869// round 1: cube + faces + extended edges + red lines + blue lines
870// round 2: red lines + blue lines + surface
871// round 3: three blue lines
872// round 4: three blue lines + quadric
873// round 5: four blue lines + 1 red line + quadric
874// round 6: four blue lines + 2 red lines + quadric
875// round 7: four blue lines + 2 red lines
876// round 8: double six (6 red + 6 blue)
877// round 9, 11, 12: surface
878// round 10: nothing
879// round 13: cube + tetrahedron
880// round 14: cube + tetrahedron + extended edges
881// round 15: cube + tetrahedron + extended edges + double six
882// round 16: 5 blue lines + 1 red (5 + 1)
883// round 17: red + blue + tetrahedron
884// round 18: red + blue + surface + tritangent plane + 3 yellow lines in it
885// round 19: surface + plane
886// round 20: cube + some red lines appearing
887// round 21: cube + some blue lines appearing
888// round 23: red + blue + surface + tritangent plane + 3 yellow lines in it + point appearing
889// round 24: all yellow lines (not at infinity)
890// round 25: red lines + blue lines + all yellow lines (not at infinity)
891// round 26: red lines + blue lines + all yellow lines (not at infinity) + surface
892// round 27, 28, 30, 31: empty
893// round 29: cube + 1 red line + 1 blue line
894// round 32: tritangent plane + 6 arc points
895// round 33-38, 40: nothing
896// round 39: surface 1 (transformed HCV)
897// round 41,42: Cayley's nodal surface + 6 lines
898// round 43: Clebsch surface
899// round 44: Clebsch surface with lines
900// round 45: Fermat surface
901// round 46: Fermat surface with lines
902// round 48-55: Cayley's ruled surface
903// round 72: all tritangent planes one-by-one
904// round 73: all red lines, 2 blue lines, surface, tritangent plane + 3 yellow lines, 6 arc points
905// round 74: surface, tritangent plane + 3 yellow lines
906// round 75: all red, 2 blue lines, tritangent plane + 3 yellow lines, 6 arc points (no surface)
907// round 76: tritangent plane, 6 point, 2 blue lines, 6 red lines
908// round 77: all red, 2 blue lines, tritangent plane + 3 yellow lines, 6 arc points, with surface
909// round 78: all red, 2 blue lines, tritangent plane + 3 yellow lines, 6 arc points, with surface, trying to plot points under the Clebsch map
910// round 79: like round 76
911// round 80: tarun
912{
913 int i;
914 //povray_interface Pov;
915
916
917 cout << "draw_frame_Hilbert round=" << round << endl;
918
919 double scale_factor = Opt->scale_factor;
920
921 Pov->union_start(fp);
922
923
924 if (round == 0) {
927 }
928
929 if (round == 1) {
935 }
936
937 if (round == 2) {
938 //draw_Hilbert_cube_boxed(S, fp);
941 draw_single_surface(0, fp);
942 }
943 if (round == 3) {
944 //{
945 //int s[] = {12 /*, 13, 14, 15, 16, 17*/};
946 //S->draw_edges_with_selection(s, sizeof(s) / sizeof(int), color_red, fp);
947 //}
948 {
949 int s[] = {/*18,*/ 19, 20, 21 /*, 22, 23*/};
950 S->draw_edges_with_selection(s, sizeof(s) / sizeof(int), Pov->color_blue, fp);
951 }
952 }
953 if (round == 4) {
954 //{
955 //int s[] = {12 /*, 13, 14, 15, 16, 17*/};
956 //S->draw_edges_with_selection(s, sizeof(s) / sizeof(int), color_red, fp);
957 //}
958 {
959 int s[] = {/*18,*/ 19, 20, 21 /*, 22, 23*/};
960 S->draw_edges_with_selection(s, sizeof(s) / sizeof(int), Pov->color_blue, fp);
961 }
963 }
964 if (round == 5) {
965 {
966 int s[] = {12 /*, 13, 14, 15, 16, 17*/};
967 S->draw_edges_with_selection(s, sizeof(s) / sizeof(int), Pov->color_red, fp);
968 }
969 {
970 int s[] = {/*18,*/ 19, 20, 21, 22 /*, 23*/};
971 S->draw_edges_with_selection(s, sizeof(s) / sizeof(int), Pov->color_blue, fp);
972 }
974 }
975 if (round == 6) {
976 {
977 int s[] = {12 /*, 13, 14, 15, 16*/, 17};
978 S->draw_edges_with_selection(s, sizeof(s) / sizeof(int), Pov->color_red, fp);
979 }
980 {
981 int s[] = {/*18,*/ 19, 20, 21, 22 /*, 23*/};
982 S->draw_edges_with_selection(s, sizeof(s) / sizeof(int), Pov->color_blue, fp);
983 }
985 }
986 if (round == 7) {
987 {
988 int s[] = {12 /*, 13, 14, 15, 16*/, 17};
989 S->draw_edges_with_selection(s, sizeof(s) / sizeof(int), Pov->color_red, fp);
990 }
991 {
992 int s[] = {/*18,*/ 19, 20, 21, 22 /*, 23*/};
993 S->draw_edges_with_selection(s, sizeof(s) / sizeof(int), Pov->color_blue, fp);
994 }
995 }
996 if (round == 8) {
999 }
1000 if (round == 9 || round == 11 || round == 12) {
1001 draw_single_surface(0, fp);
1002 }
1003 if (round == 10) {
1004 }
1005 if (round == 13) {
1009 }
1010 if (round == 14) {
1011 if (h < (nb_frames >> 1)) {
1016 }
1017 else {
1021 }
1022 }
1023 if (round == 15) {
1029 }
1030 if (round == 16) {
1031 {
1032 int s[] = {12 /*, 13, 14, 15, 16, 17*/};
1033 S->draw_edges_with_selection(s, sizeof(s) / sizeof(int), Pov->color_red, fp);
1034 }
1035 {
1036 int s[] = {/*18,*/ 19, 20, 21, 22, 23};
1037 S->draw_edges_with_selection(s, sizeof(s) / sizeof(int), Pov->color_blue, fp);
1038 }
1039 }
1040 if (round == 17) {
1045 }
1046 if (round == 18) {
1047
1048#if 0
1049 draw_Hilbert_red_line(S, 1, fp); // a1
1050 draw_Hilbert_blue_line(S, 2, fp); // b2
1051 draw_Hilbert_red_line(S, 2, fp); // a2
1052 draw_Hilbert_blue_line(S, 1, fp); // b1
1053 draw_Hilbert_plane(S, 3 + 0, Pov->color_orange, fp); // a1b2
1054 draw_Hilbert_plane(S, 3 + 1, Pov->color_orange, fp); // a2b1
1055 draw_Hilbert_line(S, 0, Pov->color_yellow, fp); // c12
1056#endif
1057
1060 draw_single_surface(0, fp);
1061 //draw_Hilbert_plane(S, 3 + 0, Pov->color_orange, fp); // a1b2
1062 //draw_Hilbert_plane(S, 3 + 1, Pov->color_orange, fp); // a2b1
1063 draw_Hilbert_plane(3 + 2, Pov->color_orange, fp); // pi_{12,34,56}
1064 draw_Hilbert_line(12 + 0, Pov->color_yellow, fp); // c12
1065 draw_Hilbert_line(12 + 9, Pov->color_yellow, fp);
1066 draw_Hilbert_line(12 + 14, Pov->color_yellow, fp);
1067 }
1068 if (round == 19) {
1069 draw_single_surface(0, fp);
1070 draw_Hilbert_plane(2, Pov->color_orange, fp); // Z=0
1071 }
1072 if (round == 20) {
1073 int nb_frames_half, nb1, j;
1074
1075 nb_frames_half = nb_frames >> 1;
1076 nb1 = nb_frames_half / 6;
1077
1078 if (h < nb_frames_half) {
1081
1082 j = h / nb1;
1083
1084 if (j < 6) {
1085 draw_Hilbert_red_line(1 + j, fp); // a{j+1}
1086 }
1087
1088 }
1089 else {
1091 //draw_Hilbert_cube_faces(Anim, fp);
1094 }
1095 }
1096 if (round == 21) {
1097 int nb_frames_half, nb1, j;
1098
1099 nb_frames_half = nb_frames >> 1;
1100 nb1 = nb_frames_half / 6;
1101
1102 if (h < nb_frames_half) {
1105
1106 j = h / nb1;
1107
1108 if (j < 6) {
1109 draw_Hilbert_blue_line(1 + j, fp); // b{j+1}
1110 }
1111
1112 }
1113 else {
1115 //draw_Hilbert_cube_faces(Anim, fp);
1118 }
1119 }
1120 if (round == 22) {
1121
1122
1125 draw_single_surface(0, fp);
1126 draw_Hilbert_plane(3 + 2, Pov->color_orange, fp); // pi_{12,34,56}
1127 draw_Hilbert_line(12 + 0, Pov->color_yellow, fp); // c12
1128 draw_Hilbert_line(12 + 9, Pov->color_yellow, fp);
1129 draw_Hilbert_line(12 + 14, Pov->color_yellow, fp);
1130
1131
1132 int nb_frames_half, nb1, j;
1133
1134 nb_frames_half = nb_frames; // >> 1;
1135 nb1 = nb_frames_half / 6;
1136
1137 if (h < nb_frames_half) {
1138 j = h / nb1;
1139
1140 if (j < 6) {
1141 draw_Hilbert_point(24 + j, 0.15, Pov->color_chrome, fp);
1142 }
1143
1144 }
1145 else {
1146 draw_Hilbert_point(24, 0.15, Pov->color_chrome, fp);
1147 draw_Hilbert_point(25, 0.15, Pov->color_chrome, fp);
1148 draw_Hilbert_point(26, 0.15, Pov->color_chrome, fp);
1149 draw_Hilbert_point(27, 0.15, Pov->color_chrome, fp);
1150 draw_Hilbert_point(28, 0.15, Pov->color_chrome, fp);
1151 draw_Hilbert_point(29, 0.15, Pov->color_chrome, fp);
1152 }
1153 }
1154 if (round == 23) {
1155
1156
1159 draw_single_surface(0, fp);
1160 draw_Hilbert_plane(3 + 2, Pov->color_orange, fp); // pi_{12,34,56}
1161 draw_Hilbert_line(12 + 0, Pov->color_yellow, fp); // c12
1162 draw_Hilbert_line(12 + 9, Pov->color_yellow, fp);
1163 draw_Hilbert_line(12 + 14, Pov->color_yellow, fp);
1164 draw_Hilbert_point(24, 0.15, Pov->color_chrome, fp);
1165 draw_Hilbert_point(25, 0.15, Pov->color_chrome, fp);
1166 draw_Hilbert_point(26, 0.15, Pov->color_chrome, fp);
1167 draw_Hilbert_point(27, 0.15, Pov->color_chrome, fp);
1168 draw_Hilbert_point(28, 0.15, Pov->color_chrome, fp);
1169 draw_Hilbert_point(29, 0.15, Pov->color_chrome, fp);
1170 }
1171 if (round == 24) {
1172 for (i = 0; i < 15; i++) {
1173 if (i == 2 || i == 7 || i == 11) {
1174 continue;
1175 }
1176 draw_Hilbert_line(12 + i, Pov->color_yellow, fp);
1177 }
1178 }
1179 if (round == 25) {
1182 for (i = 0; i < 15; i++) {
1183 if (i == 2 || i == 7 || i == 11) {
1184 continue;
1185 }
1186 draw_Hilbert_line(12 + i, Pov->color_yellow, fp);
1187 }
1188 }
1189 if (round == 26) {
1192 for (i = 0; i < 15; i++) {
1193 if (i == 2 || i == 7 || i == 11) {
1194 continue;
1195 }
1196 draw_Hilbert_line(12 + i, Pov->color_yellow, fp);
1197 }
1198 draw_single_surface(0, fp);
1199 }
1200
1201 if (round == 27) {
1202 }
1203 if (round == 28) {
1204 }
1205 if (round == 29) {
1207 draw_Hilbert_red_line(1, fp); // a{j+1}
1208 draw_Hilbert_blue_line(1, fp); // b{j+1}
1209 }
1210 if (round == 30) {
1211 }
1212 if (round == 31) {
1213 }
1214 if (round == 32) {
1215 //draw_Hilbert_red_lines(S, fp);
1216 //draw_Hilbert_blue_lines(S, fp);
1217 //draw_surface(S, 0, fp);
1218 draw_Hilbert_plane(3 + 2, Pov->color_orange, fp); // pi_{12,34,56}
1219 //draw_Hilbert_line(S, 0, Pov->color_yellow, fp); // c12
1220 //draw_Hilbert_line(S, 9, Pov->color_yellow, fp);
1221 //draw_Hilbert_line(S, 14, Pov->color_yellow, fp);
1222 draw_Hilbert_point(24, 0.15, Pov->color_chrome, fp);
1223 draw_Hilbert_point(25, 0.15, Pov->color_chrome, fp);
1224 draw_Hilbert_point(26, 0.15, Pov->color_chrome, fp);
1225 draw_Hilbert_point(27, 0.15, Pov->color_chrome, fp);
1226 draw_Hilbert_point(28, 0.15, Pov->color_chrome, fp);
1227 draw_Hilbert_point(29, 0.15, Pov->color_chrome, fp);
1228 }
1229 if (round == 33) {
1230 }
1231 if (round == 34) {
1232 }
1233 if (round == 35) {
1234 }
1235 if (round == 36) {
1236 }
1237 if (round == 37) {
1238 }
1239 if (round == 38) {
1240 }
1241 if (round == 39) {
1242 draw_single_surface(1, fp);
1243 }
1244 if (round == 40) {
1245 }
1246 if (round == 41) {
1247 // Cayley's nodal surface:
1248 int idx0 = 27;
1249 draw_single_surface(1, fp);
1250 draw_Hilbert_line(idx0 + 0, Pov->color_red, fp);
1251 draw_Hilbert_line(idx0 + 1, Pov->color_red, fp);
1252 draw_Hilbert_line(idx0 + 2, Pov->color_red, fp);
1253 draw_Hilbert_line(idx0 + 3, Pov->color_red, fp);
1254 draw_Hilbert_line(idx0 + 4, Pov->color_red, fp);
1255 draw_Hilbert_line(idx0 + 5, Pov->color_red, fp);
1256 }
1257 if (round == 42) {
1258 // Cayley's nodal surface:
1259 int idx0 = 27;
1260 draw_single_surface(1, fp);
1261 draw_Hilbert_line(idx0 + 0, Pov->color_red, fp);
1262 draw_Hilbert_line(idx0 + 1, Pov->color_red, fp);
1263 draw_Hilbert_line(idx0 + 2, Pov->color_red, fp);
1264 draw_Hilbert_line(idx0 + 3, Pov->color_red, fp);
1265 draw_Hilbert_line(idx0 + 4, Pov->color_red, fp);
1266 draw_Hilbert_line(idx0 + 5, Pov->color_red, fp);
1267 }
1268
1269 if (round == 43) {
1270 // Clebsch surface:
1271 draw_single_surface(2, fp);
1272 }
1273 if (round == 44) {
1274 // Clebsch surface with lines
1275 //S->line_radius = 0.04;
1276 draw_single_surface(2, fp);
1277 int red[6] = {12 + 21,12 + 22,12 + 23,12 + 24,12 + 25,12 + 26};
1279 int blue[6] = {12 + 27,12 + 28,12 + 29,12 + 30,12 + 31,12 + 32};
1280 S->draw_lines_with_selection(blue, 6, Pov->color_blue, fp);
1281 int yellow[15] = {12 + 33,12 + 34,12 + 35,12 + 36,12 + 37,
1282 12 + 38,12 + 39,12 + 40,12 + 41,12 + 42,12 + 43,
1283 12 + 44,12 + 45,12 + 46,12 + 47};
1284 S->draw_lines_with_selection(yellow, 15, Pov->color_yellow, fp);
1285 }
1286 if (round == 45) {
1287 draw_single_surface(3, fp); // Fermat
1288 }
1289 if (round == 46) {
1290 draw_single_surface(3, fp); // Fermat's surface
1291 int red[3] = {60,61,62};
1293 }
1294 if (round == 47) {
1295 }
1296 if (round == 48) {
1297 // Cayleys ruled surface, also due to Chasles
1298 draw_single_surface(6, fp);
1299 }
1300 if (round == 49) {
1301 // Cayleys ruled surface, also due to Chasles
1302 S->line_radius = 0.04;
1303 draw_single_surface(6, fp);
1304 int nb_lines0 = 63;
1305 int nb_lines_actual = 15;
1306 int *idx;
1307
1308 idx = NEW_int(nb_lines_actual);
1309 for (i = 0; i < nb_lines_actual; i++) {
1310 idx[i] = nb_lines0 + i;
1311 }
1312
1313
1314 int nb_frames_half, nb1, nb2;
1315
1316 nb_frames_half = nb_frames >> 1;
1317 nb1 = nb_frames_half / nb_lines_actual + 1;
1318
1319 if (h < nb1 * nb_lines_actual) {
1320 nb2 = h / nb1;
1321 S->draw_lines_with_selection(idx, nb2, Pov->color_brown, fp);
1322 }
1323 else {
1325 nb_lines_actual, Pov->color_brown, fp);
1326 }
1327 FREE_int(idx);
1328 }
1329 if (round == 50) {
1330 // Cayleys ruled surface, also due to Chasles
1331 S->line_radius = 0.04;
1332 draw_single_surface(6, fp);
1333 int nb_lines0 = 63;
1334 int nb_lines_actual = 15;
1335 int *idx;
1336
1337 idx = NEW_int(nb_lines_actual);
1338 for (i = 0; i < nb_lines_actual; i++) {
1339 idx[i] = nb_lines0 + i;
1340 }
1341 S->draw_lines_with_selection(idx, nb_lines_actual, Pov->color_brown, fp);
1342 FREE_int(idx);
1343 }
1344 if (round == 51) {
1345 // Cayleys ruled surface, also due to Chasles
1346 S->line_radius = 0.04;
1347 draw_single_surface(6, fp);
1348 int nb_lines0 = 63;
1349 int nb_lines_actual = 15;
1350 int *idx;
1351
1352 idx = NEW_int(nb_lines_actual);
1353 for (i = 0; i < nb_lines_actual; i++) {
1354 idx[i] = nb_lines0 + i;
1355 }
1356 S->draw_lines_with_selection(idx, nb_lines_actual, Pov->color_brown, fp);
1357 draw_Hilbert_plane(2, Pov->color_orange, fp); // Z=0
1358 draw_Hilbert_point(38, 0.25, Pov->color_chrome, fp);
1359 FREE_int(idx);
1360 }
1361 if (round == 52) {
1362 // Cayleys ruled surface, also due to Chasles
1363 S->line_radius = 0.04;
1364 draw_single_surface(6, fp);
1365 int nb_lines0 = 63;
1366 int nb_lines_actual = 15;
1367 int *idx;
1368
1369 idx = NEW_int(nb_lines_actual);
1370 for (i = 0; i < nb_lines_actual; i++) {
1371 idx[i] = nb_lines0 + i;
1372 }
1373 S->draw_lines_with_selection(idx, nb_lines_actual, Pov->color_brown, fp);
1374 draw_Hilbert_plane(2, Pov->color_orange, fp); // Z=0
1375 draw_Hilbert_point(38, 0.25, Pov->color_chrome, fp);
1376 FREE_int(idx);
1377 }
1378 if (round == 53) {
1379 draw_single_surface(0, fp);
1380 }
1381 if (round == 54) {
1382 // Cayleys ruled surface, also due to Chasles
1383 S->line_radius = 0.04;
1384 draw_single_surface(6, fp);
1385 int nb_lines0 = 63;
1386 int nb_lines_actual = 15;
1387 int nb_lines1 = nb_lines0 + nb_lines_actual;
1388 int *idx;
1389
1390 idx = NEW_int(nb_lines_actual);
1391 for (i = 0; i < nb_lines_actual; i++) {
1392 idx[i] = nb_lines0 + i;
1393 }
1394 S->draw_lines_with_selection(idx, nb_lines_actual, Pov->color_brown, fp);
1395 draw_Hilbert_plane(2, Pov->color_orange, fp); // Z=0
1396 draw_Hilbert_point(38, 0.25, Pov->color_chrome, fp);
1397 S->draw_line_with_selection(nb_lines1, Pov->color_yellow, fp);
1398 FREE_int(idx);
1399 }
1400 if (round == 55) {
1401 // Cayleys ruled surface, also due to Chasles
1402 S->line_radius = 0.04;
1403 draw_single_surface(6, fp);
1404 int nb_lines0 = 63;
1405 int nb_lines_actual = 15;
1406 int nb_lines1 = nb_lines0 + nb_lines_actual;
1407 int *idx;
1408
1409 idx = NEW_int(nb_lines_actual);
1410 for (i = 0; i < nb_lines_actual; i++) {
1411 idx[i] = nb_lines0 + i;
1412 }
1413 S->draw_lines_with_selection(idx, nb_lines_actual, Pov->color_brown, fp);
1414 draw_Hilbert_plane(2, Pov->color_orange, fp); // Z=0
1415 draw_Hilbert_point(38, 0.25, Pov->color_chrome, fp);
1416 S->draw_line_with_selection(nb_lines1, Pov->color_yellow, fp);
1417 FREE_int(idx);
1418 }
1419 if (round == 56) {
1420 S->line_radius = 0.04;
1421 //draw_Hilbert_cube_boxed(S, fp);
1424 //draw_Hilbert_plane(S, 3 + 2, Pov->color_orange, fp); // pi_{12,34,56}
1425 draw_Hilbert_plane(3 + 2, Pov->color_orange_no_phong, fp); // pi_{12,34,56}
1426 draw_Hilbert_line(12 + 0, Pov->color_yellow, fp); // c12
1427 draw_Hilbert_line(12 + 9, Pov->color_yellow, fp);
1428 draw_Hilbert_line(12 + 14, Pov->color_yellow, fp);
1429 //draw_surface(S, 7, fp);
1430 //draw_quadric(S, 1, Pov->color_gold_transparent, fp);
1431 //draw_quadric(S, 1, Pov->color_pink, fp);
1433 draw_Hilbert_point(24, 0.15, Pov->color_chrome, fp);
1434 draw_Hilbert_point(25, 0.15, Pov->color_chrome, fp);
1435 draw_Hilbert_point(26, 0.15, Pov->color_chrome, fp);
1436 draw_Hilbert_point(27, 0.15, Pov->color_chrome, fp);
1437 draw_Hilbert_point(28, 0.15, Pov->color_chrome, fp);
1438 draw_Hilbert_point(29, 0.15, Pov->color_chrome, fp);
1439 }
1440 if (round == 57) {
1441 S->line_radius = 0.04;
1442 //draw_Hilbert_cube_boxed(S, fp);
1445 //draw_Hilbert_plane(Anim, 3 + 2, Pov->color_orange, fp); // pi_{12,34,56}
1446 draw_Hilbert_plane(3 + 2, Pov->color_orange_no_phong, fp); // pi_{12,34,56}
1447 draw_Hilbert_line(12 + 0, Pov->color_yellow, fp); // c12
1448 draw_Hilbert_line(12 + 9, Pov->color_yellow, fp);
1449 draw_Hilbert_line(12 + 14, Pov->color_yellow, fp);
1450 //draw_surface(S, 7, fp);
1451 //draw_quadric(S, 1, Pov->color_gold_transparent, fp);
1452 //draw_quadric(S, 1, Pov->color_pink, fp);
1454 draw_Hilbert_point(24, 0.15, Pov->color_chrome, fp);
1455 draw_Hilbert_point(25, 0.15, Pov->color_chrome, fp);
1456 draw_Hilbert_point(26, 0.15, Pov->color_chrome, fp);
1457 draw_Hilbert_point(27, 0.15, Pov->color_chrome, fp);
1458 draw_Hilbert_point(28, 0.15, Pov->color_chrome, fp);
1459 draw_Hilbert_point(29, 0.15, Pov->color_chrome, fp);
1460 }
1461 if (round == 58) {
1462 S->line_radius = 0.04;
1463 //draw_Hilbert_cube_boxed(Anim, fp);
1466 //draw_Hilbert_plane(S, 3 + 2, Pov->color_orange, fp); // pi_{12,34,56}
1467 draw_Hilbert_plane(3 + 2, Pov->color_orange_no_phong, fp); // pi_{12,34,56}
1468 draw_Hilbert_line(12 + 0, Pov->color_yellow, fp); // c12
1469 draw_Hilbert_line(12 + 9, Pov->color_yellow, fp);
1470 draw_Hilbert_line(12 + 14, Pov->color_yellow, fp);
1471 //draw_surface(S, 7, fp);
1472 //draw_quadric(S, 1, Pov->color_gold_transparent, fp);
1473 //draw_quadric(S, 1, Pov->color_pink, fp);
1475 draw_Hilbert_point(24, 0.15, Pov->color_chrome, fp);
1476 draw_Hilbert_point(25, 0.15, Pov->color_chrome, fp);
1477 draw_Hilbert_point(26, 0.15, Pov->color_chrome, fp);
1478 draw_Hilbert_point(27, 0.15, Pov->color_chrome, fp);
1479 draw_Hilbert_point(28, 0.15, Pov->color_chrome, fp);
1480 draw_Hilbert_point(29, 0.15, Pov->color_chrome, fp);
1481 }
1482 if (round == 59) {
1483 S->line_radius = 0.04;
1484 //draw_Hilbert_cube_boxed(S, fp);
1487 //draw_Hilbert_plane(Anim, 3 + 2, Pov->color_orange, fp); // pi_{12,34,56}
1488 draw_Hilbert_plane(3 + 2, Pov->color_orange_no_phong, fp); // pi_{12,34,56}
1489 draw_Hilbert_line(12 + 0, Pov->color_yellow, fp); // c12
1490 draw_Hilbert_line(12 + 9, Pov->color_yellow, fp);
1491 draw_Hilbert_line(12 + 14, Pov->color_yellow, fp);
1492 //draw_surface(S, 7, fp);
1493 //draw_quadric(S, 1, Pov->color_gold_transparent, fp);
1494 //draw_quadric(S, 1, Pov->color_pink, fp);
1496 draw_Hilbert_point(24, 0.15, Pov->color_chrome, fp);
1497 draw_Hilbert_point(25, 0.15, Pov->color_chrome, fp);
1498 draw_Hilbert_point(26, 0.15, Pov->color_chrome, fp);
1499 draw_Hilbert_point(27, 0.15, Pov->color_chrome, fp);
1500 draw_Hilbert_point(28, 0.15, Pov->color_chrome, fp);
1501 draw_Hilbert_point(29, 0.15, Pov->color_chrome, fp);
1502 }
1503 if (round == 60) {
1504 draw_single_surface(7, fp); // from arc_lifting
1505 }
1506 if (round == 61) {
1507 draw_single_surface(7, fp); // from arc_lifting
1508 }
1509 if (round == 62) {
1510 draw_single_surface(7, fp); // from arc_lifting
1511 }
1512 if (round == 63) {
1513 draw_single_surface(8, fp); // from arc_lifting
1514 }
1515 if (round == 64) {
1516 draw_single_surface(8, fp); // from arc_lifting
1517 }
1518 if (round == 65) {
1519 draw_single_surface(8, fp); // from arc_lifting
1520 }
1521 if (round == 66) {
1522 draw_single_surface(0, fp); // Hilbert surface
1523 draw_Hilbert_plane(6, Pov->color_orange, fp); // F1
1524 draw_Hilbert_plane(7, Pov->color_orange, fp); // F2
1525 }
1526 if (round == 67) {
1527 draw_single_surface(0, fp); // Hilbert surface
1528 draw_Hilbert_plane(6, Pov->color_orange, fp); // F1
1529 draw_Hilbert_plane(7, Pov->color_orange, fp); // F2
1530
1531
1532 S->line_radius = 0.04;
1533
1534 {
1535 int s[] = {12, 13 /*, 14, 15, 16, 17*/};
1536 S->draw_edges_with_selection(s, 2, Pov->color_red, fp); // a1, a2
1537 }
1538 {
1539 int s[] = {/*18, 19, 20,*/ 21, 22 /*, 23*/};
1540 S->draw_edges_with_selection(s, 2, Pov->color_blue, fp); // b4, b5
1541 }
1542 draw_Hilbert_line(12 + 3, Pov->color_yellow, fp); // c15
1543 draw_Hilbert_line(12 + 6, Pov->color_yellow, fp); // c24
1544
1545 }
1546 if (round == 68) {
1547 draw_single_surface(0, fp); // Hilbert surface
1551 }
1552 if (round == 69) {
1553 draw_single_surface(0, fp); // Hilbert surface
1557
1558 S->line_radius = 0.04;
1559 {
1560 int s[] = {12, 13 /*, 14, 15, 16, 17*/};
1561 S->draw_edges_with_selection(s, 2, Pov->color_red, fp); // a1, a2
1562 }
1563 {
1564 int s[] = {/*18, 19, 20,*/ 21, 22 /*, 23*/};
1565 S->draw_edges_with_selection(s, 2, Pov->color_blue, fp); // b4, b5
1566 }
1567 draw_Hilbert_line(12 + 3, Pov->color_yellow, fp); // c15
1568 draw_Hilbert_line(12 + 6, Pov->color_yellow, fp); // c24
1569
1570 }
1571 if (round == 70) {
1572 draw_single_surface(0, fp); // Hilbert surface
1573 draw_Hilbert_plane(6, Pov->color_orange, fp); // F1
1574 draw_Hilbert_plane(7, Pov->color_orange, fp); // F2
1578
1579 S->line_radius = 0.04;
1580 {
1581 int s[] = {12, 13 /*, 14, 15, 16, 17*/};
1582 S->draw_edges_with_selection(s, 2, Pov->color_red, fp); // a1, a2
1583 }
1584 {
1585 int s[] = {/*18, 19, 20,*/ 21, 22 /*, 23*/};
1586 S->draw_edges_with_selection(s, 2, Pov->color_blue, fp); // b4, b5
1587 }
1588 draw_Hilbert_line(12 + 3, Pov->color_yellow, fp); // c15
1589 draw_Hilbert_line(12 + 6, Pov->color_yellow, fp); // c24
1590
1591 }
1592 if (round == 71) {
1593 //draw_surface(S, 0, fp); // Hilbert surface
1594 draw_Hilbert_plane(6, Pov->color_orange, fp); // F1
1595 draw_Hilbert_plane(7, Pov->color_orange, fp); // F2
1599
1600 S->line_radius = 0.04;
1601 {
1602 int s[] = {12, 13 /*, 14, 15, 16, 17*/};
1603 S->draw_edges_with_selection(s, 2, Pov->color_red, fp); // a1, a2
1604 }
1605 {
1606 int s[] = {/*18, 19, 20,*/ 21, 22 /*, 23*/};
1607 S->draw_edges_with_selection(s, 2, Pov->color_blue, fp); // b4, b5
1608 }
1609 draw_Hilbert_line(12 + 3, Pov->color_yellow, fp); // c15
1610 draw_Hilbert_line(12 + 6, Pov->color_yellow, fp); // c24
1611
1612 }
1613
1614 if (round == 72) {
1615 draw_single_surface(0, fp); // Hilbert surface
1616 //S->line_radius = 0.04;
1617
1618 int nb1, quo;
1619
1620 nb1 = nb_frames / 45;
1621
1622 quo = h / nb1;
1623
1624 // avoid drawing the plane at infinity:
1625 if (quo != 37) {
1626 draw_Hilbert_plane(12 + quo, Pov->color_orange, fp); // tritangent plane quo
1627 }
1628
1631 for (i = 0; i < 15; i++) {
1632 if (i == 2 || i == 7 || i == 11) {
1633 continue;
1634 }
1635 draw_Hilbert_line(12 + i, Pov->color_yellow, fp);
1636 }
1637
1638 }
1639 if (round == 73) {
1640 //S->line_radius = 0.04;
1641 //draw_Hilbert_cube_boxed(S, fp);
1643 //draw_Hilbert_blue_lines(S, fp);
1644 {
1645 int s[] = {18, /* 19, 20, 21, 22,*/ 23};
1646 S->draw_edges_with_selection(s, 2, Pov->color_blue, fp); // b1, b6
1647 }
1648 draw_Hilbert_plane(12 + 43, Pov->color_orange, fp); // pi_{16,24,35}
1649 draw_Hilbert_line(12 + 4, Pov->color_yellow, fp); // c16
1650 draw_Hilbert_line(12 + 6, Pov->color_yellow, fp); // c24
1651 draw_Hilbert_line(12 + 10, Pov->color_yellow, fp); // c35
1652 draw_single_surface(0, fp);
1653 draw_Hilbert_point(31, 0.15, Pov->color_chrome, fp);
1654 draw_Hilbert_point(32, 0.15, Pov->color_chrome, fp);
1655 draw_Hilbert_point(33, 0.15, Pov->color_chrome, fp);
1656 draw_Hilbert_point(34, 0.15, Pov->color_chrome, fp);
1657 draw_Hilbert_point(36, 0.15, Pov->color_chrome, fp);
1658 draw_Hilbert_point(37, 0.15, Pov->color_chrome, fp);
1659 }
1660 if (round == 74) {
1661 //S->line_radius = 0.04;
1662 draw_single_surface(0, fp); // Hilbert surface
1663
1664 draw_Hilbert_plane(12 + 43, Pov->color_orange, fp); // tritangent plane quo
1665 draw_Hilbert_line(12 + 4, Pov->color_yellow, fp); // c16
1666 draw_Hilbert_line(12 + 6, Pov->color_yellow, fp); // c24
1667 draw_Hilbert_line(12 + 10, Pov->color_yellow, fp); // c35
1668
1669 }
1670 if (round == 75) {
1671 //S->line_radius = 0.04;
1672 //draw_Hilbert_cube_boxed(S, fp);
1674 //draw_Hilbert_blue_lines(S, fp);
1675 {
1676 int s[] = {18, /* 19, 20, 21, 22,*/ 23};
1677 S->draw_edges_with_selection(s, 2, Pov->color_blue, fp); // b1, b6
1678 }
1679 draw_Hilbert_plane(12 + 43, Pov->color_orange, fp); // pi_{16,24,35}
1680 draw_Hilbert_line(12 + 4, Pov->color_yellow, fp); // c16
1681 draw_Hilbert_line(12 + 6, Pov->color_yellow, fp); // c24
1682 draw_Hilbert_line(12 + 10, Pov->color_yellow, fp); // c35
1683 //draw_surface(S, 0, fp);
1684 draw_Hilbert_point(31, 0.075, Pov->color_chrome, fp);
1685 draw_Hilbert_point(32, 0.075, Pov->color_chrome, fp);
1686 draw_Hilbert_point(33, 0.075, Pov->color_chrome, fp);
1687 draw_Hilbert_point(34, 0.075, Pov->color_chrome, fp);
1688 draw_Hilbert_point(36, 0.075, Pov->color_chrome, fp);
1689 draw_Hilbert_point(37, 0.075, Pov->color_chrome, fp);
1690 }
1691 if (round == 76) {
1692 //S->line_radius = 0.04;
1694 fp, verbose_level);
1695 }
1696 if (round == 77) {
1697
1698 //S->line_radius = 0.04;
1699
1700
1702 //draw_Hilbert_blue_lines(S, fp);
1703 {
1704 int s[] = {18, /* 19, 20, 21, 22,*/ 23};
1705 S->draw_edges_with_selection(s, 2, Pov->color_blue, fp); // b1, b6
1706 }
1707 draw_Hilbert_plane(12 + 43, Pov->color_orange, fp); // pi_{16,24,35}
1708 draw_Hilbert_line(12 + 4, Pov->color_yellow, fp); // c16
1709 draw_Hilbert_line(12 + 6, Pov->color_yellow, fp); // c24
1710 draw_Hilbert_line(12 + 10, Pov->color_yellow, fp); // c35
1712 draw_Hilbert_point(31, 0.075, Pov->color_chrome, fp);
1713 draw_Hilbert_point(32, 0.075, Pov->color_chrome, fp);
1714 draw_Hilbert_point(33, 0.075, Pov->color_chrome, fp);
1715 draw_Hilbert_point(34, 0.075, Pov->color_chrome, fp);
1716 draw_Hilbert_point(36, 0.075, Pov->color_chrome, fp);
1717 draw_Hilbert_point(37, 0.075, Pov->color_chrome, fp);
1718
1719 //draw_Hilbert_cube_boxed(S, fp);
1720 //draw_Hilbert_cube_faces(S,fp);
1721
1722 Pov->rotate_111(h, nb_frames, fp);
1723 Pov->union_end(fp, scale_factor, clipping_radius);
1724 Pov->union_start(fp);
1725
1726 //my_clipping_radius = 5 * my_clipping_radius;
1727
1728
1729#if 0
1730 // ToDo
1731 clebsch_scene *CS = (clebsch_scene *) S->extra_data;
1732 int n, nb;
1733
1734 n = h / 3;
1735
1736 if (n) {
1737 nb = CS->original_element_idx[n - 1];
1738 CS->draw_points_down_original(0, n, 0.05, Pov->color_scarlet, fp);
1739 CS->draw_points_up(0, nb, 0.05, Pov->color_black, fp);
1740 CS->draw_lines_up_original(n - 1, 1, Pov->color_gold, fp);
1741 }
1742#endif
1743 }
1744
1745 if (round == 78) {
1746
1747
1748 //S->line_radius = 0.04;
1749
1751 //draw_Hilbert_blue_lines(S, fp);
1752 {
1753 int s[] = {18, /* 19, 20, 21, 22,*/ 23};
1754 S->draw_edges_with_selection(s, 2, Pov->color_blue, fp); // b1, b6
1755 }
1756 draw_Hilbert_plane(12 + 43, Pov->color_orange, fp); // pi_{16,24,35}
1757 draw_Hilbert_line(12 + 4, Pov->color_yellow, fp); // c16
1758 draw_Hilbert_line(12 + 6, Pov->color_yellow, fp); // c24
1759 draw_Hilbert_line(12 + 10, Pov->color_yellow, fp); // c35
1761 draw_Hilbert_point(31, 0.075, Pov->color_chrome, fp);
1762 draw_Hilbert_point(32, 0.075, Pov->color_chrome, fp);
1763 draw_Hilbert_point(33, 0.075, Pov->color_chrome, fp);
1764 draw_Hilbert_point(34, 0.075, Pov->color_chrome, fp);
1765 draw_Hilbert_point(36, 0.075, Pov->color_chrome, fp);
1766 draw_Hilbert_point(37, 0.075, Pov->color_chrome, fp);
1767
1768 //draw_Hilbert_cube_boxed(S, fp);
1769 //draw_Hilbert_cube_faces(S,fp);
1770
1771 Pov->rotate_111(h, nb_frames, fp);
1772 Pov->union_end(fp, scale_factor, clipping_radius);
1773 Pov->union_start(fp);
1774
1775 //my_clipping_radius = 5 * my_clipping_radius;
1776
1777#if 0
1778 // ToDo
1779 clebsch_scene *CS = (clebsch_scene *) S->extra_data;
1780 int nb;
1781
1782 nb = CS->nb_elements;
1783
1784 CS->draw_points_down_original(0, CS->nb_steps, 0.05, Pov->color_scarlet, fp);
1785 CS->draw_points_up(0, nb, 0.05, Pov->color_black, fp);
1786#endif
1787 }
1788 if (round == 79) {
1789 //S->line_radius = 0.04;
1791 fp, verbose_level);
1792 }
1793 if (round == 80) {
1794 // for Tarun
1795 //S->line_radius = 0.04;
1797 int orbit_reps[] = {
1798 0,1,2,
1799 0,1,3,
1800 0,1,4,
1801 0,1,5,
1802 0,1,6,
1803 0,2,4,
1804 0,2,5,
1805 0,2,6,
1806 0,4,5,
1807 0,4,6,
1808 0,5,6,
1809 2,4,5,
1810 2,4,6
1811 };
1812 for (i = 0; i < 13 * 3; i++) {
1813 orbit_reps[i]++;
1814 }
1815 int rk;
1816 int faces[4];
1817 int set[3];
1820
1821 int *cur_orbit_rep = orbit_reps + 2 * 3;
1822
1823 // draw 4 faces:
1824 rk = Combi.rank_k_subset(cur_orbit_rep, 8 /*n*/, 3 /*k*/);
1825 faces[0] = 10 + rk;
1826 for (i = 0; i < 3; i++) {
1827 set[0] = 0;
1828 set[1] = cur_orbit_rep[i];
1829 set[2] = cur_orbit_rep[(i + 1) % 3];
1830 Sorting.int_vec_heapsort(set, 3);
1831 rk = Combi.rank_k_subset(set, 8 /*n*/, 3 /*k*/);
1832 faces[1 + i] = 10 + rk;
1833 }
1834 cout << "faces=";
1835 Int_vec_print(cout, faces, 4);
1836 cout << endl;
1837 S->draw_faces_with_selection(faces, 4,
1838 0.01, Pov->color_pink, fp);
1839 }
1840 if (round == 81) {
1841 // same as round 76
1842
1843 //S->line_radius = 0.04;
1845 fp, verbose_level);
1846 }
1847 if (round == 82) {
1848 //S->line_radius = 0.04;
1850 //draw_Hilbert_blue_lines(S, fp);
1851 //{
1852 //int s[] = {18, /* 19, 20, 21, 22,*/ 23};
1853 //S->draw_edges_with_selection(s, 2, color_blue, fp); // b1, b6
1854 //}
1855 draw_Hilbert_plane(12 + 43, Pov->color_orange, fp); // pi_{16,24,35}
1856 //draw_Hilbert_line(S, 12 + 4, color_yellow, fp); // c16
1857 //draw_Hilbert_line(S, 12 + 6, color_yellow, fp); // c24
1858 //draw_Hilbert_line(S, 12 + 10, color_yellow, fp); // c35
1859 draw_single_surface(0, fp);
1860 draw_Hilbert_point(31, 0.12, Pov->color_chrome, fp);
1861 draw_Hilbert_point(32, 0.12, Pov->color_chrome, fp);
1862 draw_Hilbert_point(33, 0.12, Pov->color_chrome, fp);
1863 draw_Hilbert_point(34, 0.12, Pov->color_chrome, fp);
1864 draw_Hilbert_point(36, 0.12, Pov->color_chrome, fp);
1865 draw_Hilbert_point(37, 0.12, Pov->color_chrome, fp);
1866
1867 }
1868 if (round == 83) {
1869
1870 //S->line_radius = 0.04;
1871 draw_Hilbert_plane(12 + 43, Pov->color_orange, fp); // pi_{16,24,35}
1872
1873 int start_of_long_lines = 79;
1874 draw_Hilbert_line(start_of_long_lines + 12 + 4, Pov->color_yellow, fp); // c16
1875 draw_Hilbert_line(start_of_long_lines + 12 + 6, Pov->color_yellow, fp); // c24
1876 draw_Hilbert_line(start_of_long_lines + 12 + 10, Pov->color_yellow, fp); // c35
1877
1879 //draw_Hilbert_blue_lines(S, fp);
1880 {
1881 int s[] = {18, /* 19, 20, 21, 22,*/ 23};
1882 S->draw_edges_with_selection(s, 2, Pov->color_blue, fp); // b1, b6
1883 }
1884
1885 //draw_surface(S, 0, fp);
1886 draw_Hilbert_point(31, 0.12, Pov->color_chrome, fp);
1887 draw_Hilbert_point(32, 0.12, Pov->color_chrome, fp);
1888 draw_Hilbert_point(33, 0.12, Pov->color_chrome, fp);
1889 draw_Hilbert_point(34, 0.12, Pov->color_chrome, fp);
1890 draw_Hilbert_point(36, 0.12, Pov->color_chrome, fp);
1891 draw_Hilbert_point(37, 0.12, Pov->color_chrome, fp);
1892 }
1893 if (round == 84) {
1894
1895 //S->line_radius = 0.04;
1896
1898
1899 draw_single_surface(0, fp);
1900
1901 }
1902
1903 if (round == 85) {
1904
1905 //S->line_radius = 0.04;
1906
1908
1909 draw_single_surface(0, fp);
1910
1911 }
1912
1913 if (round == 86) {
1914
1916
1917 }
1918 if (round == 87) {
1919
1920 //S->line_radius = 0.04;
1921 int *selection;
1922 int q = 13;
1923 int nb_select = q * q * q;
1924
1925 if (!S->f_has_affine_space) {
1926 cout << "scene does not have affine space" << endl;
1927 exit(1);
1928 }
1929 selection = NEW_int(nb_select);
1930 for (i = 0; i < nb_select; i++) {
1931 selection[i] = S->affine_space_starting_point + i;
1932 }
1933
1934 S->draw_points_with_selection(selection, nb_select,
1935 0.12, Pov->color_chrome, fp);
1936
1937 FREE_int(selection);
1938
1939
1940 }
1941 if (round == 88) {
1942 {
1943 // red lines:
1944 int s[] = {12/*, 13, 14, 15, 16, 17*/};
1945 S->draw_edges_with_selection(s, sizeof(s) / sizeof(int), Pov->color_red, fp);
1946 }
1947
1948 {
1949 // axes:
1950 int s[] = {42,43,44};
1951 S->draw_edges_with_selection(s, sizeof(s) / sizeof(int), Pov->color_black, fp);
1952 }
1953
1954
1955 {
1956 // blue lines
1957 //int s[] = {18, 19, 20, 21, 22, 23};
1958 //S->draw_edges_with_selection(s, sizeof(s) / sizeof(int), Pov->color_blue, fp);
1959 }
1960 //draw_Hilbert_red_lines(S, fp);
1961 //draw_Hilbert_blue_lines(S, fp);
1962 }
1963 if (round == 89) {
1964 {
1965 // red lines:
1966 int s[] = {12/*, 13, 14, 15, 16, 17*/};
1967 S->draw_edges_with_selection(s, sizeof(s) / sizeof(int), Pov->color_red, fp);
1968 }
1969
1970 {
1971 // axes:
1972 int s[] = {42,43,44};
1973 S->draw_edges_with_selection(s, sizeof(s) / sizeof(int), Pov->color_black, fp);
1974 }
1975
1977
1978 {
1979 // blue lines
1980 //int s[] = {18, 19, 20, 21, 22, 23};
1981 //S->draw_edges_with_selection(s, sizeof(s) / sizeof(int), color_blue, fp);
1982 }
1983 //draw_Hilbert_red_lines(S, fp);
1984 //draw_Hilbert_blue_lines(S, fp);
1985 }
1986 if (round == 90) {
1987 //S->line_radius = 0.04;
1988 //draw_Hilbert_red_lines(S, fp);
1989 //draw_Hilbert_blue_lines(S, fp);
1990 //{
1991 //int s[] = {18, /* 19, 20, 21, 22,*/ 23};
1992 //S->draw_edges_with_selection(s, 2, color_blue, fp); // b1, b6
1993 //}
1994 //draw_Hilbert_plane(S, 12 + 43, color_orange, fp); // pi_{16,24,35}
1995 //draw_Hilbert_line(S, 12 + 4, color_yellow, fp); // c16
1996 //draw_Hilbert_line(S, 12 + 6, color_yellow, fp); // c24
1997 //draw_Hilbert_line(S, 12 + 10, color_yellow, fp); // c35
1998 draw_single_surface(0, fp);
1999
2000 {
2001 int selection[] = {0,1};
2002 int nb_select = 2;
2003 S->draw_lines_ai_with_selection(selection, nb_select, fp);
2004 }
2005 {
2006 int selection[] = {0,1};
2007 int nb_select = 2;
2008 S->draw_lines_bj_with_selection(selection, nb_select, fp);
2009 }
2010 {
2011 int selection[] = {0};
2012 int nb_select = 1;
2013 S->draw_lines_cij_with_selection(selection, nb_select, fp);
2014 }
2015 draw_Hilbert_plane(12 + 0, Pov->color_orange_transparent, fp); // pi_{12}
2016 draw_Hilbert_plane(12 + 1, Pov->color_orange_transparent, fp); // pi_{21}
2017
2018 //draw_Hilbert_point(S, 31, 0.12, color_chrome, fp);
2019 //draw_Hilbert_point(S, 32, 0.12, color_chrome, fp);
2020 //draw_Hilbert_point(S, 33, 0.12, color_chrome, fp);
2021 //draw_Hilbert_point(S, 34, 0.12, color_chrome, fp);
2022 //draw_Hilbert_point(S, 36, 0.12, color_chrome, fp);
2023 //draw_Hilbert_point(S, 37, 0.12, color_chrome, fp);
2024
2025 }
2026
2027 rotation(h, nb_frames, round, fp);
2028
2029 union_end(
2030 h, nb_frames, round,
2031 clipping_radius,
2032 fp);
2033
2034 cout << "animate::draw_frame_Hilbert done" << endl;
2035
2036
2037}
2038
2039
2041{
2042 int Pts[] = {
2043 0, 0, 0, 1,
2044 1, 1, 1, 1,
2045 8, 0, 0, 1,
2046 0, 1, 0, 1,
2047 12, 1, 0, 1,
2048 0, 2, 0, 1,
2049 3, 2, 0, 1,
2050 0, 3, 0, 1,
2051 7, 3, 0, 1,
2052 0, 4, 0, 1,
2053 11, 4, 0, 1,
2054 0, 5, 0, 1,
2055 2, 5, 0, 1,
2056 0, 6, 0, 1,
2057 6, 6, 0, 1,
2058 0, 7, 0, 1,
2059 10, 7, 0, 1,
2060 0, 8, 0, 1,
2061 1, 8, 0, 1,
2062 0, 9, 0, 1,
2063 5, 9, 0, 1,
2064 0, 10, 0, 1,
2065 9, 10, 0, 1,
2066 0, 11, 0, 1,
2067 0, 12, 0, 1,
2068 4, 12, 0, 1,
2069 0, 0, 1, 1,
2070 5, 0, 1, 1,
2071 12, 1, 1, 1,
2072 2, 2, 1, 1,
2073 6, 2, 1, 1,
2074 0, 3, 1, 1,
2075 3, 3, 1, 1,
2076 4, 4, 1, 1,
2077 7, 4, 1, 1,
2078 1, 5, 1, 1,
2079 5, 5, 1, 1,
2080 6, 6, 1, 1,
2081 8, 6, 1, 1,
2082 2, 7, 1, 1,
2083 7, 7, 1, 1,
2084 8, 8, 1, 1,
2085 9, 8, 1, 1,
2086 3, 9, 1, 1,
2087 9, 9, 1, 1,
2088 10, 10, 1, 1,
2089 4, 11, 1, 1,
2090 11, 11, 1, 1,
2091 11, 12, 1, 1,
2092 12, 12, 1, 1,
2093 0, 0, 2, 1,
2094 2, 0, 2, 1,
2095 3, 1, 2, 1,
2096 11, 1, 2, 1,
2097 6, 2, 2, 1,
2098 7, 2, 2, 1,
2099 3, 3, 2, 1,
2100 9, 3, 2, 1,
2101 12, 4, 2, 1,
2102 2, 5, 2, 1,
2103 8, 5, 2, 1,
2104 4, 6, 2, 1,
2105 5, 6, 2, 1,
2106 0, 7, 2, 1,
2107 8, 7, 2, 1,
2108 9, 8, 2, 1,
2109 11, 8, 2, 1,
2110 1, 9, 2, 1,
2111 5, 9, 2, 1,
2112 1, 10, 2, 1,
2113 4, 10, 2, 1,
2114 7, 11, 2, 1,
2115 10, 11, 2, 1,
2116 6, 12, 2, 1,
2117 10, 12, 2, 1,
2118 0, 0, 3, 1,
2119 12, 0, 3, 1,
2120 5, 1, 3, 1,
2121 10, 1, 3, 1,
2122 7, 2, 3, 1,
2123 11, 2, 3, 1,
2124 4, 3, 3, 1,
2125 1, 4, 3, 1,
2126 10, 4, 3, 1,
2127 3, 5, 3, 1,
2128 11, 5, 3, 1,
2129 8, 6, 3, 1,
2130 9, 6, 3, 1,
2131 2, 7, 3, 1,
2132 5, 7, 3, 1,
2133 2, 8, 3, 1,
2134 8, 8, 3, 1,
2135 1, 9, 3, 1,
2136 12, 9, 3, 1,
2137 7, 10, 3, 1,
2138 9, 10, 3, 1,
2139 0, 11, 3, 1,
2140 6, 11, 3, 1,
2141 3, 12, 3, 1,
2142 6, 12, 3, 1,
2143 0, 0, 4, 1,
2144 9, 0, 4, 1,
2145 7, 1, 4, 1,
2146 9, 1, 4, 1,
2147 0, 2, 4, 1,
2148 10, 2, 4, 1,
2149 1, 5, 4, 1,
2150 4, 5, 4, 1,
2151 5, 6, 4, 1,
2152 7, 6, 4, 1,
2153 1, 7, 4, 1,
2154 5, 7, 4, 1,
2155 10, 9, 4, 1,
2156 4, 11, 4, 1,
2157 0, 0, 5, 1,
2158 6, 0, 5, 1,
2159 8, 1, 5, 1,
2160 9, 1, 5, 1,
2161 4, 3, 5, 1,
2162 9, 3, 5, 1,
2163 4, 5, 5, 1,
2164 5, 5, 5, 1,
2165 0, 6, 5, 1,
2166 7, 6, 5, 1,
2167 6, 9, 5, 1,
2168 8, 9, 5, 1,
2169 5, 10, 5, 1,
2170 7, 10, 5, 1,
2171 0, 0, 6, 1,
2172 3, 0, 6, 1,
2173 7, 1, 6, 1,
2174 11, 1, 6, 1,
2175 6, 5, 6, 1,
2176 7, 5, 6, 1,
2177 2, 9, 6, 1,
2178 6, 9, 6, 1,
2179 0, 10, 6, 1,
2180 10, 10, 6, 1,
2181 2, 11, 6, 1,
2182 10, 11, 6, 1,
2183 3, 12, 6, 1,
2184 11, 12, 6, 1,
2185 0, 0, 7, 1,
2186 0, 1, 7, 1,
2187 6, 1, 7, 1,
2188 2, 2, 7, 1,
2189 10, 2, 7, 1,
2190 7, 5, 7, 1,
2191 10, 5, 7, 1,
2192 2, 8, 7, 1,
2193 7, 8, 7, 1,
2194 4, 9, 7, 1,
2195 11, 9, 7, 1,
2196 4, 10, 7, 1,
2197 0, 0, 8, 1,
2198 10, 0, 8, 1,
2199 2, 1, 8, 1,
2200 5, 1, 8, 1,
2201 1, 4, 8, 1,
2202 10, 4, 8, 1,
2203 0, 5, 8, 1,
2204 8, 5, 8, 1,
2205 7, 7, 8, 1,
2206 8, 7, 8, 1,
2207 2, 9, 8, 1,
2208 7, 9, 8, 1,
2209 1, 10, 8, 1,
2210 5, 10, 8, 1,
2211 0, 0, 9, 1,
2212 7, 0, 9, 1,
2213 4, 1, 9, 1,
2214 12, 4, 9, 1,
2215 3, 5, 9, 1,
2216 9, 5, 9, 1,
2217 4, 6, 9, 1,
2218 9, 6, 9, 1,
2219 0, 9, 9, 1,
2220 3, 9, 9, 1,
2221 7, 12, 9, 1,
2222 12, 12, 9, 1,
2223 0, 0, 10, 1,
2224 4, 0, 10, 1,
2225 3, 1, 10, 1,
2226 6, 1, 10, 1,
2227 3, 2, 10, 1,
2228 11, 2, 10, 1,
2229 7, 3, 10, 1,
2230 12, 3, 10, 1,
2231 4, 4, 10, 1,
2232 7, 4, 10, 1,
2233 6, 5, 10, 1,
2234 10, 5, 10, 1,
2235 11, 9, 10, 1,
2236 12, 9, 10, 1,
2237 0, 0, 11, 1,
2238 1, 0, 11, 1,
2239 2, 1, 11, 1,
2240 8, 1, 11, 1,
2241 0, 4, 11, 1,
2242 11, 4, 11, 1,
2243 9, 5, 11, 1,
2244 11, 5, 11, 1,
2245 1, 8, 11, 1,
2246 7, 8, 11, 1,
2247 8, 9, 11, 1,
2248 9, 9, 11, 1,
2249 2, 11, 11, 1,
2250 7, 11, 11, 1,
2251 0, 0, 12, 1,
2252 11, 0, 12, 1,
2253 1, 1, 12, 1,
2254 10, 1, 12, 1,
2255 12, 3, 12, 1,
2256 12, 5, 12, 1,
2257 1, 7, 12, 1,
2258 10, 7, 12, 1,
2259 0, 8, 12, 1,
2260 11, 8, 12, 1,
2261 4, 9, 12, 1,
2262 7, 9, 12, 1,
2263 4, 12, 12, 1,
2264 7, 12, 12, 1,
2265 };
2266 int nb_affine_pts = 222;
2267 int q = 13;
2268 int *selection;
2269 int nb_select = nb_affine_pts;
2270 long int i, rk;
2271 int v[3];
2273
2274 if (!S->f_has_affine_space) {
2275 cout << "draw_surface_13_1 "
2276 "scene does not have affine space" << endl;
2277 exit(1);
2278 }
2279
2280 selection = NEW_int(nb_select);
2281 for (i = 0; i < nb_select; i++) {
2282 v[0] = Pts[i * 4 + 2]; // z
2283 v[1] = Pts[i * 4 + 1]; // y
2284 v[2] = Pts[i * 4 + 0]; // x
2285 rk = Gg.AG_element_rank(q, v, 1, 3);
2286 selection[i] = S->affine_space_starting_point + rk;
2287 }
2288
2289 S->draw_points_with_selection(selection, nb_select,
2290 0.12, Pov->color_chrome, fp);
2291 FREE_int(selection);
2292
2293
2294}
2295
2297 int h, int nb_frames, int round,
2298 ostream &fp,
2299 int verbose_level)
2300// tritangent plane, 6 point, 2 blue lines, 6 red lines, text
2301{
2302 //int i;
2303
2304 //draw_Hilbert_cube_boxed(S, fp);
2306 //draw_Hilbert_blue_lines(S, fp);
2307 {
2308 int s[] = {18, /* 19, 20, 21, 22,*/ 23};
2309 S->draw_edges_with_selection(s, 2, Pov->color_blue, fp); // b1, b6
2310 }
2311 draw_Hilbert_plane(12 + 43, Pov->color_orange, fp); // pi_{16,24,35}
2312 draw_Hilbert_line(12 + 4, Pov->color_yellow, fp); // c16
2313 draw_Hilbert_line(12 + 6, Pov->color_yellow, fp); // c24
2314 draw_Hilbert_line(12 + 10, Pov->color_yellow, fp); // c35
2315 //draw_surface(S, 0, fp);
2316 draw_Hilbert_point(31, 0.12, Pov->color_chrome, fp);
2317 draw_Hilbert_point(32, 0.12, Pov->color_chrome, fp);
2318 draw_Hilbert_point(33, 0.12, Pov->color_chrome, fp);
2319 draw_Hilbert_point(34, 0.12, Pov->color_chrome, fp);
2320 draw_Hilbert_point(36, 0.12, Pov->color_chrome, fp);
2321 draw_Hilbert_point(37, 0.12, Pov->color_chrome, fp);
2322
2323 //draw_Hilbert_cube_boxed(S, fp);
2324 //draw_Hilbert_cube_faces(S,fp);
2325
2326 int idx;
2327 double thickness_half = 0.15;
2328 double extra_spacing = 0;
2329 string color_options("pigment { Black } ");
2330 //const char *color_options = "pigment { BrightGold } finish { reflection .25 specular 1 }";
2331 //double up_x = 1.,up_y = 1., up_z = 1.;
2332 //double view[3];
2333
2334 //double location[3] = {-3,1,3};
2335 //double look_at[3];
2336
2337
2338#if 0
2339 double a;
2340 a = -1 / sqrt(3.);
2341 for (i = 0; i < 3; i++) {
2342 look_at[i] = a;
2343 }
2344#endif
2345 //ost << " location <-3,1,3>" << endl;
2346 //ost << " look_at <1,1,1>*-1/sqrt(3)" << endl;
2347
2348#if 0
2349 for (i = 0; i < 3; i++) {
2350 view[i] = look_at[i] - location[i];
2351 }
2352#endif
2353
2354 double scale = 0.25;
2355 double off_x = -0.1;
2356 double off_y = 0.25;
2357 double off_z = -0.1;
2358
2359 string one("1");
2360 string two("2");
2361 string three("3");
2362 string four("4");
2363 string five("5");
2364 string six("6");
2365
2366 idx = 36;
2367 draw_text(one, thickness_half, extra_spacing,
2368 scale,
2369 off_x, off_y, off_z,
2370 color_options,
2371 idx,
2372 //up_x, up_y, up_z,
2373 //view[0], view[1], view[2],
2374 fp, verbose_level - 1);
2375 idx = 31;
2376 draw_text(two, thickness_half, extra_spacing,
2377 scale,
2378 off_x, off_y, off_z,
2379 color_options,
2380 idx,
2381 //up_x, up_y, up_z,
2382 //view[0], view[1], view[2],
2383 fp, verbose_level - 1);
2384 idx = 32;
2385 draw_text(three, thickness_half, extra_spacing,
2386 scale,
2387 off_x, off_y, off_z,
2388 color_options,
2389 idx,
2390 //up_x, up_y, up_z,
2391 //view[0], view[1], view[2],
2392 fp, verbose_level - 1);
2393 idx = 33;
2394 draw_text(four, thickness_half, extra_spacing,
2395 scale,
2396 off_x, off_y, off_z,
2397 color_options,
2398 idx,
2399 //up_x, up_y, up_z,
2400 //view[0], view[1], view[2],
2401 fp, verbose_level - 1);
2402 idx = 34;
2403 draw_text(five, thickness_half, extra_spacing,
2404 scale,
2405 off_x, off_y, off_z,
2406 color_options,
2407 idx,
2408 //up_x, up_y, up_z,
2409 //view[0], view[1], view[2],
2410 fp, verbose_level - 1);
2411 idx = 37;
2412 draw_text(six, thickness_half, extra_spacing,
2413 scale,
2414 off_x, off_y, off_z,
2415 color_options,
2416 idx,
2417 //up_x, up_y, up_z,
2418 //view[0], view[1], view[2],
2419 fp, verbose_level - 1);
2420}
2421
2422
2424 int h, int nb_frames, int round,
2425 double clipping_radius,
2426 ostream &fp,
2427 int verbose_level)
2428{
2429 int i;
2430 //povray_interface Pov;
2431
2432
2433 cout << "animate::draw_frame_Eckardt_surface" << endl;
2434
2435 double scale_factor;
2436
2437 scale_factor = Opt->scale_factor;
2438
2439 Pov->union_start(fp);
2440
2441
2442
2443 if (round == 0) {
2444
2445 int s[1];
2446
2447 s[0] = 0;
2449 //S->draw_line_with_selection(0, Pov->color_red, fp);
2450
2451 }
2452 else if (round == 1) {
2453
2454 int s[1];
2455
2456 s[0] = 1;
2458#if 0
2460 color_red,
2461 fp);
2462#endif
2463
2464 }
2465 else if (round == 2) {
2466
2467 int s[1];
2468
2469 s[0] = 2;
2471#if 0
2473 color_red,
2474 fp);
2475#endif
2476
2477 }
2478 else if (round == 3) {
2479
2480 int selection[3];
2481 int nb_select;
2482
2483 selection[0] = 2;
2484 nb_select = 1;
2485 S->draw_cubic_with_selection(selection, 1, Pov->color_white, fp);
2486
2487 selection[0] = 0;
2488 nb_select = 1;
2489 S->draw_planes_with_selection(selection, nb_select,
2490 Pov->color_orange, fp);
2491
2492 selection[0] = 14;
2493 selection[1] = 19;
2494 selection[2] = 23;
2495 nb_select = 3;
2496 S->draw_lines_with_selection(selection, nb_select,
2498 fp);
2499
2500 }
2501 else if (round == 4 || round == 5 || round == 6) {
2502
2503 int selection[27];
2504 //int nb_select;
2505
2506 selection[0] = 2;
2507 //nb_select = 1;
2508 S->draw_cubic_with_selection(selection, 1, Pov->color_white, fp);
2509
2510#if 0
2511 selection[0] = 0;
2512 nb_select = 1;
2513 S->draw_planes_with_selection(selection, nb_select,
2514 color_orange, fp);
2515#endif
2516
2517 for (i = 0; i < 27; i++) {
2518 selection[i] = i;
2519 }
2520 //nb_select = 27;
2521 S->draw_lines_with_selection(selection, 6,
2522 Pov->color_red,
2523 fp);
2524 S->draw_lines_with_selection(selection + 6, 6,
2525 Pov->color_blue,
2526 fp);
2527 S->draw_lines_with_selection(selection + 12, 15,
2529 fp);
2530
2531
2532 }
2533 else if (round == 7) {
2534
2535 int selection[27];
2536 int nb_select;
2537
2538 selection[0] = 2;
2539 nb_select = 1;
2540 S->draw_cubic_with_selection(selection, 1, Pov->color_white, fp);
2541
2542 selection[0] = 0;
2543 nb_select = 1;
2544 S->draw_planes_with_selection(selection, nb_select,
2545 Pov->color_orange, fp);
2546
2547 for (i = 0; i < 27; i++) {
2548 selection[i] = i;
2549 }
2550 nb_select = 27;
2551 S->draw_lines_with_selection(selection, 6,
2552 Pov->color_red,
2553 fp);
2554 S->draw_lines_with_selection(selection + 6, 6,
2555 Pov->color_blue,
2556 fp);
2557 S->draw_lines_with_selection(selection + 12, 15,
2559 fp);
2560
2561
2562 selection[0] = 0;
2563 selection[1] = 1;
2564 selection[2] = 2;
2565 nb_select = 3;
2566
2567 S->draw_points_with_selection(selection, 3, 0.12 * 3, Pov->color_chrome, fp);
2568
2569 }
2570 else if (round == 8) {
2571
2572 // yellow lines only:
2573
2574 int selection[27];
2575 //int nb_select;
2576
2577 selection[0] = 2;
2578 //nb_select = 1;
2579 S->draw_cubic_with_selection(selection, 1, Pov->color_white, fp);
2580
2581#if 0
2582 selection[0] = 0;
2583 nb_select = 1;
2584 S->draw_planes_with_selection(selection, nb_select,
2585 color_orange, fp);
2586#endif
2587
2588 for (i = 0; i < 27; i++) {
2589 selection[i] = i;
2590 }
2591 //nb_select = 27 - 12;
2592#if 0
2593 S->draw_lines_with_selection(selection, 6,
2594 color_red,
2595 fp);
2596 S->draw_lines_with_selection(selection + 6, 6,
2597 color_blue,
2598 fp);
2599#endif
2600 S->draw_lines_with_selection(selection + 12, 15,
2602 fp);
2603
2604
2605 }
2606
2607 rotation(h, nb_frames, round, fp);
2608 Pov->union_end(fp, scale_factor, clipping_radius);
2609
2610}
2611
2613 int h, int nb_frames, int round,
2614 double clipping_radius,
2615 ostream &fp,
2616 int verbose_level)
2617{
2618 cout << "animate::draw_frame_E4_surface" << endl;
2619
2620 //double scale_factor;
2621
2622 //scale_factor = Opt->scale_factor;
2623
2624 Pov->union_start(fp);
2625
2626
2627 if (round == 0) {
2628
2629 int s[1];
2630
2631 s[0] = 0;
2633 //S->draw_line_with_selection(0, Pov->color_red, fp);
2634
2635 }
2636 else if (round == 1) {
2637
2638 int s[1];
2639
2640 s[0] = 1;
2643 Pov->color_red,
2644 fp);
2645
2646 }
2647
2648 rotation(h, nb_frames, round, fp);
2649 union_end(
2650 h, nb_frames, round,
2651 clipping_radius,
2652 fp);
2653
2654}
2655
2657 int h, int nb_frames, int round,
2658 double clipping_radius,
2659 ostream &fp,
2660 int verbose_level)
2661{
2662 //double scale_factor;
2663
2664 //scale_factor = Opt->scale_factor;
2665
2666
2667 Pov->union_start(fp);
2668
2669
2670 if (round == 0) {
2671
2672
2674
2676
2677
2678 }
2679 else if (round == 1) {
2680
2681
2683
2684 //draw_Hilbert_cube_faces(S, fp);
2685
2686 {
2687 int s[] = {6,7,8,9};
2688 S->draw_faces_with_selection(s, sizeof(s) / sizeof(int), 0.01, Pov->color_pink, fp);
2689 }
2690
2691 {
2692 int s[] = {12,13,14,15,16,17};
2693
2695
2696 S->draw_edges_with_selection(s, sizeof(s) / sizeof(int), Pov->color_black, fp);
2697 }
2698
2699 }
2700
2701 rotation(h, nb_frames, round, fp);
2702 union_end(
2703 h, nb_frames, round,
2704 clipping_radius,
2705 fp);
2706
2707}
2708
2710 int h, int nb_frames, int round,
2711 double clipping_radius,
2712 ostream &fp,
2713 int verbose_level)
2714{
2715 int i;
2716
2717 cout << "draw_frame_twisted_cubic" << endl;
2718
2719 //double my_clipping_radius;
2720 //double scale_factor;
2721
2722 //my_clipping_radius = Opt->clipping_radius;
2723 //scale_factor = Opt->scale_factor;
2724
2725 Pov->union_start(fp);
2726
2727 for (i = 0; i < Opt->nb_clipping; i++) {
2728 if (Opt->clipping_round[i] == round) {
2729 //my_clipping_radius = Opt->clipping_value[i];
2730 }
2731 }
2732
2733
2734 if (round == 0) {
2735
2736
2737 //draw_Hilbert_cube_boxed(S, fp);
2738
2739 //draw_Hilbert_cube_faces(S, fp);
2740
2741 {
2742 int s[] = {0,1,2,3,4,5,6,7,8,9,10,11};
2744
2746 }
2747 {
2748 int *s;
2749
2750 s = NEW_int(h);
2751 for (i = 1; i < h; i++) {
2752 s[i - 1] = 12 + i - 1;
2753 }
2755
2756 S->draw_edges_with_selection(s, h - 1, Pov->color_red, fp);
2757 FREE_int(s);
2758 }
2759
2760 }
2761 else if (round == 1) {
2762
2763
2764 //draw_Hilbert_cube_boxed(S, fp);
2765
2766 //draw_Hilbert_cube_faces(S, fp);
2767
2768 {
2769 int s[] = {0,1,2,3,4,5,6,7,8,9,10,11};
2771
2773 }
2774 {
2775 int *s;
2776
2777 s = NEW_int(nb_frames);
2778 for (i = 1; i < nb_frames; i++) {
2779 s[i - 1] = 12 + i - 1;
2780 }
2782
2784 FREE_int(s);
2785 }
2786
2787 }
2788
2789 rotation(h, nb_frames, round, fp);
2790 union_end(
2791 h, nb_frames, round,
2792 clipping_radius,
2793 fp);
2794
2795
2796}
2797
2799 int h, int nb_frames, int round,
2800 double clipping_radius,
2801 ostream &fp,
2802 int verbose_level)
2803{
2804 //double d_theta, theta;
2805
2806 // prepare for a curve in polar coordinates
2807 // with theta from 0 to 2 * pi:
2808
2809 //d_theta = 2 * M_PI / nb_frames;
2810
2811 //theta = (double) h * d_theta;
2812
2813 int plane0 = 3;
2814 int line0 = 0;
2815
2816 {
2817 int s[2];
2818 s[0] = plane0 + 0;
2819 s[1] = plane0 + 1;
2821 }
2822
2823 {
2824 int s[1];
2825 s[0] = line0 + 0;
2827 Pov->color_yellow, fp);
2828 }
2829 {
2830 int s[1];
2831 s[0] = line0 + 1;
2833 Pov->color_red, fp);
2834 }
2835 {
2836 int s[1];
2837 s[0] = line0 + 2;
2839 Pov->color_blue, fp);
2840 }
2841 {
2842 int s[1];
2843 s[0] = line0 + 3;
2844 S->draw_lines_with_selection(s, sizeof(s) / sizeof(int),
2845 Pov->color_black, fp);
2846 }
2847 {
2848 int s[] = {0};
2849 S->draw_cubic_with_selection(s, sizeof(s) / sizeof(int),
2850 Pov->color_white, fp);
2851 }
2852
2853
2854 rotation(h, nb_frames, round, fp);
2855 union_end(
2856 h, nb_frames, round,
2857 clipping_radius,
2858 fp);
2859
2860
2861}
2862
2863
2865 int h, int nb_frames, int round,
2866 double clipping_radius,
2867 ostream &fp,
2868 int verbose_level)
2869{
2870 numerics N;
2871 int i;
2872 double d_theta, theta, r, x, y;
2873 double b1[3] = {2/sqrt(6),-1/sqrt(6),-1/sqrt(6)};
2874 double b2[3] = {0,1/sqrt(2),-1/sqrt(2)};
2875 double u[4];
2876
2877 // prepare for a curve in polar coordinates with theta from 0 to 2 * pi:
2878
2879 d_theta = 2 * M_PI / nb_frames;
2880
2881 theta = (double) h * d_theta;
2882
2883 r = 1. + 2. * cos(theta);
2884 // lemacon curve in polar coordinates
2885
2886 // turn into cartesian coordinates:
2887 x = r * cos(theta);
2888 y = r * sin(theta);
2889
2890 // create the vector u as a linear combination
2891 // of the basis vectors b1 and b2:
2892
2893 for (i = 0; i < 3; i++) {
2894 u[i] = x * b1[i] + y * b2[i];
2895 }
2896 u[3] = 1.;
2897
2898 double A[16];
2899 double Av[16];
2900 double varphi[4];
2901
2902 // let varphi be the dual coordinates of the bottom plane
2903 // (which is plane 2)
2904 varphi[0] = S->plane_coords(2, 0);
2905 varphi[1] = S->plane_coords(2, 1);
2906 varphi[2] = S->plane_coords(2, 2);
2907 varphi[3] = S->plane_coords(2, 3);
2908 //N.vec_copy(S->Plane_coords + 2 * 4, varphi, 4);
2909
2910 // change from povray coordinates to homogeneous coordinates in PG(3,q):
2911 varphi[3] *= -1.;
2912
2913 cout << "varphi=" << endl;
2914 N.print_system(varphi, 4, 1);
2915 cout << "u=" << endl;
2916 N.print_system(u, 4, 1);
2917
2918 double lambda = 0.2;
2919 N.vec_scalar_multiple(u, lambda, 4);
2920
2921 // create the transformation matrix A and its inverse Av:
2922
2924 u, A, Av, 0 /* verbose_level */);
2925
2926 cout << "A=" << endl;
2927 N.print_system(A, 4, 4);
2928 cout << "Av=" << endl;
2929 N.print_system(Av, 4, 4);
2930
2931 scene *S1;
2932 double rad = 10.;
2933
2934 S1 = S->transformed_copy(A, Av, rad, verbose_level);
2935 cout << "Original scene:" << endl;
2936 S->print();
2937 cout << "Transformed scene:" << endl;
2938 S1->print();
2939 {
2940 int s[] = {0};
2941 S1->draw_cubic_with_selection(s, sizeof(s) / sizeof(int), Pov->color_white, fp);
2942 }
2943 {
2944 int s[] = {1,7,11}; // bottom plane lines: c14, c25, c36
2945 S1->draw_lines_cij_with_selection(s, sizeof(s) / sizeof(int), fp);
2946 }
2947 {
2948 int s[] = {0,3}; // a1 and a4
2949 S1->draw_lines_ai_with_selection(s, sizeof(s) / sizeof(int), fp);
2950 }
2951 {
2952 int s[] = {2}; // bottom plane
2953 S1->draw_planes_with_selection(s, sizeof(s) / sizeof(int), Pov->color_orange, fp);
2954 }
2955
2956 {
2957 int s[] = {1}; // a2
2958 S1->draw_lines_ai_with_selection(s, sizeof(s) / sizeof(int), fp);
2959 }
2960 {
2961 int s[] = {2,4,5}; // b3, b5, b6
2962 S1->draw_lines_bj_with_selection(s, sizeof(s) / sizeof(int), fp);
2963 }
2964
2965 {
2966 int s[6];
2967
2968 S1->intersect_line_and_plane(0 /* line_idx */, 2 /* plane_idx */, s[0], verbose_level);
2969 S1->intersect_line_and_plane(3 /* line_idx */, 2 /* plane_idx */, s[1], verbose_level);
2970 S1->intersect_line_and_plane(6 + 1 /* line_idx */, 2 /* plane_idx */, s[2], verbose_level);
2971 S1->intersect_line_and_plane(6 + 2 /* line_idx */, 2 /* plane_idx */, s[3], verbose_level);
2972 S1->intersect_line_and_plane(6 + 4 /* line_idx */, 2 /* plane_idx */, s[4], verbose_level);
2973 S1->intersect_line_and_plane(6 + 5 /* line_idx */, 2 /* plane_idx */, s[5], verbose_level);
2974 S1->draw_points_with_selection(s, sizeof(s) / sizeof(int), 0.1, Pov->color_chrome, fp);
2975 }
2976 delete S1;
2977
2978 rotation(h, nb_frames, round, fp);
2979 union_end(
2980 h, nb_frames, round,
2981 clipping_radius,
2982 fp);
2983
2984}
2985
2987 int h, int nb_frames, int round,
2988 ostream &fp)
2989{
2990 if (Opt->f_rotate) {
2991 if (Opt->rotation_axis_type == 1) {
2992 Pov->rotate_111(h, nb_frames, fp);
2993 }
2994 else if (Opt->rotation_axis_type == 2) {
2996 }
2997 else if (Opt->rotation_axis_type == 3) {
2998
2999 double angle_zero_one = 1. - (h * 1. / (double) nb_frames);
3000 // rotate in the opposite direction
3001
3002 double v[3];
3003
3004 v[0]= Opt->rotation_axis_custom[0];
3005 v[1]= Opt->rotation_axis_custom[1];
3006 v[2]= Opt->rotation_axis_custom[2];
3007
3009 v, angle_zero_one, fp);
3010 }
3011
3012 }
3013
3014
3015}
3016
3017
3019 int h, int nb_frames, int round,
3020 double clipping_radius,
3021 ostream &fp)
3022{
3023 double scale;
3024
3026
3027 scale = Opt->global_picture_scale;
3028 }
3029 else {
3030 scale = 1.0;
3031 }
3032
3033 if (Opt->boundary_type == 1) {
3034 Pov->union_end(fp, scale, clipping_radius);
3035 }
3036 else if (Opt->boundary_type == 2) {
3037 Pov->union_end_box_clipping(fp, scale,
3038 clipping_radius, clipping_radius, clipping_radius);
3039 }
3040 else if (Opt->boundary_type == 3) {
3041 Pov->union_end_no_clipping(fp, scale);
3042 }
3043 else {
3044 cout << "animate::union_end boundary_type unrecognized" << endl;
3045 }
3046}
3047
3048
3049void animate::draw_text(std::string &text,
3050 double thickness_half, double extra_spacing,
3051 double scale,
3052 double off_x, double off_y, double off_z,
3053 std::string &color_options,
3054 int idx_point,
3055 //double x, double y, double z,
3056 //double up_x, double up_y, double up_z,
3057 //double view_x, double view_y, double view_z,
3058 ostream &ost, int verbose_level)
3059{
3060 int f_v = (verbose_level >= 1);
3061 double P1[3];
3062 double P2[3];
3063 double P3[3];
3064 double abc3[3];
3065 double angles3[3];
3066 double T3[3];
3067 double u[3];
3068 double view[3];
3069 double up[3];
3070 double x, y, z;
3071
3072
3073 numerics N;
3074 int i;
3075
3076 if (f_v) {
3077 cout << "animate::draw_text" << endl;
3078 }
3079
3080 x = S->point_coords(idx_point, 0);
3081 y = S->point_coords(idx_point, 1);
3082 z = S->point_coords(idx_point, 2);
3083
3084 if (f_v) {
3085 cout << "x,y,z=" << x << ", " << y << " , " << z << endl;
3086 }
3087
3088 for (i = 0; i < 3; i++) {
3089 view[i] = Pov->look_at[i] - Pov->location[i];
3090 }
3091 for (i = 0; i < 3; i++) {
3092 up[i] = Pov->sky[i];
3093 }
3094
3095
3096 if (f_v) {
3097 cout << "view_x,view_y,view_z=" << view[0] << ", "
3098 << view[1] << " , " << view[2] << endl;
3099 }
3100 if (f_v) {
3101 cout << "up_x,up_y,up_z=" << up[0] << ", " << up[1]
3102 << " , " << up[2] << endl;
3103 }
3104 u[0] = view[1] * up[2] - view[2] * up[1];
3105 u[1] = -1 *(view[0] * up[2] - up[0] * view[2]);
3106 u[2] = view[0] * up[1] - up[0] * view[1];
3107 if (f_v) {
3108 cout << "u=" << u[0] << ", " << u[1] << " , " << u[2] << endl;
3109 }
3110 P1[0] = x;
3111 P1[1] = y;
3112 P1[2] = z;
3113 P2[0] = x + u[0];
3114 P2[1] = y + u[1];
3115 P2[2] = z + u[2];
3116 P3[0] = x + up[0];
3117 P3[1] = y + up[1];
3118 P3[2] = z + up[2];
3119
3120 N.triangular_prism(P1, P2, P3,
3121 abc3, angles3, T3,
3122 verbose_level);
3123 double offset[3];
3124 //double up[3];
3125 //double view[3];
3126#if 0
3127 up[0] = up_x;
3128 up[1] = up_y;
3129 up[2] = up_z;
3130 view[0] = view_x;
3131 view[1] = view_y;
3132 view[2] = view_z;
3133#endif
3134 N.make_unit_vector(u, 3);
3135 N.make_unit_vector(up, 3);
3136 N.make_unit_vector(view, 3);
3137 if (f_v) {
3138 cout << "up normalized: ";
3139 N.vec_print(up, 3);
3140 cout << endl;
3141 cout << "u normalized: ";
3142 N.vec_print(u, 3);
3143 cout << endl;
3144 cout << "view normalized: ";
3145 N.vec_print(view, 3);
3146 cout << endl;
3147 }
3148
3149 offset[0] = off_x * u[0] + off_y * up[0] + off_z * view[0];
3150 offset[1] = off_x * u[1] + off_y * up[1] + off_z * view[1];
3151 offset[2] = off_x * u[2] + off_y * up[2] + off_z * view[2];
3152
3153 if (f_v) {
3154 cout << "offset: ";
3155 N.vec_print(offset, 3);
3156 cout << endl;
3157 }
3158
3159 ost << "\ttext {" << endl;
3160 ost << "\t\tttf \"timrom.ttf\", \"" << text << "\", "
3161 << thickness_half << ", " << extra_spacing << " ";
3162 ost << color_options << endl;
3163 ost << "\t\tscale " << scale << endl;
3164 ost << "\t\trotate<0,180,0>" << endl;
3165 ost << "\t\trotate<90,0,0>" << endl;
3166 ost << "\t\trotate<";
3167 N.output_double(N.rad2deg(angles3[0]), ost);
3168 ost << ",0,0>" << endl;
3169 ost << "\t\trotate<0, ";
3170 N.output_double(N.rad2deg(angles3[1]), ost);
3171 ost << ",0>" << endl;
3172 ost << "\t\trotate<0,0, ";
3173 N.output_double(N.rad2deg(angles3[2]), ost);
3174 ost << ">" << endl;
3175 ost << "\t\ttranslate<";
3176 N.output_double(T3[0] + offset[0], ost);
3177 ost << ", ";
3178 N.output_double(T3[1] + offset[1], ost);
3179 ost << ", ";
3180 N.output_double(T3[2] + offset[2], ost);
3181 ost << ">" << endl;
3182 ost << "\t}" << endl;
3183 //pigment { BrightGold }
3184 //finish { reflection .25 specular 1 }
3185 //translate <0,0,0>
3186 if (f_v) {
3187 cout << "animate::draw_text done" << endl;
3188 }
3189}
3190
3191void animate::draw_text_with_selection(int *selection, int nb_select,
3192 double thickness_half, double extra_spacing,
3193 double scale,
3194 double off_x, double off_y, double off_z,
3195 std::string &options, std::string &group_options,
3196 ostream &ost, int verbose_level)
3197{
3198 int i, s;
3199 numerics N;
3200
3201 ost << endl;
3202 //ost << " union{ // labels" << endl;
3203 //ost << endl;
3204 //ost << " #declare r=" << line_radius << "; " << endl;
3205 ost << endl;
3206 for (i = 0; i < nb_select; i++) {
3207 s = selection[i];
3208
3209 int idx_point;
3210 string text;
3211
3212 idx_point = S->Labels[s].first;
3213 text = S->Labels[s].second;
3214
3215
3216 draw_text(text,
3217 thickness_half, extra_spacing,
3218 scale,
3219 off_x, off_y, off_z,
3220 options,
3221 idx_point,
3222 ost, verbose_level);
3223 }
3224 ost << endl;
3225 //ost << " " << group_options << "" << endl;
3226 //ost << " }" << endl;
3227}
3228
3229
3230
3231}}}
3232
3233
3234
3235
a collection of functions related to sorted vectors
functions related to strings and character arrays
void replace_extension_with(char *p, const char *new_ext)
various functions related to geometries
Definition: geometry.h:721
long int AG_element_rank(int q, int *v, int stride, int len)
void draw_text(std::string &text, double thickness_half, double extra_spacing, double scale, double off_x, double off_y, double off_z, std::string &color_options, int idx_point, std::ostream &ost, int verbose_level)
Definition: animate.cpp:3049
void draw_single_surface_with_color(int surface_idx, std::string &color, std::ostream &fp)
Definition: animate.cpp:765
void draw_Hilbert_red_lines(std::ostream &fp)
Definition: animate.cpp:812
void draw_single_quadric(int idx, std::string &color, std::ostream &fp)
Definition: animate.cpp:749
void draw_frame_Hilbert_round_76(video_draw_options *Opt, int h, int nb_frames, int round, std::ostream &fp, int verbose_level)
Definition: animate.cpp:2296
void draw_Hilbert_cube_boxed(std::ostream &fp)
Definition: animate.cpp:839
povray_job_description * Povray_job_description
Definition: graphics.h:31
void draw_text_with_selection(int *selection, int nb_select, double thickness_half, double extra_spacing, double scale, double off_x, double off_y, double off_z, std::string &options, std::string &group_options, std::ostream &ost, int verbose_level)
Definition: animate.cpp:3191
void draw_frame_five_plus_one(int h, int nb_frames, int round, double clipping_radius, std::ostream &fp, int verbose_level)
Definition: animate.cpp:2798
void union_end(int h, int nb_frames, int round, double clipping_radius, std::ostream &fp)
Definition: animate.cpp:3018
void init(povray_job_description *Povray_job_description, void *extra_data, int verbose_level)
Definition: animate.cpp:42
void draw_Hilbert_red_line(int idx_one_based, std::ostream &fp)
Definition: animate.cpp:800
void draw_Hilbert_blue_line(int idx_one_based, std::ostream &fp)
Definition: animate.cpp:806
void draw_single_surface(int surface_idx, std::ostream &fp)
Definition: animate.cpp:757
void draw_frame_Eckardt_surface(int h, int nb_frames, int round, double clipping_radius, std::ostream &fp, int verbose_level)
Definition: animate.cpp:2423
void draw_Hilbert_line(int line_idx, std::string &color, std::ostream &fp)
Definition: animate.cpp:782
void draw_frame_twisted_cubic(int h, int nb_frames, int round, double clipping_radius, std::ostream &fp, int verbose_level)
Definition: animate.cpp:2709
void draw_Hilbert_tetrahedron_faces(std::ostream &fp)
Definition: animate.cpp:857
void draw_frame_triangulation_of_cube(int h, int nb_frames, int round, double clipping_radius, std::ostream &fp, int verbose_level)
Definition: animate.cpp:2656
void draw_frame_windy(int h, int nb_frames, int round, double clipping_radius, std::ostream &fp, int verbose_level)
Definition: animate.cpp:2864
void(* draw_frame_callback)(animate *A, int frame, int nb_frames_this_round, int round, double clipping, std::ostream &fp, int verbose_level)
Definition: graphics.h:38
void draw_Hilbert_tetrahedron_boxed(std::ostream &fp)
Definition: animate.cpp:848
void draw_Hilbert_cube_extended_edges(std::ostream &fp)
Definition: animate.cpp:824
void draw_Hilbert_plane(int plane_idx, std::string &color, std::ostream &fp)
Definition: animate.cpp:792
void draw_Hilbert_cube_faces(std::ostream &fp)
Definition: animate.cpp:833
void draw_Hilbert_blue_lines(std::ostream &fp)
Definition: animate.cpp:818
void draw_Hilbert_point(int point_idx, double rad, std::string &options, std::ostream &fp)
Definition: animate.cpp:773
void draw_frame_Hilbert(int h, int nb_frames, int round, double clipping_radius, std::ostream &fp, int verbose_level)
Definition: animate.cpp:863
void draw_single_line(int line_idx, std::string &color, std::ostream &fp)
Definition: animate.cpp:741
void animate_one_round(int round, int verbose_level)
Definition: animate.cpp:72
void rotation(int h, int nb_frames, int round, std::ostream &fp)
Definition: animate.cpp:2986
void draw_frame_E4_surface(int h, int nb_frames, int round, double clipping_radius, std::ostream &fp, int verbose_level)
Definition: animate.cpp:2612
void union_end(std::ostream &ost, double scale_factor, double clipping_radius)
void rotate_111(int h, int nb_frames, std::ostream &fp)
void beginning(std::ostream &ost, double angle, double *sky, double *location, double *look_at, int f_with_background)
void rotate_around_z_axis(int h, int nb_frames, std::ostream &fp)
void union_end_no_clipping(std::ostream &ost, double scale_factor)
void union_end_box_clipping(std::ostream &ost, double scale_factor, double box_x, double box_y, double box_z)
void animation_rotate_around_origin_and_given_vector_by_a_given_angle(double *v, double angle_zero_one, std::ostream &ost)
a collection of 3D geometry objects
Definition: graphics.h:1152
void draw_lines_cij_with_selection(int *selection, int nb_select, std::ostream &ost)
Definition: scene.cpp:1529
void draw_planes_with_selection(int *selection, int nb_select, std::string &options, std::ostream &ost)
Definition: scene.cpp:1851
void draw_points_with_selection(int *selection, int nb_select, double rad, std::string &options, std::ostream &ost)
Definition: scene.cpp:1910
void draw_quadric_with_selection(int *selection, int nb_select, std::string &options, std::ostream &ost)
Definition: scene.cpp:2092
void draw_lines_ai_with_selection(int *selection, int nb_select, std::ostream &ost)
Definition: scene.cpp:1583
void draw_lines_bj_with_selection(int *selection, int nb_select, std::ostream &ost)
Definition: scene.cpp:1637
int intersect_line_and_plane(int line_idx, int plane_idx, int &intersection_point_idx, int verbose_level)
Definition: scene.cpp:2209
void draw_line_with_selection(int line_idx, std::string &options, std::ostream &ost)
Definition: scene.cpp:1494
std::vector< std::pair< int, std::string > > Labels
Definition: graphics.h:1191
void draw_edges_with_selection(int *selection, int nb_select, std::string &options, std::ostream &ost)
Definition: scene.cpp:1694
void draw_faces_with_selection(int *selection, int nb_select, double thickness_half, std::string &options, std::ostream &ost)
Definition: scene.cpp:1732
scene * transformed_copy(double *A4, double *A4_inv, double rad, int verbose_level)
Definition: scene.cpp:369
void draw_cubic_with_selection(int *selection, int nb_select, std::string &options, std::ostream &ost)
Definition: scene.cpp:1944
void draw_lines_with_selection(int *selection, int nb_select, std::string &options, std::ostream &ost)
Definition: scene.cpp:1457
numerical functions, mostly concerned with double
Definition: globals.h:129
int triangular_prism(double *P1, double *P2, double *P3, double *abc3, double *angles3, double *T3, int verbose_level)
Definition: numerics.cpp:458
void vec_linear_combination3(double c1, double *v1, double c2, double *v2, double c3, double *v3, double *w, int len)
Definition: numerics.cpp:69
void vec_scalar_multiple(double *a, double lambda, int len)
Definition: numerics.cpp:100
void vec_linear_combination1(double c1, double *v1, double *w, int len)
Definition: numerics.cpp:49
void print_system(double *A, int m, int n)
Definition: numerics.cpp:270
void vec_linear_combination(double c1, double *v1, double c2, double *v2, double *v3, int len)
Definition: numerics.cpp:59
void vec_print(double *a, int len)
Definition: numerics.cpp:35
void vec_scan(const char *s, double *&v, int &len)
Definition: numerics.cpp:2218
void make_unit_vector(double *v, int len)
Definition: numerics.cpp:1019
void cross_product(double *u, double *v, double *n)
Definition: numerics.cpp:977
void output_double(double a, std::ostream &ost)
Definition: numerics.cpp:1177
void make_transform_t_varphi_u_double(int n, double *varphi, double *u, double *A, double *Av, int verbose_level)
Definition: numerics.cpp:1722
double dot_product(double *u, double *v, int len)
Definition: numerics.cpp:965
void head_easy_with_extras_in_the_praeamble(std::ostream &ost, const char *extras)
to temporarily override a double variable with a new value
#define FREE_int(p)
Definition: foundations.h:640
#define NEW_OBJECT(type)
Definition: foundations.h:638
#define NEW_int(n)
Definition: foundations.h:625
#define ABS(x)
Definition: foundations.h:220
#define TRUE
Definition: foundations.h:231
#define FALSE
Definition: foundations.h:234
#define EVEN(x)
Definition: foundations.h:221
#define M_PI
Definition: foundations.h:237
#define Int_vec_print(A, B, C)
Definition: foundations.h:685
the orbiter library for the classification of combinatorial objects