16namespace layer1_foundations {
21static int do_create_points_on_quartic_compute_point_function(
double t,
22 double *pt,
void *extra_data,
int verbose_level);
23static int do_create_points_on_parabola_compute_point_function(
double t,
24 double *pt,
void *extra_data,
int verbose_level);
25static int do_create_points_smooth_curve_compute_point_function(
double t,
26 double *output,
void *extra_data,
int verbose_level);
28static std::vector<int> get_color(
int bit_depth,
int max_value,
int loopCount,
int f_invert_colors,
int verbose_level);
29static void fillBitmap(BMP &image,
int i,
int j, std::vector<int> color);
31static void interface_povray_draw_frame(
32 animate *Anim,
int h,
int nb_frames,
int round,
33 double clipping_radius,
57 int f_v = (verbose_level >= 1);
60 cout <<
"graphical_output::draw_layered_graph_from_file fname=" << fname << endl;
67 cout <<
"graphical_output::draw_layered_graph_from_file file " << fname <<
" does not exist" << endl;
73 cout <<
"graphical_output::draw_layered_graph_from_file Layered graph read from file" << endl;
84 cout <<
"graphical_output::draw_layered_graph_from_file data1=" << data1 << endl;
95 if (Opt->f_numbering_on) {
109 fname_out.assign(fname);
111 fname_out.append(
"_draw");
118 cout <<
"graphical_output::draw_layered_graph_from_file f_paths_in_between" << endl;
120 std::vector<std::vector<int> > All_Paths;
123 cout <<
"graphical_output::draw_layered_graph_from_file before LG->find_all_paths_between" << endl;
129 cout <<
"graphical_output::draw_layered_graph_from_file after LG->find_all_paths_between" << endl;
133 cout <<
"graphical_output::draw_layered_graph_from_file before LG->remove_edges" << endl;
139 cout <<
"graphical_output::draw_layered_graph_from_file after LG->remove_edges" << endl;
147 fname_full.assign(fname_out);
148 fname_full.append(
".mp");
157 cout <<
"graphical_output::draw_layered_graph_from_file "
158 "number of nodes = " << n << endl;
159 cout <<
"graphical_output::draw_layered_graph_from_file "
160 "average word length = " << avg << endl;
165 cout <<
"graphical_output::draw_layered_graph_from_file "
166 "Written file " << fname_full <<
" of size " << Fio.
file_size(fname_full) << endl;
172 cout <<
"graphical_output::draw_layered_graph_from_file done" << endl;
178 int f_v = (verbose_level >= 1);
181 cout <<
"graphical_output::do_create_points_on_quartic" << endl;
184 double amin, amid, amax;
205 do_create_points_on_quartic_compute_point_function,
211 cout <<
"after parametric_curve::init, C1.Pts.size()=" << C1.
Pts.size() << endl;
217 do_create_points_on_quartic_compute_point_function,
223 cout <<
"after parametric_curve::init, C2.Pts.size()=" << C2.
Pts.size() << endl;
226 for (i = 0; i < (int) C1.
Pts.size(); i++) {
227 cout << C1.
Pts[i].t <<
" : " << C1.
Pts[i].coords[0] <<
", " << C1.
Pts[i].coords[1] << endl;
233 nb_pts = 4 * (C1.
Pts.size() + C2.
Pts.size());
234 Pts =
new double[nb_pts * 2];
236 for (i = 0; i < (int) C1.
Pts.size(); i++) {
237 Pts[nb * 2 + 0] = C1.
Pts[i].coords[0];
238 Pts[nb * 2 + 1] = C1.
Pts[i].coords[1];
241 for (i = 0; i < (int) C1.
Pts.size(); i++) {
242 Pts[nb * 2 + 0] = -1 * C1.
Pts[i].coords[0];
243 Pts[nb * 2 + 1] = C1.
Pts[i].coords[1];
246 for (i = 0; i < (int) C1.
Pts.size(); i++) {
247 Pts[nb * 2 + 0] = C1.
Pts[i].coords[0];
248 Pts[nb * 2 + 1] = -1 * C1.
Pts[i].coords[1];
251 for (i = 0; i < (int) C1.
Pts.size(); i++) {
252 Pts[nb * 2 + 0] = -1 * C1.
Pts[i].coords[0];
253 Pts[nb * 2 + 1] = -1 * C1.
Pts[i].coords[1];
256 for (i = 0; i < (int) C2.
Pts.size(); i++) {
257 Pts[nb * 2 + 0] = C2.
Pts[i].coords[0];
258 Pts[nb * 2 + 1] = C2.
Pts[i].coords[1];
261 for (i = 0; i < (int) C2.
Pts.size(); i++) {
262 Pts[nb * 2 + 0] = -1 * C2.
Pts[i].coords[0];
263 Pts[nb * 2 + 1] = C2.
Pts[i].coords[1];
266 for (i = 0; i < (int) C2.
Pts.size(); i++) {
267 Pts[nb * 2 + 0] = C2.
Pts[i].coords[0];
268 Pts[nb * 2 + 1] = -1 * C2.
Pts[i].coords[1];
271 for (i = 0; i < (int) C2.
Pts.size(); i++) {
272 Pts[nb * 2 + 0] = -1 * C2.
Pts[i].coords[0];
273 Pts[nb * 2 + 1] = -1 * C2.
Pts[i].coords[1];
280 fname.assign(
"points.csv");
284 cout <<
"created curve 1 with " << C1.
Pts.size() <<
" many points" << endl;
285 cout <<
"created curve 2 with " << C2.
Pts.size() <<
" many points" << endl;
287 cout <<
"created 4 curves with " << nb <<
" many points" << endl;
292 cout <<
"graphical_output::do_create_points_on_quartic done" << endl;
297 double desired_distance,
int N,
298 double a,
double b,
double c,
301 int f_v = (verbose_level >= 1);
304 cout <<
"graphical_output::do_create_points_on_parabola" << endl;
327 do_create_points_on_parabola_compute_point_function,
333 cout <<
"after parametric_curve::init, C.Pts.size()=" << C.
Pts.size() << endl;
338 for (i = 0; i < (int) C.
Pts.size(); i++) {
339 cout << C.
Pts[i].t <<
" : " << C.
Pts[i].coords[0] <<
", " << C.
Pts[i].coords[1] << endl;
346 nb_pts = C.
Pts.size();
347 Pts =
new double[nb_pts * 2];
349 for (i = 0; i < (int) C.
Pts.size(); i++) {
350 Pts[nb * 2 + 0] = C.
Pts[i].coords[0];
351 Pts[nb * 2 + 1] = C.
Pts[i].coords[1];
358 snprintf(str, 1000,
"parabola_N%d_%lf_%lf_%lf_points.csv", N, a, b, c);
363 cout <<
"created curve 1 with " << C.
Pts.size() <<
" many points" << endl;
364 cout <<
"Written file " << fname <<
" of size " << Fio.
file_size(fname) << endl;
373 nb_pts = C.
Pts.size();
374 Pts =
new double[nb_pts * 6];
376 for (i = 0; i < (int) C.
Pts.size(); i++) {
377 Pts[nb * 6 + 0] = C.
Pts[i].coords[0];
378 Pts[nb * 6 + 1] = C.
Pts[i].coords[1];
379 Pts[nb * 6 + 2] = 0.;
380 Pts[nb * 6 + 3] = 0.;
381 Pts[nb * 6 + 4] = 0.;
382 Pts[nb * 6 + 5] = 1.;
388 snprintf(str, 1000,
"parabola_N%d_%lf_%lf_%lf_projection_from_center.csv", N, a, b, c);
393 cout <<
"created family of lines 1 with " << C.
Pts.size() <<
" many lines" << endl;
394 cout <<
"Written file " << fname <<
" of size " << Fio.
file_size(fname) << endl;
405 nb_pts = C.
Pts.size();
406 Pts =
new double[nb_pts * 6];
408 for (i = 0; i < (int) C.
Pts.size(); i++) {
409 x = C.
Pts[i].coords[0];
410 y = C.
Pts[i].coords[1];
413 Pts[nb * 6 + 2] = 0.;
415 H = sqrt(h * h + x * x + y * y);
418 Pts[nb * 6 + 3] = x * f;
419 Pts[nb * 6 + 4] = y * f;
420 Pts[nb * 6 + 5] = 1. - f;
427 snprintf(str, 1000,
"parabola_N%d_%lf_%lf_%lf_projection_from_sphere.csv", N, a, b, c);
433 cout <<
"created family of lines 1 with " << C.
Pts.size() <<
" many lines" << endl;
434 cout <<
"Written file " << fname <<
" of size " << Fio.
file_size(fname) << endl;
445 nb_pts = C.
Pts.size();
446 Pts =
new double[nb_pts * 3];
448 for (i = 0; i < (int) C.
Pts.size(); i++) {
449 x = C.
Pts[i].coords[0];
450 y = C.
Pts[i].coords[1];
452 H = sqrt(h * h + x * x + y * y);
455 Pts[nb * 3 + 0] = x * f;
456 Pts[nb * 3 + 1] = y * f;
457 Pts[nb * 3 + 2] = 1. - f;
464 snprintf(str, 1000,
"parabola_N%d_%lf_%lf_%lf_points_projected.csv", N, a, b, c);
470 cout <<
"created family of lines 1 with " << C.
Pts.size() <<
" many lines" << endl;
471 cout <<
"Written file " << fname <<
" of size " << Fio.
file_size(fname) << endl;
478 cout <<
"created curve with " << nb <<
" many points" << endl;
483 cout <<
"graphical_output::do_create_points_on_parabola done" << endl;
488 double desired_distance,
int N,
489 double t_min,
double t_max,
double boundary,
492 int f_v = (verbose_level >= 1);
496 cout <<
"graphical_output::do_smooth_curve" << endl;
502 cout <<
"graphical_output::do_smooth_curve before smooth_curve_Polish->init" << endl;
506 cout <<
"graphical_output::do_smooth_curve after smooth_curve_Polish->init" << endl;
510 cout <<
"interface_projective::do_smooth_curve number of variables should be 1, is "
517 cout <<
"graphical_output::do_smooth_curve nb_dimensions = " << nb_dimensions << endl;
524 C.
init(nb_dimensions,
527 do_create_points_smooth_curve_compute_point_function,
533 cout <<
"after parametric_curve::init, C.Pts.size()=" << C.
Pts.size() << endl;
540 nb_pts = C.
Pts.size();
541 Pts =
new double[nb_pts * nb_dimensions];
543 for (i = 0; i < (int) C.
Pts.size(); i++) {
544 if (C.
Pts[i].f_is_valid) {
545 for (j = 0; j < nb_dimensions; j++) {
546 Pts[nb * nb_dimensions + j] = C.
Pts[i].coords[j];
555 snprintf(str, 1000,
"function_%s_N%d_points.csv", curve_label.c_str(), N);
561 cout <<
"created curve 1 with " << C.
Pts.size() <<
" many points" << endl;
562 cout <<
"Written file " << fname <<
" of size " << Fio.
file_size(fname) << endl;
574 nb_pts = C.
Pts.size();
575 n = 1 + nb_dimensions + 1;
576 Pts =
new double[nb_pts * n];
578 for (i = 0; i < (int) C.
Pts.size(); i++) {
579 if (C.
Pts[i].f_is_valid) {
580 Pts[nb * n + 0] = C.
Pts[i].t;
581 for (j = 0; j < nb_dimensions; j++) {
582 Pts[nb * n + 1 + j] = C.
Pts[i].coords[j];
590 Pts[nb * n + 1 + 4 + 0] = d;
598 snprintf(str, 1000,
"function_%s_N%d_points_plus.csv", curve_label.c_str(), N);
603 cout <<
"created curve 1 with " << C.
Pts.size() <<
" many points" << endl;
604 cout <<
"Written file " << fname <<
" of size " << Fio.
file_size(fname) << endl;
612 cout <<
"graphical_output::do_smooth_curve done" << endl;
619static int do_create_points_on_quartic_compute_point_function(
double t,
620 double *pt,
void *extra_data,
int verbose_level)
622 double num, denom, b;
623 double epsilon = 0.00001;
626 denom = 4. - 25. * t * 0.25;
627 if (
ABS(denom) < epsilon) {
640 cout <<
"created point " << pt[0] <<
", " << pt[1] << endl;
644static int do_create_points_on_parabola_compute_point_function(
double t,
645 double *pt,
void *extra_data,
int verbose_level)
647 graphical_output *I = (graphical_output *) extra_data;
648 double a = I->parabola_a;
649 double b = I->parabola_b;
650 double c = I->parabola_c;
653 pt[1] = a * t * t + b * t + c;
659static int do_create_points_smooth_curve_compute_point_function(
double t,
660 double *output,
void *extra_data,
int verbose_level)
662 int f_v = (verbose_level >= 1);
663 graphical_output *I = (graphical_output *) extra_data;
665 double epsilon = 0.0001;
670 cout <<
"do_create_points_smooth_curve_compute_point_function t = " << t << endl;
673 cout <<
"do_create_points_smooth_curve_compute_point_function before evaluate" << endl;
675 input =
new double[I->smooth_curve_Polish->Variables.size()];
677 I->smooth_curve_Polish->evaluate(
683 if (I->smooth_curve_Polish->Entry.size() == 4) {
684 if (
ABS(output[3]) < epsilon) {
688 double av = 1. / output[3];
700 cout <<
"do_create_points_smooth_curve_compute_point_function after evaluate t = " << t << endl;
707 int f_v = (verbose_level >= 1);
710 cout <<
"graphical_output::draw_bitmap" << endl;
731 cout <<
"secondary matrix must have the same size as the primary input matrix" << endl;
735 cout <<
"secondary matrix must have the same size as the primary input matrix" << endl;
746 cout <<
"graphical_output::draw_bitmap drawing matrix of size " << C->
m <<
" x " << C->
n << endl;
749 int *Row_parts = NULL;
750 int nb_row_parts = 0;
751 int *Col_parts = NULL;
752 int nb_col_parts = 0;
760 cout <<
"row_part: ";
763 cout <<
"col_part: ";
772 cout <<
"max_value=" << max_value << endl;
784 fname_out.assign(
"bitmatrix.csv");
796 if (max_value > 10000) {
797 cout <<
"graphical_output::draw_bitmap max_value > 10000" << endl;
800 if (max_value == 0) {
803 for (i = max_value; i >= 0; i--) {
806 cout << i <<
" : " << color[0] <<
"," << color[1] <<
"," << color[2] << endl;
817 cout <<
"width=" << width << endl;
823 image.SetSize(width, height);
835 cout <<
"N100=" << N100 << endl;
847 for (i = 0; i < height; i++) {
851 for (j = 0; j < width; j++, cnt++) {
854 if ((cnt % N100) == 0) {
855 cout <<
"we are at " << ((double) cnt / (
double) N) * 100. <<
" %" << endl;
857 d = C->
M[i * width + j];
869 if (C->
M2[i * width + j] == 0) {
872 if (u < indent || u >= C->
box_width - indent || v < indent || v >= C->
box_width - indent) {
873 fillBitmap(image, J + v, I + u, color_white);
876 fillBitmap(image, J + v, I + u, color);
884 fillBitmap(image, J + v, I + u, color);
892 fillBitmap(image, J + v, I + u, color);
899 fillBitmap(image, j, i, color);
905 cout <<
"drawing the partition" << endl;
912 for (h = 0; h <= nb_row_parts; h++) {
915 for (j = 0; j < width * C->
box_width; j++) {
917 if (h == nb_row_parts) {
918 fillBitmap(image, j, I - 1 - t, color);
921 fillBitmap(image, j, I + t, color);
926 if (h < nb_row_parts) {
933 for (h = 0; h <= nb_col_parts; h++) {
936 for (i = 0; i < height * C->
box_width; i++) {
938 if (h == nb_col_parts) {
939 fillBitmap(image, J - 1 - t, i, color);
942 fillBitmap(image, J + t, i, color);
947 if (h < nb_col_parts) {
953 cout <<
"before writing the image to file as " << fname_out << endl;
955 image.WriteToFile(fname_out.c_str());
957 std::cout <<
"Written file " << fname_out << std::endl;
960 cout <<
"Written file " << fname_out <<
" of size " << Fio.
file_size(fname_out) << endl;
967 cout <<
"graphical_output::draw_bitmap done" << endl;
976 int f_v = (verbose_level >= 1);
979 cout <<
"graphical_output::draw_projective_curve" << endl;
1002 sprintf(str,
"%s_%d_%d", Descr->
fname.c_str(), Descr->
number, i);
1005 G.
init(fname, Opt, verbose_level);
1014 draw_projective(G, Descr->
number, i, Descr->
animate_nb_of_steps,
FALSE, 0, 0,
FALSE, 0,
FALSE, 0);
1026 for (i = 0; i < 4; i++, frame++) {
1032 sprintf(str,
"%s_%d_%d", Descr->
fname.c_str(), Descr->
number, frame);
1035 G.
init(fname, Opt, verbose_level);
1040 draw_projective(G, Descr->
number, 0, Descr->
animate_nb_of_steps,
TRUE, i, Descr->
animate_transition_nb_of_steps,
TRUE, i,
FALSE, 0);
1059 sprintf(str,
"%s_%d_%d", Descr->
fname.c_str(), Descr->
number, frame);
1062 G.
init(fname, Opt, verbose_level);
1071 draw_projective(G, Descr->
number, 0, Descr->
animate_nb_of_steps,
TRUE, i, Descr->
animate_transition_nb_of_steps,
FALSE, 0,
FALSE, 0);
1080 cout <<
"frame " << frame <<
" animate step " << i <<
" / " << Descr->
animate_nb_of_steps <<
":" << endl;
1087 sprintf(str,
"%s_%d_%d", Descr->
fname.c_str(), Descr->
number, frame);
1090 G.
init(fname, Opt, verbose_level);
1099 draw_projective(G, Descr->
number, i, Descr->
animate_nb_of_steps,
FALSE, 0, 0,
FALSE, 0,
FALSE, 0);
1114 sprintf(str,
"%s_%d_%d", Descr->
fname.c_str(), Descr->
number, frame);
1117 G.
init(fname, Opt, verbose_level);
1135 for (i = 0; i <= 7; i++, frame++) {
1141 sprintf(str,
"%s_%d_%d", Descr->
fname.c_str(), Descr->
number, frame);
1144 G.
init(fname, Opt, verbose_level);
1161 cout <<
"frame=" << frame << endl;
1173 int number,
int animate_step,
int animate_nb_of_steps,
1174 int f_transition,
int transition_step,
int transition_nb_steps,
1175 int f_title_page,
int title_page_step,
1176 int f_trailer_page,
int trailer_page_step)
1180 double x_stretch = 1.;
1181 double y_stretch = 1.;
1184 double x_labels_offset = -.5;
1185 double y_labels_offset = -.5;
1186 double x_tick_half_width = 0.1;
1187 double y_tick_half_width = 0.1;
1192 double t_min = -1.13;
1199 int subdivide_v = 4;
1200 int subdivide_h = 4;
1201 int f_plot_grid =
TRUE;
1202 int f_plot_curve =
TRUE;
1210 int f_projection_on =
TRUE;
1211 double radius = 10.;
1216 cout <<
"draw_projective number=" << number <<
" animate_step=" << animate_step <<
" animate_nb_of_steps=" << animate_nb_of_steps << endl;
1218 if (number == 1 || number == 3) {
1227 t_min = -1.119437527;
1235 f_plot_curve =
TRUE;
1236 x_labels_offset = -.5;
1237 y_labels_offset = -.5;
1238 x_tick_half_width = 0.2;
1239 y_tick_half_width = 0.1;
1241 f_plot_curve =
TRUE;
1244 f_projection_on =
TRUE;
1247 else if (number == 2 || number == 4) {
1256 t_min = -1.119437527;
1264 f_plot_curve =
TRUE;
1265 x_labels_offset = -.5;
1266 y_labels_offset = -.5;
1267 x_tick_half_width = 0.2;
1268 y_tick_half_width = 0.1;
1270 f_plot_curve =
TRUE;
1273 f_projection_on =
FALSE;
1276 else if (number == 5) {
1293 f_plot_curve =
TRUE;
1294 x_labels_offset = -.5;
1295 y_labels_offset = -.5;
1296 x_tick_half_width = 0.2;
1297 y_tick_half_width = 0.1;
1299 f_plot_curve =
TRUE;
1302 f_projection_on =
TRUE;
1305 else if (number == 7 || number == 8) {
1322 f_plot_curve =
TRUE;
1323 x_labels_offset = -.5;
1324 y_labels_offset = -.5;
1325 x_tick_half_width = 0.2;
1326 y_tick_half_width = 0.1;
1328 f_plot_curve =
TRUE;
1332 f_projection_on =
FALSE;
1335 f_projection_on =
TRUE;
1341 Delta_t = t_max - t_min;
1352 cout <<
"draw_projective dx=" << dx <<
" dy=" << dy << endl;
1354 double box_x_min = x_min * 1.2;
1355 double box_x_max = x_max * 1.2;
1356 double box_y_min = y_min * 1.2;
1357 double box_y_max = y_max * 1.2;
1368 for (i = 0; i < 4; i++) {
1380 for (i = 0; i < 11; i++) {
1386 for (i = 0; i < 11; i++) {
1393 if (title_page_step == 0) {
1398 if (title_page_step == 1) {
1402 if (title_page_step == 2) {
1407 if (title_page_step == 3) {
1416 if (f_trailer_page) {
1420 for (i = 0; i < 18; i++) {
1426 for (i = 0; i < 18; i++) {
1432 if (trailer_page_step == 0) {
1436 if (trailer_page_step == 1) {
1440 if (trailer_page_step == 2) {
1446 if (trailer_page_step == 3) {
1451 if (trailer_page_step == 4) {
1455 if (trailer_page_step == 5) {
1459 if (trailer_page_step == 6) {
1477 for (x = 0; x < R; x++) {
1479 for (mirror = 0; mirror < 2; mirror++) {
1480 R2 = sqrt(R * R - x * x);
1486 Delta_t = t_max - t_min;
1487 step = Delta_t / (double) N;
1489 for (i = 0; i < N; i++) {
1491 t = t_min + i * step;
1504 if (f_DNE[i] ==
FALSE) {
1507 Num.
project_to_disc(f_projection_on, f_transition, transition_step, transition_nb_steps, radius, height, Dx[i], Dy[i], Dx[i], Dy[i]);
1508 if (Dx[i] < box_x_min || Dx[i] > box_x_max || Dy[i] < box_y_min || Dy[i] > box_y_max) {
1516 for (y = 0; y < R; y++) {
1518 for (mirror = 0; mirror < 2; mirror++) {
1519 R2 = sqrt(R * R - y * y);
1525 Delta_t = t_max - t_min;
1526 step = Delta_t / (double) N;
1528 for (i = 0; i < N; i++) {
1530 t = t_min + i * step;
1543 if (f_DNE[i] ==
FALSE) {
1546 Num.
project_to_disc(f_projection_on, f_transition, transition_step, transition_nb_steps, radius, height, Dx[i], Dy[i], Dx[i], Dy[i]);
1547 if (Dx[i] < box_x_min || Dx[i] > box_x_max || Dy[i] < box_y_min || Dy[i] > box_y_max) {
1567 omega = -1 * animate_step *
M_PI / (2 * animate_nb_of_steps);
1568 cout <<
"animate_step=" << animate_step <<
" omega=" << omega << endl;
1569 double cos_omega, sin_omega;
1571 cos_omega = cos(omega);
1572 sin_omega = sin(omega);
1573 cout <<
"sin_omega=" << sin_omega <<
" cos_omega=" << cos_omega << endl;
1595 double s_min, s_max, s, Delta_s;
1598 for (h = 0; h < 2; h++) {
1599 if (number == 1 || number == 2) {
1602 else if (number == 5) {
1605 else if (number == 7 || number == 8) {
1609 s_min = -1.119437527;
1617 Delta_s = s_max - s_min;
1618 step = Delta_s / (double) N;
1620 cout <<
"Delta_s=" << Delta_s <<
" step=" << step << endl;
1621 cout <<
"draw_projective dx=" << dx <<
" dy=" << dy << endl;
1623 for (i = 0; i < N; i++) {
1628 s = exp(s_min + i * step);
1632 if (f_projection_on) {
1634 s = 10 + exp(s - 10);
1645 if (number == 1 || number == 2) {
1649 else if (number == 3 || number == 4) {
1651 Y = t * t * t + 5 * t + 7;
1659 else if (number == 5) {
1663 denom = x * sin_omega + cos_omega;
1665 if (
ABS(denom) < 0.0000000001) {
1670 X = (x * cos_omega - sin_omega) / denom;
1673 X = (-x * cos_omega - sin_omega) / denom;
1678 else if (number == 7 || number == 8) {
1685 if (
ABS(Y) < 0.0001) {
1695 z = sqrt(X * X + Y * Y);
1705 cout <<
"i=" << i <<
" s=" << s <<
" t=" << t <<
" f_DNE[i]=" << f_DNE[i];
1706 if (f_DNE[i] ==
FALSE) {
1707 cout <<
" X=" << X <<
" Y=" << Y << endl;
1714 if (f_DNE[i] ==
FALSE) {
1720 if (animate_step == 8) {
1721 cout <<
"X=" << X <<
" Y=" << Y << endl;
1724 Num.
project_to_disc(f_projection_on, f_transition, transition_step, transition_nb_steps, radius, height, Dx[i], Dy[i], Dx[i], Dy[i]);
1727 if (Dx[i] < box_x_min || Dx[i] > box_x_max || Dy[i] < box_y_min || Dy[i] > box_y_max) {
1732 if (!f_DNE[i] && isnan(Dx[i])) {
1735 if (!f_DNE[i] && isnan(Dy[i])) {
1738 if (!f_DNE[i] &&
ABS(Dx[i]) < 0.0001) {
1741 if (!f_DNE[i] &&
ABS(Dy[i]) < 0.0001) {
1745 cout << i <<
" : s=" << s <<
" : " <<
" : t=" << t <<
" : ";
1750 cout << Dx[i] <<
", " << Dy[i];
1756 cout <<
"before plot_curve:" << endl;
1757 for (i = 0; i < N; i++) {
1763 cout << Dx[i] <<
", " << Dy[i];
1782std::vector<int> get_color(
int bit_depth,
int max_value,
int loopCount,
int f_invert_colors,
int verbose_level)
1784 int f_v = (verbose_level>= 1);
1787 Black #000000 (0,0,0)
1788 White #FFFFFF (255,255,255)
1789 Red
#FF0000 (255,0,0)
1790 Lime #00FF00 (0,255,0)
1791 Blue
#0000FF (0,0,255)
1792 Yellow #FFFF00 (255,255,0)
1793 Cyan / Aqua
#00FFFF (0,255,255)
1794 Magenta / Fuchsia #FF00FF (255,0,255)
1795 Silver
#C0C0C0 (192,192,192)
1796 Gray #808080 (128,128,128)
1797 Maroon #800000 (128,0,0)
1798 Olive
#808000 (128,128,0)
1799 Green #008000 (0,128,0)
1800 Purple #800080 (128,0,128)
1801 Teal
#008080 (0,128,128)
1802 Navy #000080 (0,0,128)
1824 if (loopCount < 16 && bit_depth == 8) {
1825 r = table[loopCount * 3 + 0];
1826 g = table[loopCount * 3 + 1];
1827 b = table[loopCount * 3 + 2];
1830 double a1, a2, x, y, z;
1833 max_color = (1 << bit_depth) - 1;
1835 if (loopCount > max_value) {
1836 cout <<
"loopCount > max_value" << endl;
1837 cout <<
"loopCount=" << loopCount << endl;
1838 cout <<
"max_value=" << max_value << endl;
1842 if (loopCount < 16) {
1843 r = table[loopCount * 3 + 0];
1844 g = table[loopCount * 3 + 1];
1845 b = table[loopCount * 3 + 2];
1850 a1 = (double) loopCount / (
double) max_value;
1853 if (f_invert_colors) {
1866 cout << loopCount <<
" : " << max_value <<
" : "
1867 << a1 <<
" : " << a2 <<
" : " << x <<
"," << y <<
"," << z <<
" : " << r <<
"," << g <<
"," << b << endl;
1873void fillBitmap(BMP &image,
int i,
int j, std::vector<int> color)
1877 image(i, j)->Red = color[0];
1878 image(i, j)->Green = color[1];
1879 image(i, j)->Blue = color[2];
1884 int f_v = (verbose_level >= 1);
1887 cout <<
"graphical_output::tree_draw" << endl;
1890 if (!Tree_draw_options->
f_file) {
1891 cout <<
"graphical_output::tree_draw please use -file <fname>" << endl;
1898 cout <<
"Trying to read file " << Tree_draw_options->
file_name <<
" of size "
1902 cout <<
"treedraw.out the input file " << Tree_draw_options->
file_name
1903 <<
" does not exist" << endl;
1908 cout <<
"graphical_output::tree_draw reading input file " << Tree_draw_options->
file_name << endl;
1910 T.
init(Tree_draw_options,
1915 cout <<
"graphical_output::tree_draw reading input file " << Tree_draw_options->
file_name <<
" finished" << endl;
1919 if ( f_no_circletext) {
1920 f_circletext =
FALSE;
1926 if (f_count_leaves) {
1933 fname2.assign(Tree_draw_options->
file_name);
1935 fname2.append(
"_draw");
1938 cout <<
"graphical_output::tree_draw before T.draw" << endl;
1945 cout <<
"graphical_output::tree_draw after T.draw" << endl;
1950 cout <<
"treedraw.out drawing as graph" << endl;
1952 xmax, ymax, xmax_out, ymax_out, rad, f_circle, f_circletext,
1953 f_i, f_e,
TRUE, draw_vertex_callback,
1954 f_embedded, f_sideways, f_on_circle,
1955 scale, line_width, verbose_level - 1);
1957 else if (f_placeholder_labels) {
1959 xmax, ymax, xmax_out, ymax_out, rad, f_circle, f_circletext,
1960 f_i, f_e,
TRUE, draw_vertex_callback_placeholders,
1961 f_embedded, f_sideways, f_on_circle,
1962 scale, line_width, verbose_level - 1);
1966 xmax, ymax, xmax_out, ymax_out, rad, f_circle, f_circletext,
1967 f_i, f_e,
TRUE, draw_vertex_callback_standard,
1968 f_embedded, f_sideways, f_on_circle,
1969 scale, line_width, verbose_level - 1);
1973 cout <<
"graphical_output::tree_draw done" << endl;
1986 int f_v = (verbose_level >= 1);
1989 cout <<
"graphical_output::animate_povray" << endl;
1995 A->
init(Povray_job_description,
2018 fpm <<
"all:" << endl;
2020 if (Povray_job_description->
f_rounds) {
2027 cout <<
"Doing the following " << nb_rounds <<
" rounds: ";
2033 for (r = 0; r < nb_rounds; r++) {
2036 this_round = rounds[r];
2038 cout <<
"round " << r <<
" / " << nb_rounds
2039 <<
" is " << this_round << endl;
2050 cout <<
"round " << Povray_job_description->
round << endl;
2054 Povray_job_description->
round,
2074static void interface_povray_draw_frame(
2075 animate *Anim,
int h,
int nb_frames,
int round,
2076 double clipping_radius,
2090 for (i = 0; i < (int) Anim->
S->
Drawables.size(); i++) {
2092 int f_group_is_animated =
FALSE;
2095 cout <<
"drawable " << i <<
":" << endl;
2104 if (j < Anim->S->animated_groups.size()) {
2105 f_group_is_animated =
TRUE;
2108 if (f_group_is_animated) {
2109 cout <<
"is animated" << endl;
2112 cout <<
"is not animated" << endl;
2115 D.
draw(Anim, fp, f_group_is_animated, h, verbose_level);
2123 Anim->
rotation(h, nb_frames, round, fp);
2125 h, nb_frames, round,
int maximum(int *v, int len)
description of a function in reverse polish notation from the command line
a set of functions in reverse polish notation
std::vector< std::string > Variables
void init(function_polish_description *Descr, int verbose_level)
various functions related to geometries
a data structure to store layered graphs or Hasse diagrams
void draw_with_options(std::string &fname, graphics::layered_graph_draw_options *O, int verbose_level)
void find_all_paths_between(int layer1, int node1, int layer2, int node2, std::vector< std::vector< int > > &All_Paths, int verbose_level)
void remove_edges(int layer1, int node1, int layer2, int node2, std::vector< std::vector< int > > &All_Paths, int verbose_level)
void print_nb_nodes_per_level()
void scale_x_coordinates(double x_stretch, int verbose_level)
void create_spanning_tree(int f_place_x, int verbose_level)
double average_word_length()
void place_with_y_stretch(double y_stretch, int verbose_level)
void read_file(std::string &fname, int verbose_level)
creates 3D animations using Povray
char fname_makefile[1000]
void union_end(int h, int nb_frames, int round, double clipping_radius, std::ostream &fp)
void init(povray_job_description *Povray_job_description, void *extra_data, int verbose_level)
void(* draw_frame_callback)(animate *A, int frame, int nb_frames_this_round, int round, double clipping, std::ostream &fp, int verbose_level)
void animate_one_round(int round, int verbose_level)
void rotation(int h, int nb_frames, int round, std::ostream &fp)
options for drawing bitmap files
std::string input_csv_file_name
int f_secondary_input_csv_file
std::string secondary_input_csv_file_name
options for drawing a projective curve
int animate_transition_nb_of_steps
int f_animate_with_transition
a set of objects that should be drawn with certain povray properties
void draw(animate *Anim, std::ostream &ost, int f_group_is_animated, int frame, int verbose_level)
void animate_povray(povray_job_description *Povray_job_description, int verbose_level)
void draw_layered_graph_from_file(std::string &fname, layered_graph_draw_options *Opt, int verbose_level)
void draw_bitmap(draw_bitmap_control *C, int verbose_level)
function_polish * smooth_curve_Polish
void do_create_points_on_parabola(double desired_distance, int N, double a, double b, double c, int verbose_level)
void draw_projective(mp_graphics &G, int number, int animate_step, int animate_nb_of_steps, int f_transition, int transition_step, int transition_nb_steps, int f_title_page, int title_page_step, int f_trailer_page, int trailer_page_step)
void do_create_points_on_quartic(double desired_distance, int verbose_level)
void do_smooth_curve(std::string &curve_label, double desired_distance, int N, double t_min, double t_max, double boundary, function_polish_description *FP_descr, int verbose_level)
void draw_projective_curve(draw_projective_curve_description *Descr, layered_graph_draw_options *Opt, int verbose_level)
void tree_draw(tree_draw_options *Tree_draw_options, int verbose_level)
options for drawing an object of type layered_graph
a general 2D graphical output interface (metapost, tikz, postscript)
void plot_curve(int N, int *f_DNE, double *Dx, double *Dy, double dx, double dy)
void sl_thickness(int line_thickness)
void init(std::string &file_name, layered_graph_draw_options *Draw_options, int verbose_level)
void aligned_text_array(int *Px, int *Py, int idx, const char *alignment, const char *p)
void polygon5(int *Px, int *Py, int i1, int i2, int i3, int i4, int i5)
void finish(std::ostream &ost, int verbose_level)
void sl_color(int line_color)
a continuous curve sampled by individual points
void init(int nb_dimensions, double desired_distance, double t0, double t1, int(*compute_point_function)(double t, double *pt, void *extra_data, int verbose_level), void *extra_data, double boundary, int N, int verbose_level)
std::vector< parametric_curve_point > Pts
void union_start(std::ostream &ost)
description of a povray job
std::string rounds_as_string
std::vector< int > animated_groups
std::vector< drawable_set_of_objects > Drawables
options for drawing a tree
void place_on_circle(int xmax, int ymax, int max_depth)
a data structure for trees
void draw(std::string &fname, graphics::tree_draw_options *Tree_draw_options, layered_graph_draw_options *Opt, int verbose_level)
void init(graphics::tree_draw_options *Tree_draw_options, int xmax, int ymax, int verbose_level)
numerical functions, mostly concerned with double
double distance_euclidean(double *x, double *y, int len)
void project_to_disc(int f_projection_on, int f_transition, int step, int nb_steps, double rad, double height, double x, double y, double &xp, double &yp)
a collection of functions related to file io
void int_matrix_read_csv(std::string &fname, int *&M, int &m, int &n, int verbose_level)
void double_matrix_write_csv(std::string &fname, double *M, int m, int n)
long int file_size(std::string &fname)
void get_vector_from_label(std::string &label, int *&v, int &sz, int verbose_level)
graphics::layered_graph_draw_options * draw_options
data_structures::int_vec * Int_vec
interface to system functions
void time_check(std::ostream &ost, int t0)
#define Int_vec_scan(A, B, C)
#define Int_vec_print(A, B, C)
orbiter_kernel_system::orbiter_session * Orbiter
global Orbiter session
the orbiter library for the classification of combinatorial objects