Orbiter 2022
Combinatorial Objects
plot_tools.cpp
Go to the documentation of this file.
1// plot_tools.cpp
2//
3// Anton Betten
4// July 18, 2012
5
6#include "foundations.h"
7#include <math.h>
8
9
10using namespace std;
11
12
13namespace orbiter {
14namespace layer1_foundations {
15namespace graphics {
16
18{
19}
20
22{
23
24
25}
26
27
28
30 layered_graph_draw_options *Draw_options,
31 char *prefix, int *the_set, int set_size,
32 int f_title, const char *title, int out_of,
33 const char *label_x,
34 int f_circle, int circle_at, int circle_rad,
35 int f_mu, int f_sigma, int nb_standard_deviations,
36 int f_v_grid, int v_grid, int f_h_grid, int h_grid,
37 int offset_x,
38 int f_switch_x, int no, int f_embedded,
39 int verbose_level)
40{
41 int f_v = (verbose_level >= 1);
42 int f_vv = (verbose_level >= 2);
43 int *set;
44 int factor_1000 = 1000;
45 string fname_full;
46 int i, prev;
47 int *outline_value;
48 int *outline_number;
49 int outline_sz = 0;
51
52
53 if (f_v) {
54 cout << "plot_tools::draw_density" << endl;
55 }
56
57 set = NEW_int(set_size);
58 for (i = 0; i < set_size; i++) {
59 set[i] = the_set[i];
60 }
61
62 if (f_vv) {
63 cout << "plot_tools::draw_density read the "
64 "following " << set_size << " numbers:" << endl;
65 for (i = 0; i < set_size; i++) {
66 cout << the_set[i] << endl;
67 }
68 }
69
70 Sorting.int_vec_heapsort(set, set_size);
71 if (f_vv) {
72 cout << "plot_tools::draw_density after sorting:" << endl;
73 for (i = 0; i < set_size; i++) {
74 cout << set[i] << endl;
75 }
76 }
77
78 outline_value = NEW_int(set_size);
79 outline_number = NEW_int(set_size);
80 outline_sz = 0;
81 prev = set[0];
82 //prev_start = 0;
83 for (i = 1; i <= set_size; i++) {
84 if (i == set_size || set[i] != prev) {
85 outline_value[outline_sz] = prev;
86 outline_number[outline_sz] = i - 1;
87 outline_sz++;
88 prev = set[i];
89 //prev_start = i;
90 }
91 }
92 if (f_vv) {
93 cout << "plot_tools::draw_density outline of size " << outline_sz << ":" << endl;
94 for (i = 0; i < outline_sz; i++) {
95 cout << outline_value[i] << " " << outline_number[i] << endl;
96 }
97 }
98
99 char str[1000];
100
101 fname_full.assign(prefix);
102
103 sprintf(str, "_%d.mp", no);
104
105 fname_full.append(str);
106
107 {
108
109 mp_graphics G;
110
111 G.init(fname_full, Draw_options, verbose_level - 1);
112#if 0
113 mp_graphics G(fname_full,
114 x_min, y_min, x_max, y_max, f_embedded, f_sideways, verbose_level - 1);
115 G.out_xmin() = 0;
116 G.out_ymin() = 0;
117 G.out_xmax() = xmax;
118 G.out_ymax() = ymax;
119 if (f_vv) {
120 cout << "xmax/ymax = " << xmax << " / " << ymax << endl;
121 }
122#endif
123
124 G.header();
125 G.begin_figure(factor_1000);
126
127 G.draw_density2(no,
128 outline_value, outline_number, outline_sz,
129 0, out_of, offset_x, f_switch_x,
130 f_title, title,
131 label_x,
132 f_circle, circle_at, circle_rad,
133 f_mu, f_sigma, nb_standard_deviations,
134 f_v_grid, v_grid, f_h_grid, h_grid);
135
136
137 G.end_figure();
138 G.footer();
139 }
141
142 if (f_v) {
143 cout << "plot_tools::draw_density written file " << fname_full
144 << " of size " << Fio.file_size(fname_full) << endl;
145 }
146 FREE_int(set);
147
148}
149
151 layered_graph_draw_options *Draw_options,
152 std::string &prefix,
153 int **Data, int *Data_size, int nb_data_sets,
154 int f_title, const char *title, int out_of,
155 const char *label_x,
156 int f_v_grid, int v_grid, int f_h_grid, int h_grid,
157 int offset_x, int f_switch_x,
158 int f_v_logarithmic, double log_base, int no, int f_embedded,
159 int verbose_level)
160{
161 int f_v = (verbose_level >= 1);
162 int f_v5 = (verbose_level >= 5);
163 int **Data2;
164 int factor_1000 = 1000;
165 string fname_full;
166 int i, prev;
167 int **outline_value;
168 int **outline_number;
169 int *outline_sz;
170 int curve;
172
173
174 if (f_v) {
175 cout << "plot_tools::draw_density_multiple_curves" << endl;
176 }
177
178 Data2 = NEW_pint(nb_data_sets);
179 for (curve = 0; curve < nb_data_sets; curve++) {
180 Data2[curve] = NEW_int(Data_size[curve]);
181 for (i = 0; i < Data_size[curve]; i++) {
182 Data2[curve][i] = Data[curve][i];
183 }
184 Sorting.int_vec_heapsort(Data2[curve], Data_size[curve]);
185 if (f_v5) {
186 cout << "after sorting:" << endl;
187 for (i = 0; i < Data_size[curve]; i++) {
188 cout << Data2[curve][i] << endl;
189 }
190 }
191 }
192 int max_x;
193
194 max_x = 0;
195 outline_value = NEW_pint(nb_data_sets);
196 outline_number = NEW_pint(nb_data_sets);
197 outline_sz = NEW_int(nb_data_sets);
198 for (curve = 0; curve < nb_data_sets; curve++) {
199 outline_value[curve] = NEW_int(Data_size[curve]);
200 outline_number[curve] = NEW_int(Data_size[curve]);
201 outline_sz[curve] = 0;
202 max_x = MAXIMUM(max_x, Data_size[curve]);
203 prev = Data2[curve][0];
204 //prev_start = 0;
205 for (i = 1; i <= Data_size[curve]; i++) {
206 if (i == Data_size[curve] || Data2[curve][i] != prev) {
207 outline_value[curve][outline_sz[curve]] = prev;
208 outline_number[curve][outline_sz[curve]] = i - 1;
209 outline_sz[curve]++;
210 prev = Data2[curve][i];
211 //prev_start = i;
212 }
213 }
214 if (f_v5) {
215 cout << "plot_tools::draw_density_multiple_curves outline "
216 "of size " << outline_sz[curve] << ":" << endl;
217 for (i = 0; i < outline_sz[curve]; i++) {
218 cout << outline_value[curve][i] << " "
219 << outline_number[curve][i] << endl;
220 }
221
222
223
224
225 }
226 }
227
228 char str[1000];
229
230 fname_full.assign(prefix);
231
232 sprintf(str, "_%d.mp", no);
233
234 fname_full.append(str);
235
236
237 {
238 mp_graphics G;
239
240 G.init(fname_full, Draw_options, verbose_level - 1);
241
242#if 0
243 mp_graphics G(fname_full,
244 x_min, y_min, x_max, y_max, f_embedded, f_sideways, verbose_level - 1);
245 G.out_xmin() = 0;
246 G.out_ymin() = 0;
247 G.out_xmax() = xmax;
248 G.out_ymax() = ymax;
249 if (f_v5) {
250 cout << "xmax/ymax = " << xmax << " / " << ymax << endl;
251 }
252#endif
253
254 G.header();
255 G.begin_figure(factor_1000);
256
258 outline_value, outline_number, outline_sz, nb_data_sets,
259 0, max_x - 1, 0, out_of,
260 offset_x, f_switch_x,
261 f_title, title,
262 label_x,
263 f_v_grid, v_grid, f_h_grid, h_grid,
264 f_v_logarithmic, log_base);
265
266
267 G.end_figure();
268 G.footer();
269 }
271
272 if (f_v) {
273 cout << "plot_tools::draw_density written file " << fname_full
274 << " of size " << Fio.file_size(fname_full) << endl;
275 }
276 for (curve = 0; curve < nb_data_sets; curve++) {
277 FREE_int(Data2[curve]);
278 FREE_int(outline_value[curve]);
279 FREE_int(outline_number[curve]);
280 }
281 FREE_pint(Data2);
282 FREE_pint(outline_value);
283 FREE_pint(outline_number);
284 FREE_int(outline_sz);
285
286}
287
288
289void plot_tools::get_coord(int *Px, int *Py, int idx, int x, int y,
290 int min_x, int min_y, int max_x, int max_y, int f_switch_x)
291{
292 Px[idx] = (int)(1000 * (double)(x - min_x) / (double)(max_x - min_x));
293 if (f_switch_x) {
294 Px[idx] = 1000 - Px[idx];
295 }
296 Py[idx] = (int)(1000 * (double)(y - min_y) / (double)(max_y - min_y));
297}
298
299void plot_tools::get_coord_log(int *Px, int *Py, int idx, int x, int y,
300 int min_x, int min_y, int max_x, int max_y,
301 double log_base, int f_switch_x)
302{
303 Px[idx] = (int)(1000 * (double)(x - min_x) / (double)(max_x - min_x));
304 if (f_switch_x) {
305 Px[idx] = 1000 - Px[idx];
306 }
307 Py[idx] = (int)(1000 * log((double)(y - min_y + 1)) /
308 ((double)log(max_y - min_y + 1)));
309}
310
311
312
313void plot_tools::y_to_pt_on_curve(int y_in, int &x, int &y,
314 int *outline_value, int *outline_number, int outline_sz)
315{
316 int f_v = FALSE;
317 int idx, f_found;
319
320 f_found = Sorting.int_vec_search(outline_value, outline_sz, y_in, idx);
321 if (f_found) {
322 x = outline_number[idx];
323 y = outline_value[idx];
324 if (f_v) {
325 cout << "y-value " << y_in << " found at " << x << endl;
326 }
327 }
328 else {
329 if (f_v) {
330 cout << "y-value " << y_in << " not found" << endl;
331 }
332 x = outline_number[idx];
333 y = outline_value[idx];
334 if (f_v) {
335 cout << "x1=" << x << " y1=" << outline_value[idx] << endl;
336 }
337 if (idx - 1 >= 0) {
338 x = outline_number[idx - 1];
339 if (f_v) {
340 cout << "x2=" << x << " y2=" << outline_value[idx - 1] << endl;
341 }
342 x = outline_number[idx - 1];
343 y = y_in;
344 }
345 else {
346 if (f_v) {
347 cout << "at the bottom" << endl;
348 }
349 }
350 }
351
352}
353
356 int q, int *Table, int nb,
357 int f_point_labels, char **Point_labels,
358 int verbose_level)
359{
360 int f_v = (verbose_level >= 1);
361 int factor_1000 = 1000;
362 string fname_full;
363
364 if (f_v) {
365 cout << "plot_tools::projective_plane_draw_grid" << endl;
366 //cout << "plot_tools::projective_plane_draw_grid xmax=" << xmax << " ymax=" << ymax << endl;
367 }
368
369
370 fname_full.assign(fname);
371 fname_full.append("_draw.mp");
372
373
374 {
375 mp_graphics G;
376
377 G.init(fname_full, O, verbose_level - 1);
378
379#if 0
380 mp_graphics G(fname_full,
381 0, 0,
382 O->xin, O->yin,
383 O->f_embedded, O->f_sideways, verbose_level - 1);
384 G.out_xmin() = 0;
385 G.out_ymin() = 0;
386 G.out_xmax() = O->xout;
387 G.out_ymax() = O->yout;
388 if (f_v) {
389 cout << "plot_tools::projective_plane_draw_grid" << endl;
390 }
391#endif
392
393 G.header();
394 G.begin_figure(factor_1000);
395
396 if (f_v) {
397 cout << "plot_tools::projective_plane_draw_grid "
398 "before projective_plane_draw_grid2" << endl;
399 }
401 q, Table, nb,
402 f_point_labels, Point_labels,
403 verbose_level - 1);
404 if (f_v) {
405 cout << "plot_tools::projective_plane_draw_grid "
406 "after projective_plane_draw_grid2" << endl;
407 }
408
409
410 G.end_figure();
411 G.footer();
412 }
414
415 cout << "written file " << fname_full << " of size "
416 << Fio.file_size(fname_full) << endl;
417 if (f_v) {
418 cout << "plot_tools::projective_plane_draw_grid done" << endl;
419 }
420
421}
422
423
424
427 int verbose_level)
428{
429 int f_v = (verbose_level >= 1);
430 int factor_1000 = 1000;
431 string fname_full;
432
433 if (f_v) {
434 cout << "plot_tools::draw_mod_n" << endl;
435 }
436
437
438
439 if (!Descr->f_file) {
440 cout << "please use -file <fname>" << endl;
441 exit(1);
442 }
443
444 fname_full.assign(Descr->fname);
445 fname_full.append("_draw.mp");
446
447
448 {
449 mp_graphics G;
450
451 G.init(fname_full, O, verbose_level);
452#if 0
453 mp_graphics G(fname_full,
454 0, 0,
455 O->xin, O->yin,
456 O->f_embedded, O->f_sideways, verbose_level - 1);
457 G.out_xmin() = 0;
458 G.out_ymin() = 0;
459 G.out_xmax() = O->xout;
460 G.out_ymax() = O->yout;
461 //cout << "xmax/ymax = " << xmax << " / " << ymax << endl;
462
463 G.tikz_global_scale = O->scale;
464 G.tikz_global_line_width = O->line_width;
465#endif
466
467 G.header();
468 G.begin_figure(factor_1000);
469
470
471
472 if (f_v) {
473 cout << "plot_tools::draw_mod_n "
474 "before draw_mod_n_work" << endl;
475 }
477 O,
478 Descr,
479 verbose_level);
480 if (f_v) {
481 cout << "plot_tools::draw_mod_n "
482 "after projective_plane_draw_grid2" << endl;
483 }
484
485 double move_out = 0.01;
486
487 if (O->f_corners) {
488 G.frame(move_out);
489 }
490
491
492
493 G.end_figure();
494 G.footer();
495 }
497
498 cout << "written file " << fname_full << " of size "
499 << Fio.file_size(fname_full) << endl;
500 if (f_v) {
501 cout << "plot_tools::draw_mod_n done" << endl;
502 }
503
504}
505
506
507
508
512 int verbose_level)
513{
514 int f_v = (verbose_level >= 1);
515 double *Dx, *Dy;
516 int *Px, *Py;
517 double x_stretch = 1.;
518 double y_stretch = 1.;
519 int dx = O->xin * 0.25;
520 int dy = O->yin * 0.25; // stretch factor
521 int N = 1000;
522 int i, j;
523 double start_angle = 0;
524 numerics Num;
525 int f_do_it = FALSE;
526 char str[1000];
527
528
529 int n = Descr->n;
530
531 if (f_v) {
532 cout << "plot_tools::draw_mod_n_work number=" << n << endl;
533 }
534
535
536 G.sl_thickness(100);
537 //G.sf_color(1);
538 //G.sf_interior(10);
539 Px = new int[N];
540 Py = new int[N];
541 Dx = new double[N];
542 Dy = new double[N];
543
544 int M;
545
546 M = 4 * n + 1 + 4;
547
548 for (i = 0; i < n; i++) {
549 Num.on_circle_double(Dx, Dy, i, start_angle + i * 360. / (double) n, 1.0);
550 }
551 for (i = 0; i < n; i++) {
552 Num.on_circle_double(Dx, Dy, n + 1 + i, start_angle + i * 360. / (double) n, 1.2);
553 }
554 for (i = 0; i < n; i++) {
555 Num.on_circle_double(Dx, Dy, 2 * n + 1 + i, start_angle + i * 360. / (double) n, .9);
556 }
557 for (i = 0; i < n; i++) {
558 Num.on_circle_double(Dx, Dy, 3 * n + 1 + i, start_angle + i * 360. / (double) n, 1.1);
559 }
560 Num.on_circle_double(Dx, Dy, n, 0, 0.0);
561 Num.on_circle_double(Dx, Dy, 4 * n + 1 + 0, 0., 1.3);
562 Num.on_circle_double(Dx, Dy, 4 * n + 1 + 1, 90, 1.3);
563 Num.on_circle_double(Dx, Dy, 4 * n + 1 + 2, 180, 1.3);
564 Num.on_circle_double(Dx, Dy, 4 * n + 1 + 3, 270, 1.3);
565
566 for (i = 0; i < n; i++) {
567 cout << "i=" << i << " Dx=" << Dx[i] << " Dy=" << Dy[i] << endl;
568 }
569
570 for (i = 0; i < M; i++) {
571 Px[i] = Dx[i] * dx * x_stretch;
572 Py[i] = Dy[i] * dy * y_stretch;
573 }
574
575 // big circle:
576 G.circle(Px[n], Py[n], (int) dx * x_stretch);
577
578 G.sf_interior(100);
579 G.sf_color(1);
580 for (i = 0; i < n; i++) {
581 cout << "drawing circle " << i << " at " << Px[i] << ", " << Py[i]
582 << " with rad=" << O->rad << endl;
583
584 if (Descr->f_mod_s) {
585 if ((i % Descr->mod_s) == 0) {
586 f_do_it = TRUE;
587 }
588 else {
589 f_do_it = FALSE;
590 }
591 }
592 else {
593 f_do_it = TRUE;
594 }
595
596 if (f_do_it) {
597 G.circle(Px[i], Py[i], O->rad);
598 }
599 }
600
601 for (i = 0; i < n; i++) {
602 if (O->f_nodes_empty) {
603 str[0] = 0;
604 }
605 else {
606
607 if (Descr->f_divide_out_by) {
608 j = i / Descr->divide_out_by;
609 }
610 else {
611 j = i;
612 }
613 sprintf(str, "%d", j);
614 }
615
616 if (Descr->f_mod_s) {
617 if ((i % Descr->mod_s) == 0) {
618 f_do_it = TRUE;
619 }
620 else {
621 f_do_it = FALSE;
622 }
623 }
624 else {
625 f_do_it = TRUE;
626 }
627 if (f_do_it) {
628 G.text(Px[n + 1 + i], Py[n + 1 + i], str);
629 }
630 }
631
632
633 if (Descr->f_inverse) {
634 //finite_field *F;
635 long int a, b, g, u, v;
637
638 //F = NEW_OBJECT(finite_field);
639 //F->init(q);
640
641
642 for (a = 1; a < n; a++) {
643
644 g = NT.gcd_lint(a, n);
645
646 if (g == 1) {
647
648 NT.extended_gcd_lint(a, n, g, u, v);
649 b = u;
650 while (b < 0) {
651 b += n;
652 }
653 b = b % n;
654
655 cout << "inverse of " << a << " mod " << n << " is " << b << endl;
656 //b = F->inverse(a);
657 if (a == b) {
658 G.polygon2(Px, Py, 2 * n + 1 + a, 3 * n + 1 + a);
659 }
660 else {
661 G.polygon2(Px, Py, a, b);
662 }
663 }
664 else {
665 cout << "the element " << a << " does not have an inverse mod " << n << endl;
666 }
667 }
668 //FREE_OBJECT(F);
669 }
670
671 if (Descr->f_additive_inverse) {
672 //finite_field *F;
673 long int a, b; //, g, u, v;
675
676 //F = NEW_OBJECT(finite_field);
677 //F->init(q);
678
679
680 for (a = 0; a < n; a++) {
681
682 b = (n - a) % n;
683
684 //b = F->inverse(a);
685 cout << "negative of " << a << " mod " << n << " is " << b << endl;
686
687 if (a == b) {
688 G.polygon2(Px, Py, 2 * n + 1 + a, 3 * n + 1 + a);
689 }
690 else {
691 G.polygon2(Px, Py, a, b);
692 }
693 }
694 //FREE_OBJECT(F);
695 }
696
697
698 G.polygon2(Px, Py, 4 * n + 1 + 0, 4 * n + 1 + 2);
699 G.polygon2(Px, Py, 4 * n + 1 + 1, 4 * n + 1 + 3);
700
701 if (Descr->f_power_cycle) {
702 //finite_field *F;
703 long int a1, a, b; //, g, u, v;
705
706 cout << "f_power_cycle base = " << Descr->power_cycle_base << endl;
707
708 if (Descr->power_cycle_base == -1) {
709 a1 = NT.primitive_root(n, verbose_level);
710 }
711 else {
712 a1 = Descr->power_cycle_base;
713 }
714
715 cout << "a1= " << a1 << endl;
716 cout << "n= " << n << endl;
717
718 //F = NEW_OBJECT(finite_field);
719 //F->init(q);
720
721
722 a = a1;
723 for (i = 0; ; i++) {
724
725 b = (a * a1) % n;
726
727 //b = F->inverse(a);
728 cout << "a= " << a << " b= " << b << endl;
729
730 G.polygon2(Px, Py, a, b);
731
732 if (b == a1) {
733 break;
734 }
735 a = b;
736 }
737 //FREE_OBJECT(F);
738 }
739
740 if (Descr->f_cyclotomic_sets) {
741
742
744 int *reps;
745 int nb_reps;
746
747 Int_vec_scan(Descr->cyclotomic_sets_reps, reps, nb_reps);
748
749 cout << "cyclotomic sets of ";
750 Int_vec_print(cout, reps, nb_reps);
751 cout << " modulo " << Descr->cyclotomic_sets_q << endl;
752
753 if (Descr->f_cyclotomic_sets_thickness) {
755 }
756 else {
757 G.sl_thickness(110);
758 }
759
760 for (i = 0; i < nb_reps; i++) {
761 std::vector<int> cyclotomic_set;
762 int a, b, h;
763
764 NT.cyclotomic_set(cyclotomic_set, reps[i], Descr->cyclotomic_sets_q, n, verbose_level);
765
766 G.sl_color(3 + i);
767 for (h = 0; h < cyclotomic_set.size(); h++) {
768 a = cyclotomic_set[h];
769 if (h < cyclotomic_set.size() - 1) {
770 b = cyclotomic_set[h + 1];
771 }
772 else {
773 b = cyclotomic_set[0];
774 }
775 G.polygon2(Px, Py, a, b);
776
777 }
778 G.sl_color(0);
779 }
780 G.sl_thickness(100);
781 //cyclotomic_sets_q, std::string &cyclotomic_sets_reps
782
783 }
784
785 #if 0
786 G.sf_interior(0);
787 G.sf_color(0);
788 i = number;
789
790 G.sf_interior(100);
791 G.sf_color(1);
792 for (i = 0; i < number; i++) {
793 G.circle(Px[i], Py[i], rad3);
794 }
795
796#endif
797
798#if 0
799 if (f_plot_curve) {
800 cout << "log(10) = " << log(10) << endl;
801 cout << "log(2.782) = " << log(2.782) << endl;
802
803 G.sl_thickness(100);
804 // draw function
805 step = Delta_x / (double) N;
806 lo = log(0.75); // logarithm base e
807 cout << "lo=" << lo << endl;
808 for (i = 0; i < N; i++) {
809 x = x_min + i * step;
810 y = exp(lo * x);
811 //cout << "i=" << i << " x=" << x << " y=" << y << endl;
812 Px[i] = x * dx;
813 Py[i] = y * dy;
814 }
815 for (i = 0; i < N; i += 5) {
816 if (i < N - 5) {
817 G.polygon6(Px, Py, i + 0, i + 1, i + 2, i + 3, i + 4, i + 5);
818 }
819 else {
820 G.polygon5(Px, Py, i + 0, i + 1, i + 2, i + 3, i + 4);
821 }
822 }
823 }
824
825 if (f_draw_triangles) {
826 // draw triangles
827 for (i = 0; i < (int)x_max; i++) {
828 x1 = (double) i;
829 y1 = exp(lo * x1);
830 x2 = (double) i + 1;
831 y2 = y1;
832 x3 = (double) i + 1;
833 y3 = exp(lo * x3);
834 //cout << "i=" << i << " x=" << x << " y=" << y << endl;
835 Px[0] = x1 * dx;
836 Py[0] = y1 * dy;
837 Px[1] = x2 * dx;
838 Py[1] = y2 * dy;
839 Px[2] = x3 * dx;
840 Py[2] = y3 * dy;
841 G.polygon3(Px, Py, 0, 1, 2);
842 }
843 }
844#endif
845
846}
847
849 std::string &fname,
852 long int *Pts, int nb_pts,
853 int f_point_labels,
854 int verbose_level)
855{
856 int f_v = (verbose_level >= 1);
857 int q, i;
858 int *Table;
859
860 if (f_v) {
861 cout << "plot_tools::draw_point_set_in_plane" << endl;
862 }
863 if (P->n != 2) {
864 cout << "plot_tools::draw_point_set_in_plane n != 2" << endl;
865 exit(1);
866 }
867 q = P->F->q;
868 Table = NEW_int(nb_pts * 3);
869 for (i = 0; i < nb_pts; i++) {
870 P->unrank_point(Table + i * 3, Pts[i]);
871 }
872 if (f_point_labels) {
873 char str[1000];
874 char **Labels;
875
876 Labels = NEW_pchar(nb_pts);
877 for (i = 0; i < nb_pts; i++) {
878 snprintf(str, 1000, "%ld", Pts[i]);
879 Labels[i] = NEW_char(strlen(str) + 1);
880 strcpy(Labels[i], str);
881 }
882 if (f_v) {
883 cout << "plot_tools::draw_point_set_in_plane "
884 "before projective_plane_draw_grid" << endl;
885 }
887 q, Table, nb_pts, TRUE, Labels,
888 verbose_level - 1);
889 if (f_v) {
890 cout << "plot_tools::draw_point_set_in_plane "
891 "after projective_plane_draw_grid" << endl;
892 }
893 for (i = 0; i < nb_pts; i++) {
894 FREE_char(Labels[i]);
895 }
896 FREE_pchar(Labels);
897 }
898 else {
899 if (f_v) {
900 cout << "plot_tools::draw_point_set_in_plane "
901 "before projective_plane_draw_grid" << endl;
902 }
904 q, Table, nb_pts, FALSE, NULL,
905 verbose_level - 1);
906 if (f_v) {
907 cout << "plot_tools::draw_point_set_in_plane "
908 "after projective_plane_draw_grid" << endl;
909 }
910 }
911 FREE_int(Table);
912 if (f_v) {
913 cout << "plot_tools::draw_point_set_in_plane done" << endl;
914 }
915}
916
917
918}}}
919
920
921
922
923
924
a collection of functions related to sorted vectors
int int_vec_search(int *v, int len, int a, int &idx)
Definition: sorting.cpp:1094
projective space PG(n,q) of dimension n over Fq
Definition: geometry.h:1916
options for drawing an object of type layered_graph
Definition: graphics.h:457
a general 2D graphical output interface (metapost, tikz, postscript)
Definition: graphics.h:545
void draw_density2(int no, int *outline_value, int *outline_number, int outline_sz, int min_value, int max_value, int offset_x, int f_switch_x, int f_title, const char *title, const char *label_x, int f_circle, int circle_at, int circle_rad, int f_mu, int f_sigma, int nb_standard_deviations, int f_v_grid, int v_grid, int f_h_grid, int h_grid)
void polygon2(int *Px, int *Py, int i1, int i2)
void polygon6(int *Px, int *Py, int i1, int i2, int i3, int i4, int i5, int i6)
void init(std::string &file_name, layered_graph_draw_options *Draw_options, int verbose_level)
Definition: mp_graphics.cpp:71
void projective_plane_draw_grid2(layered_graph_draw_options *O, int q, int *Table, int nb, int f_point_labels, char **Point_labels, int verbose_level)
void draw_density2_multiple_curves(int no, int **outline_value, int **outline_number, int *outline_sz, int nb_curves, int min_x, int max_x, int min_y, int max_y, int offset_x, int f_switch_x, int f_title, const char *title, const char *label_x, int f_v_grid, int v_grid, int f_h_grid, int h_grid, int f_v_logarithmic, double log_base)
void polygon5(int *Px, int *Py, int i1, int i2, int i3, int i4, int i5)
void polygon3(int *Px, int *Py, int i1, int i2, int i3)
void projective_plane_draw_grid(std::string &fname, layered_graph_draw_options *O, int q, int *Table, int nb, int f_point_labels, char **Point_labels, int verbose_level)
Definition: plot_tools.cpp:354
void draw_mod_n_work(mp_graphics &G, layered_graph_draw_options *O, draw_mod_n_description *Descr, int verbose_level)
Definition: plot_tools.cpp:509
void get_coord(int *Px, int *Py, int idx, int x, int y, int min_x, int min_y, int max_x, int max_y, int f_switch_x)
Definition: plot_tools.cpp:289
void draw_point_set_in_plane(std::string &fname, layered_graph_draw_options *O, geometry::projective_space *P, long int *Pts, int nb_pts, int f_point_labels, int verbose_level)
Definition: plot_tools.cpp:848
void draw_density_multiple_curves(layered_graph_draw_options *Draw_options, std::string &prefix, int **Data, int *Data_size, int nb_data_sets, int f_title, const char *title, int out_of, const char *label_x, int f_v_grid, int v_grid, int f_h_grid, int h_grid, int offset_x, int f_switch_x, int f_v_logarithmic, double log_base, int no, int f_embedded, int verbose_level)
Definition: plot_tools.cpp:150
void draw_mod_n(draw_mod_n_description *Descr, layered_graph_draw_options *O, int verbose_level)
Definition: plot_tools.cpp:425
void get_coord_log(int *Px, int *Py, int idx, int x, int y, int min_x, int min_y, int max_x, int max_y, double log_base, int f_switch_x)
Definition: plot_tools.cpp:299
void y_to_pt_on_curve(int y_in, int &x, int &y, int *outline_value, int *outline_number, int outline_sz)
Definition: plot_tools.cpp:313
void draw_density(layered_graph_draw_options *Draw_options, char *prefix, int *the_set, int set_size, int f_title, const char *title, int out_of, const char *label_x, int f_circle, int circle_at, int circle_rad, int f_mu, int f_sigma, int nb_standard_deviations, int f_v_grid, int v_grid, int f_h_grid, int h_grid, int offset_x, int f_switch_x, int no, int f_embedded, int verbose_level)
Definition: plot_tools.cpp:29
void cyclotomic_set(std::vector< int > &cyclotomic_set, int a, int q, int n, int verbose_level)
void extended_gcd_lint(long int m, long int n, long int &g, long int &u, long int &v)
numerical functions, mostly concerned with double
Definition: globals.h:129
void on_circle_double(double *Px, double *Py, int idx, double angle_in_degree, double rad)
Definition: numerics.cpp:2548
#define Int_vec_scan(A, B, C)
Definition: foundations.h:716
#define NEW_pchar(n)
Definition: foundations.h:635
#define FREE_pchar(p)
Definition: foundations.h:648
#define FREE_int(p)
Definition: foundations.h:640
#define NEW_pint(n)
Definition: foundations.h:627
#define NEW_char(n)
Definition: foundations.h:632
#define NEW_int(n)
Definition: foundations.h:625
#define TRUE
Definition: foundations.h:231
#define FALSE
Definition: foundations.h:234
#define FREE_char(p)
Definition: foundations.h:646
#define FREE_pint(p)
Definition: foundations.h:641
#define Int_vec_print(A, B, C)
Definition: foundations.h:685
#define MAXIMUM(x, y)
Definition: foundations.h:217
the orbiter library for the classification of combinatorial objects