Orbiter 2022
Combinatorial Objects
surface_object.cpp
Go to the documentation of this file.
1// surface_object.cpp
2//
3// Anton Betten
4// March 18, 2017
5//
6//
7//
8//
9
10#include "foundations.h"
11
12
13using namespace std;
14
15
16
17namespace orbiter {
18namespace layer1_foundations {
19namespace algebraic_geometry {
20
21
22
23
24
26{
27 q = 0;
28 F = NULL;
29 Surf = NULL;
30
31 //int Lines[27];
32 //int eqn[20];
33
34 Pts = NULL;
35 nb_pts = 0;
36
37 Lines = NULL;
38 nb_lines = 0;
39
40 SOP = NULL;
41
42 //null();
43
44
45}
46
48{
49 freeself();
50}
51
53{
54 int verbose_level = 0;
55 int f_v = (verbose_level >= 1);
56
57 if (f_v) {
58 cout << "surface_object::freeself" << endl;
59 }
60 if (Pts) {
62 }
63 if (Lines) {
65 }
66 if (SOP) {
68 }
69
70 if (f_v) {
71 cout << "surface_object::freeself done" << endl;
72 }
73}
74
76{
77}
78
80 int verbose_level)
81{
82 int f_v = (verbose_level >= 1);
83
84 if (f_v) {
85 cout << "surface_object::init_equation_points_and_lines_only" << endl;
86 Int_vec_print(cout, eqn, 20);
87 cout << endl;
88 }
89
91 F = Surf->F;
92 q = F->q;
93
94 //int_vec_copy(Lines, surface_object::Lines, 27);
96
97
98 //long int *Points;
99 //int nb_points;
100 //int nb_lines;
101
102
103 //Points = NEW_lint(Surf->P->N_points /* Surf->nb_pts_on_surface*/);
104 // allocate enough space in case we have a surface with too many points
105
106 if (f_v) {
107 cout << "surface_object::init_equation_points_and_lines_only before enumerate_points_and_lines" << endl;
108 }
109 enumerate_points_and_lines(0/*verbose_level - 1*/);
110 if (f_v) {
111 cout << "surface_object::init_equation_points_and_lines_only after enumerate_points_and_lines" << endl;
112 }
113
114#if 0
115 if (nb_points != Surf->nb_pts_on_surface) {
116 cout << "surface_object::init_equation nb_points != "
117 "Surf->nb_pts_on_surface" << endl;
118 cout << "Surf->nb_pts_on_surface=" << Surf->nb_pts_on_surface << endl;
119 //FREE_lint(Points);
120 Points = NULL;
121 return FALSE;
122 }
123#endif
124 if (f_v) {
125 cout << "surface_object::init_equation_points_and_lines_only done" << endl;
126 }
127}
128
129
131 int verbose_level)
132{
133 int f_v = (verbose_level >= 1);
134
135 if (f_v) {
136 cout << "surface_object::init_equation" << endl;
137 }
138
139 if (f_v) {
140 cout << "surface_object::init_equation before init_equation_points_and_lines_only" << endl;
141 }
143 if (f_v) {
144 cout << "surface_object::init_equation after init_equation_points_and_lines_only" << endl;
145 }
146
147
148 if (nb_lines == 27) {
149 if (f_v) {
150 cout << "surface_object::init_equation before "
151 "find_double_six_and_rearrange_lines" << endl;
152 }
153 find_double_six_and_rearrange_lines(Lines, 0/*verbose_level - 2*/);
154
155 if (f_v) {
156 cout << "surface_object::init_equation after "
157 "find_double_six_and_rearrange_lines" << endl;
158 cout << "surface_object::init_equation Lines:";
159 Lint_vec_print(cout, Lines, 27);
160 cout << endl;
161 }
162 }
163 else {
164 cout << "The surface does not have 27 lines. nb_lines=" << nb_lines
165 << " A double six has not been computed" << endl;
166 }
167
168
169 if (f_v) {
170 cout << "surface_object::init_equation before "
171 "compute_properties" << endl;
172 }
173 compute_properties(0/*verbose_level - 2*/);
174 if (f_v) {
175 cout << "surface_object::init_equation after "
176 "compute_properties" << endl;
177 }
178
179
180
181 if (f_v) {
182 cout << "surface_object::init_equation after "
183 "enumerate_points" << endl;
184 }
185}
186
187
188
189void surface_object::enumerate_points(int verbose_level)
190{
191 int f_v = (verbose_level >= 1);
192
193 if (f_v) {
194 cout << "surface_object::enumerate_points" << endl;
195 }
196
197 vector<long int> Points;
198
199 if (f_v) {
200 cout << "surface_object::enumerate_points before "
201 "Surf->enumerate_points" << endl;
202 }
204 Points,
205 0 /*verbose_level - 1*/);
206 if (f_v) {
207 cout << "surface_object::enumerate_points after "
208 "Surf->enumerate_points" << endl;
209 }
210 if (f_v) {
211 cout << "surface_object::enumerate_points The surface "
212 "has " << Points.size() << " points" << endl;
213 }
214 int i;
215
216 nb_pts = Points.size();
218 for (i = 0; i < nb_pts; i++) {
219 Pts[i] = Points[i];
220 }
221
222
223 if (f_v) {
224 cout << "surface_object::enumerate_points done" << endl;
225 }
226}
227
228
229
231{
232 int f_v = (verbose_level >= 1);
233
234 if (f_v) {
235 cout << "surface_object::enumerate_points_and_lines" << endl;
236 }
237
238 vector<long int> Points;
239 vector<long int> The_Lines;
240
241 if (f_v) {
242 cout << "surface_object::enumerate_points_and_lines before "
243 "Surf->enumerate_points" << endl;
244 }
246 Points,
247 0 /*verbose_level - 1*/);
248 if (f_v) {
249 cout << "surface_object::enumerate_points_and_lines after "
250 "Surf->enumerate_points" << endl;
251 }
252 if (f_v) {
253 cout << "surface_object::enumerate_points_and_lines The surface "
254 "has " << Points.size() << " points" << endl;
255 }
256 int i;
257
258 nb_pts = Points.size();
260 for (i = 0; i < nb_pts; i++) {
261 Pts[i] = Points[i];
262 }
263
264
265 if (f_v) {
266 cout << "surface_object::enumerate_points_and_lines before "
267 "Surf->P->find_lines_which_are_contained" << endl;
268 }
269 Surf->P->find_lines_which_are_contained(Points, The_Lines, 0 /*verbose_level - 1*/);
270 if (f_v) {
271 cout << "surface_object::enumerate_points_and_lines after "
272 "Surf->P->find_lines_which_are_contained" << endl;
273 }
274
275 if (f_v) {
276 cout << "surface_object::enumerate_points_and_lines The surface "
277 "has " << The_Lines.size() << " lines" << endl;
278 }
279#if 0
280 if (nb_lines != 27) {
281 cout << "surface_object::enumerate_points_and_lines the surface "
282 "does not have 27 lines" << endl;
283 //FREE_lint(Points);
284 //Points = NULL;
285 return FALSE;
286 }
287#endif
288
289
290#if 1
291 if (F->q == 2) {
292 if (f_v) {
293 cout << "surface_object::enumerate_points_and_lines before find_real_lines" << endl;
294 }
295
296 find_real_lines(The_Lines, verbose_level);
297
298 if (f_v) {
299 cout << "surface_object::enumerate_points_and_lines after find_real_lines" << endl;
300 }
301 }
302#endif
303
304 nb_lines = The_Lines.size();
306 for (i = 0; i < nb_lines; i++) {
307 Lines[i] = The_Lines[i];
308 }
309
310 if (f_v) {
311 cout << "surface_object::enumerate_points_and_lines nb_pts=" << nb_pts << " nb_lines=" << nb_lines << endl;
312 cout << "Lines:";
314 cout << endl;
315 }
316
317
318
319
320 if (f_v) {
321 cout << "surface_object::enumerate_points_and_lines done" << endl;
322 }
323}
324
325void surface_object::find_real_lines(std::vector<long int> &The_Lines, int verbose_level)
326{
327 int f_v = (verbose_level >= 1);
328 int i, j;
329 long int rk;
330 int M[8];
331 int coeff_out[4];
332
333 if (f_v) {
334 cout << "surface_object::find_real_lines" << endl;
335 }
336 for (i = 0, j = 0; i < The_Lines.size(); i++) {
337 rk = The_Lines[i];
338 Surf->P->Grass_lines->unrank_lint_here(M, rk, 0 /* verbose_level */);
339 if (f_v) {
340 cout << "surface_object::find_real_lines testing line" << endl;
342 }
343
345 eqn /* coeff_in */, coeff_out,
346 M /* Pt1_coeff */, M + 4 /* Pt2_coeff */,
347 verbose_level - 3);
348 // coeff_in[nb_monomials], coeff_out[degree + 1]
349
350 if (f_v) {
351 cout << "surface_object::find_real_lines coeff_out=";
352 Int_vec_print(cout, coeff_out, 4);
353 cout << endl;
354 }
355 if (!orbiter_kernel_system::Orbiter->Int_vec->is_zero(coeff_out, 4)) {
356 if (f_v) {
357 cout << "surface_object::find_real_lines not a real line" << endl;
358 }
359 }
360 else {
361 The_Lines[j] = rk;
362 j++;
363 }
364 }
365 The_Lines.resize(j);
366 if (f_v) {
367 cout << "surface_object::find_real_lines done" << endl;
368 }
369}
370
372 long int *Lines27, int *eqn,
373 int f_find_double_six_and_rearrange_lines,
374 int verbose_level)
375{
376 int f_v = (verbose_level >= 1);
377
378 if (f_v) {
379 cout << "surface_object::init_with_27_lines" << endl;
380 }
382 F = Surf->F;
383 q = F->q;
384
385
386
387 nb_lines = 27;
390
391 if (f_v) {
392 cout << "surface_object::init_with_27_lines Lines:";
394 cout << endl;
395 }
396
397 if (f_find_double_six_and_rearrange_lines) {
398 if (f_v) {
399 cout << "surface_object::init_with_27_lines before "
400 "find_double_six_and_rearrange_lines" << endl;
401 }
403 verbose_level);
404 if (f_v) {
405 cout << "surface_object::init_with_27_lines after "
406 "find_double_six_and_rearrange_lines" << endl;
407 }
408 }
409
410 if (f_v) {
411 cout << "surface_object::init_with_27_lines Lines:";
413 cout << endl;
414 }
415
416
418
419
420 if (f_v) {
421 cout << "surface_object::init_with_27_lines before enumerate_points" << endl;
422 }
423 enumerate_points(verbose_level - 2);
424 if (f_v) {
425 cout << "surface_object::init_with_27_lines after enumerate_points" << endl;
426 }
427
428 if (f_v) {
429 cout << "surface_object::init_with_27_lines before compute_properties" << endl;
430 }
431 compute_properties(verbose_level);
432 if (f_v) {
433 cout << "surface_object::init_with_27_lines after compute_properties" << endl;
434 }
435
436 if (f_v) {
437 cout << "surface_object::init_with_27_lines done" << endl;
438 }
439}
440
442{
443 int f_v = (verbose_level >= 1);
444
445 if (f_v) {
446 cout << "surface_object::compute_properties" << endl;
447 }
448
450
451 SOP->init(this, verbose_level);
452
453 if (f_v) {
454 cout << "surface_object::compute_properties done" << endl;
455 }
456}
457
459{
460 int f_v = (verbose_level >= 1);
461
462 if (f_v) {
463 cout << "surface_object::recompute_properties" << endl;
464 }
465
466 if (SOP) {
468 SOP = NULL;
469 }
470
472
473 SOP->init(this, verbose_level);
474
475 if (f_v) {
476 cout << "surface_object::recompute_properties done" << endl;
477 }
478}
479
480
481
483 long int *Lines,
484 int verbose_level)
485{
486 int f_v = (verbose_level >= 1);
487 long int Lines0[27];
488 long int Lines1[27];
489 long int double_six[12];
490 int *Adj;
491 data_structures::set_of_sets *line_intersections;
492 int *Starter_Table;
493 int nb_starter;
494 int l, line_idx, subset_idx;
495 long int S3[6];
497
498
499
500 if (f_v) {
501 cout << "surface_object::find_double_six_and_rearrange_lines" << endl;
502 }
503 Lint_vec_copy(Lines, Lines0, 27);
504
506 Adj, Lines0, 27, 0 /* verbose_level */);
507
508 line_intersections = NEW_OBJECT(data_structures::set_of_sets);
509
510 line_intersections->init_from_adjacency_matrix(27,
511 Adj, 0 /* verbose_level */);
512
514 line_intersections, Starter_Table, nb_starter, verbose_level);
515
516
517 if (nb_starter != 432) {
518 cout << "surface_object::find_double_six_and_rearrange_lines nb_starter != 432" << endl;
519 exit(1);
520 }
521 l = 0;
522 line_idx = Starter_Table[l * 2 + 0];
523 subset_idx = Starter_Table[l * 2 + 1];
524
526 subset_idx, line_intersections,
527 Lines0, S3,
528 0 /* verbose_level */);
529
530
531
532 if (f_v) {
533 cout << "surface_object::find_double_six_and_rearrange_lines "
534 "before Surf->create_double_six_from_five_lines_with_a_common_transversal" << endl;
535 }
537 S3, double_six, verbose_level)) {
538 cout << "surface_object::find_double_six_and_rearrange_lines "
539 "The starter configuration is bad, there "
540 "is no double six" << endl;
541 exit(1);
542 }
543 if (f_v) {
544 cout << "surface_object::find_double_six_and_rearrange_lines after "
545 "Surf->create_double_six_from_five_lines_with_a_common_transversal" << endl;
546 }
547
548
549 Lint_vec_copy(double_six, Lines1, 12);
550
551 if (f_v) {
552 cout << "surface_object::find_double_six_and_rearrange_lines "
553 "before Surf->create_remaining_fifteen_lines" << endl;
554 }
556 Lines1 + 12, 0 /* verbose_level */);
557 if (f_v) {
558 cout << "surface_object::find_double_six_and_rearrange_lines "
559 "after Surf->create_remaining_fifteen_lines" << endl;
560 }
561
562 Lint_vec_copy(Lines1, Lines, 27);
563 Sorting.lint_vec_heapsort(Lines0, 27);
564 Sorting.lint_vec_heapsort(Lines1, 27);
565
566 int i;
567 for (i = 0; i < 27; i++) {
568 if (Lines0[i] != Lines1[i]) {
569 cout << "surface_object::find_double_six_and_rearrange_lines "
570 "Lines0[i] != Lines1[i]" << endl;
571 exit(1);
572 }
573 }
574
575 FREE_int(Adj);
576 FREE_int(Starter_Table);
577 FREE_OBJECT(line_intersections);
578
579 if (f_v) {
580 cout << "surface_object::find_double_six_and_rearrange_lines done" << endl;
581 }
582}
583
584
585
586
587
588#if 0
589void surface_object::compute_tritangent_planes(int verbose_level)
590{
591 int f_v = (verbose_level >= 1);
592 latex_interface L;
593
594 if (f_v) {
595 cout << "surface_object::compute_tritangent_planes" << endl;
596 }
597
598
599 if (f_v) {
600 cout << "surface_object::compute_tritangent_planes "
601 "before compute_tritangent_planes_slow" << endl;
602 }
603 Surf->compute_tritangent_planes_slow(Lines,
604 Tritangent_planes, nb_tritangent_planes,
605 Unitangent_planes, nb_unitangent_planes,
606 Lines_in_tritangent_plane,
607 Line_in_unitangent_plane,
608 verbose_level);
609
610
611 if (f_v) {
612 cout << "surface_object::compute_tritangent_planes "
613 "Lines_in_tritangent_plane: " << endl;
614 L.print_lint_matrix_with_standard_labels(cout,
615 Lines_in_tritangent_plane, nb_tritangent_planes, 3,
616 FALSE);
617 }
618
619
620 int *Cnt;
621 int i, j, a;
622
623 Cnt = NEW_int(27);
624 int_vec_zero(Cnt, 27);
625 Tritangent_planes_on_lines = NEW_int(27 * 5);
626 for (i = 0; i < nb_tritangent_planes; i++) {
627 for (j = 0; j < 3; j++) {
628 a = Lines_in_tritangent_plane[i * 3 + j];
629 Tritangent_planes_on_lines[a * 5 + Cnt[a]++] = i;
630 }
631 }
632 for (i = 0; i < 27; i++) {
633 if (Cnt[i] != 5) {
634 cout << "surface_object::compute_tritangent_planes "
635 "Cnt[i] != 5" << endl;
636 exit(1);
637 }
638 }
639 FREE_int(Cnt);
640
641
642 Unitangent_planes_on_lines = NEW_int(27 * (q + 1 - 5));
643 Cnt = NEW_int(27);
644 int_vec_zero(Cnt, 27);
645 for (i = 0; i < nb_unitangent_planes; i++) {
646 a = Line_in_unitangent_plane[i];
647 Unitangent_planes_on_lines[a * (q + 1 - 5) + Cnt[a]++] = i;
648 }
649 for (i = 0; i < 27; i++) {
650 if (Cnt[i] != (q + 1 - 5)) {
651 cout << "surface_object::compute_tritangent_planes "
652 "Cnt[i] != (q + 1 - 5)" << endl;
653 exit(1);
654 }
655 }
656 FREE_int(Cnt);
657
658
659 iso_type_of_tritangent_plane = NEW_int(nb_tritangent_planes);
660 for (i = 0; i < nb_tritangent_planes; i++) {
661 long int three_lines[3];
662 for (j = 0; j < 3; j++) {
663 three_lines[j] = Lines[Lines_in_tritangent_plane[i * 3 + j]];
664 }
665 iso_type_of_tritangent_plane[i] =
666 Surf->identify_three_lines(
667 three_lines, 0 /* verbose_level */);
668 }
669
670 Type_iso_tritangent_planes = NEW_OBJECT(tally);
671 Type_iso_tritangent_planes->init(iso_type_of_tritangent_plane,
672 nb_tritangent_planes, FALSE, 0);
673 if (f_v) {
674 cout << "Type iso of tritangent planes: ";
675 Type_iso_tritangent_planes->print_naked(TRUE);
676 cout << endl;
677 }
678
679 Tritangent_plane_to_Eckardt = NEW_int(nb_tritangent_planes);
680 Eckardt_to_Tritangent_plane = NEW_int(nb_tritangent_planes);
681 Tritangent_plane_dual = NEW_int(nb_tritangent_planes);
682 for (i = 0; i < nb_tritangent_planes; i++) {
683 int three_lines[3];
684 for (j = 0; j < 3; j++) {
685 three_lines[j] = Lines_in_tritangent_plane[i * 3 + j];
686 }
687 a = Surf->Eckardt_point_from_tritangent_plane(three_lines);
688 Tritangent_plane_to_Eckardt[i] = a;
689 Eckardt_to_Tritangent_plane[a] = i;
690 }
691 for (i = 0; i < nb_tritangent_planes; i++) {
692 Tritangent_plane_dual[i] =
694 Tritangent_planes[i], 0 /* verbose_level */);
695 }
696
697
698 Trihedral_pairs_as_tritangent_planes = NEW_lint(Surf->nb_trihedral_pairs * 6);
699 for (i = 0; i < Surf->nb_trihedral_pairs; i++) {
700 for (j = 0; j < 6; j++) {
701 a = Surf->Trihedral_to_Eckardt[i * 6 + j];
702 Trihedral_pairs_as_tritangent_planes[i * 6 + j] = Eckardt_to_Tritangent_plane[a];
703 }
704 }
705
706
707 if (f_v) {
708 cout << "surface_object::compute_tritangent_planes done" << endl;
709 }
710}
711#endif
712
713
714#if 0
715void surface_object::print_generalized_quadrangle(ostream &ost)
716{
717 //ost << "\\clearpage" << endl;
718 ost << "\\subsection*{The Generalized Quadrangle}" << endl;
719
720 ost << "The lines in the tritangent planes are:\\\\" << endl;
721 int i, j, a, h;
722
723 //ost << "\\begin{multicols}{1}" << endl;
724 ost << "\\noindent" << endl;
725 for (i = 0; i < nb_tritangent_planes; i++) {
726 j = Eckardt_to_Tritangent_plane[i];
727 a = Tritangent_planes[j];
728 ost << "$\\pi_{" << i << "}";
729 ost << "=\\pi_{" << Surf->Eckard_point_label_tex[i] << "}";
730 ost << " = \\{ \\ell_i \\mid i =";
731 for (h = 0; h < 3; h++) {
732 ost << Lines_in_tritangent_plane[j * 3 + h];
733 if (h < 3 - 1) {
734 ost << ", ";
735 }
736 }
737 ost << "\\}";
738 ost << " = \\{ ";
739 for (h = 0; h < 3; h++) {
740 ost << Surf->Line_label_tex[Lines_in_tritangent_plane[j * 3 + h]];
741 if (h < 3 - 1) {
742 ost << ", ";
743 }
744 }
745 ost << "\\}$" << endl;
746 ost << "\\\\" << endl;
747 }
748 //ost << "\\end{multicols}" << endl;
749
750#if 0
751 ost << "The lines in the tritangent planes in "
752 "Schlaefli's notation are:\\\\" << endl;
753 ost << "\\begin{multicols}{2}" << endl;
754 ost << "\\noindent" << endl;
755 for (i = 0; i < nb_tritangent_planes; i++) {
756 j = Eckardt_to_Tritangent_plane[i];
757 a = Tritangent_planes[j];
758 ost << "$\\pi_{" << i << "} = \\{ ";
759 for (h = 0; h < 3; h++) {
760 ost << Surf->Line_label_tex[
761 Lines_in_tritangent_plane[j * 3 + h]];
762 if (h < 3 - 1) {
763 ost << ", ";
764 }
765 }
766 ost << "\\}$\\\\" << endl;
767 }
768 ost << "\\end{multicols}" << endl;
769#endif
770
771
772#if 0
773 ost << "$$" << endl;
774 print_integer_matrix_with_standard_labels(ost,
775 Lines_in_tritangent_plane, 15, 3,
776 TRUE /* f_tex */);
777 ost << "\\;\\;" << endl;
778 print_integer_matrix_with_standard_labels_and_offset(ost,
779 Lines_in_tritangent_plane + 15 * 3, 15, 3, 15, 0,
780 TRUE /* f_tex */);
781 ost << "\\;\\;" << endl;
782 print_integer_matrix_with_standard_labels_and_offset(ost,
783 Lines_in_tritangent_plane + 30 * 3, 15, 3, 30, 0,
784 TRUE /* f_tex */);
785 ost << "$$" << endl;
786#endif
787
788 ost << "The tritangent planes through the 27 lines are:\\\\" << endl;
789
790 //ost << "\\begin{multicols}{1}" << endl;
791 ost << "\\noindent" << endl;
792 for (i = 0; i < 27; i++) {
793 ost << "$";
794 ost << Surf->Line_label_tex[i];
795 ost << "=\\ell_{" << i << "} \\in \\{ \\pi_i \\mid i = ";
796 for (h = 0; h < 5; h++) {
797 a = Tritangent_planes_on_lines[i * 5 + h];
798 j = Tritangent_plane_to_Eckardt[a];
799 ost << j;
800 if (h < 5 - 1) {
801 ost << ", ";
802 }
803 }
804 ost << "\\}";
805 ost << "=\\{";
806 for (h = 0; h < 5; h++) {
807 a = Tritangent_planes_on_lines[i * 5 + h];
808 j = Tritangent_plane_to_Eckardt[a];
809 ost << "\\pi_{" << Surf->Eckard_point_label_tex[j] << "}";
810 if (h < 5 - 1) {
811 ost << ", ";
812 }
813 }
814 ost << "\\}";
815 ost << "$\\\\" << endl;
816 }
817 //ost << "\\end{multicols}" << endl;
818
819
820#if 0
821 ost << "$$" << endl;
822 print_integer_matrix_with_standard_labels(ost,
823 Tritangent_planes_on_lines, 9, 5, TRUE /* f_tex */);
824 ost << "\\;\\;" << endl;
825 print_integer_matrix_with_standard_labels_and_offset(ost,
826 Tritangent_planes_on_lines + 9 * 5, 9, 5, 9, 0,
827 TRUE /* f_tex */);
828 ost << "\\;\\;" << endl;
829 print_integer_matrix_with_standard_labels_and_offset(ost,
830 Tritangent_planes_on_lines + 18 * 5, 9, 5, 18, 0,
831 TRUE /* f_tex */);
832 ost << "$$" << endl;
833#endif
834
835#if 0
836 ost << "The unitangent planes through the 27 lines are:" << endl;
837 ost << "$$" << endl;
838 print_integer_matrix_with_standard_labels(ost,
839 Unitangent_planes_on_lines, 27, q + 1 - 5,
840 TRUE /* f_tex */);
841 ost << "$$" << endl;
842#endif
843
844}
845#endif
846
847
848
849
850#if 0
851void surface_object::identify_double_six_from_trihedral_pair(
852 int *Lines, int t_idx, int *nine_lines, int *double_sixes,
853 int verbose_level)
854{
855 int f_v = (verbose_level >= 1);
856 int nine_line_idx[9];
857 int i, idx;
858 sorting Sorting;
859
860 if (f_v) {
861 cout << "surface_object::identify_double_six_from_trihedral_pair" << endl;
862 }
863 if (f_v) {
864 cout << "surface_object::identify_double_six_from_trihedral_pair t_idx = " << t_idx << endl;
865 }
866
867 for (i = 0; i < 9; i++) {
868 if (!Sorting.int_vec_search_linear(Lines, 27, nine_lines[i], idx)) {
869 cout << "surface_object::identify_double_six_from_"
870 "trihedral_pair cannot find line" << endl;
871 exit(1);
872 }
873 nine_line_idx[i] = idx;
874 }
875 if (t_idx < 20) {
876 identify_double_six_from_trihedral_pair_type_one(Lines,
877 t_idx, nine_line_idx, double_sixes, verbose_level);
878 }
879 else if (t_idx < 110) {
880 identify_double_six_from_trihedral_pair_type_two(Lines,
881 t_idx, nine_line_idx, double_sixes, verbose_level);
882 }
883 else if (t_idx < 120) {
884 identify_double_six_from_trihedral_pair_type_three(Lines,
885 t_idx, nine_line_idx, double_sixes, verbose_level);
886 }
887 else {
888 cout << "surface_object::identify_double_six_from_"
889 "trihedral_pair t_idx is out of range" << endl;
890 exit(1);
891 }
892 if (f_v) {
893 cout << "surface_object::identify_double_six_from_trihedral_pair done" << endl;
894 }
895}
896
897
898void surface_object::identify_double_six_from_trihedral_pair_type_one(
899 int *Lines, int t_idx, int *nine_line_idx, int *double_sixes,
900 int verbose_level)
901{
902 int f_v = (verbose_level >= 1);
903 int subset[6];
904 int size_complement;
905 int i, j, k, l, m, n;
906 int T[9];
907 int h;
908 combinatorics_domain Combi;
909
910 if (f_v) {
911 cout << "surface_object::identify_double_six_from_trihedral_pair_type_one" << endl;
912 }
913 if (f_v) {
914 cout << "t_idx=" << t_idx << endl;
915 cout << "Lines:" << endl;
916 for (h = 0; h < 27; h++) {
917 cout << h << " : " << Lines[h] << endl;
918 }
919 cout << "nine_line_idx:" << endl;
920 for (h = 0; h < 9; h++) {
921 cout << h << " : " << nine_line_idx[h] << endl;
922 }
923 }
924 Combi.unrank_k_subset(t_idx, subset, 6, 3);
925 Combi.set_complement(subset, 3, subset + 3, size_complement, 6);
926 i = subset[0];
927 j = subset[1];
928 k = subset[2];
929 l = subset[3];
930 m = subset[4];
931 n = subset[5];
932
933 if (f_v) {
934 cout << "i=" << i << " j=" << j << " k=" << k
935 << " l=" << l << " m=" << m << " n=" << n << endl;
936 }
937 T[0] = Surf->line_cij(j, k);
938 T[1] = Surf->line_bi(k);
939 T[2] = Surf->line_ai(j);
940 T[3] = Surf->line_ai(k);
941 T[4] = Surf->line_cij(i, k);
942 T[5] = Surf->line_bi(i);
943 T[6] = Surf->line_bi(j);
944 T[7] = Surf->line_ai(i);
945 T[8] = Surf->line_cij(i, j);
946
947 int new_lines[27];
948
949 int_vec_mone(new_lines, 27);
950
951
952 for (h = 0; h < 9; h++) {
953 new_lines[T[h]] = nine_line_idx[h];
954 }
955
956 int X1[5], X1_len;
957 int X2[5], X2_len;
958
959 find_common_transversals_to_three_disjoint_lines(
960 new_lines[Surf->line_ai(i)],
961 new_lines[Surf->line_ai(j)],
962 new_lines[Surf->line_ai(k)],
963 X1);
964 X1_len = 3;
965
966 if (f_v) {
967 cout << "X1=";
968 int_vec_print(cout, X1, X1_len);
969 cout << endl;
970 }
971
972 int c1, c2, c2b;
973
974 int nb_double_sixes;
975 nb_double_sixes = 0;
976
977
978 for (c1 = 0; c1 < X1_len; c1++) {
979
980 if (f_v) {
981 cout << "c1=" << c1 << " / " << X1_len << endl;
982 }
983
984 // pick b_l according to c1:
985 new_lines[Surf->line_bi(l)] = X1[c1];
986 if (f_v) {
987 cout << "b_l=" << X1[c1] << endl;
988 }
989
990
991 int X4[2];
992 if (c1 == 0) {
993 X4[0] = X1[1];
994 X4[1] = X1[2];
995 }
996 else if (c1 == 1) {
997 X4[0] = X1[0];
998 X4[1] = X1[2];
999 }
1000 else if (c1 == 2) {
1001 X4[0] = X1[0];
1002 X4[1] = X1[1];
1003 }
1004 else {
1005 cout << "c1 is illegal" << endl;
1006 exit(1);
1007 }
1008 if (f_v) {
1009 cout << "X4=";
1010 int_vec_print(cout, X4, 2);
1011 cout << endl;
1012 }
1013
1014
1015
1016 find_common_transversals_to_four_disjoint_lines(
1017 new_lines[Surf->line_bi(i)],
1018 new_lines[Surf->line_bi(j)],
1019 new_lines[Surf->line_bi(k)],
1020 new_lines[Surf->line_bi(l)],
1021 X2);
1022 X2_len = 2;
1023 if (f_v) {
1024 cout << "X2=";
1025 int_vec_print(cout, X2, 2);
1026 cout << endl;
1027 }
1028
1029 for (c2 = 0; c2 < X2_len; c2++) {
1030
1031 if (f_v) {
1032 cout << "c2=" << c2 << " / " << X2_len << endl;
1033 }
1034
1035 // pick a_m according to c2:
1036 new_lines[Surf->line_ai(m)] = X2[c2];
1037 if (f_v) {
1038 cout << "a_m=" << X2[c2] << endl;
1039 }
1040 if (c2 == 0) {
1041 c2b = 1;
1042 }
1043 else {
1044 c2b = 0;
1045 }
1046 new_lines[Surf->line_ai(n)] = X2[c2b];
1047 if (f_v) {
1048 cout << "a_n=" << X2[c2b] << endl;
1049 }
1050
1051 int p_ml, p_il, p_jl, p_kl;
1052 int c_ml, c_il, c_jl, c_kl;
1053
1054 // determine c_ml:
1055 p_ml = find_tritangent_plane_through_two_lines(
1056 new_lines[Surf->line_ai(m)],
1057 new_lines[Surf->line_bi(l)]);
1058 c_ml = find_unique_line_in_plane(p_ml,
1059 new_lines[Surf->line_ai(m)],
1060 new_lines[Surf->line_bi(l)]);
1061 new_lines[Surf->line_cij(m, l)] = c_ml;
1062 if (f_v) {
1063 cout << "c_ml=" << c_ml << endl;
1064 }
1065
1066 // determine c_il:
1067 p_il = find_tritangent_plane_through_two_lines(
1068 new_lines[Surf->line_ai(i)],
1069 new_lines[Surf->line_bi(l)]);
1070 c_il = find_unique_line_in_plane(p_il,
1071 new_lines[Surf->line_ai(i)],
1072 new_lines[Surf->line_bi(l)]);
1073 new_lines[Surf->line_cij(i, l)] = c_il;
1074
1075 // determine c_jl:
1076 p_jl = find_tritangent_plane_through_two_lines(
1077 new_lines[Surf->line_ai(j)],
1078 new_lines[Surf->line_bi(l)]);
1079 c_jl = find_unique_line_in_plane(p_jl,
1080 new_lines[Surf->line_ai(j)],
1081 new_lines[Surf->line_bi(l)]);
1082 new_lines[Surf->line_cij(j, l)] = c_jl;
1083
1084 // determine c_kl:
1085 p_kl = find_tritangent_plane_through_two_lines(
1086 new_lines[Surf->line_ai(k)],
1087 new_lines[Surf->line_bi(l)]);
1088 c_kl = find_unique_line_in_plane(p_kl,
1089 new_lines[Surf->line_ai(k)],
1090 new_lines[Surf->line_bi(l)]);
1091 new_lines[Surf->line_cij(k, l)] = c_kl;
1092
1093 int planes[5];
1094
1095 int_vec_copy(Tritangent_planes_on_lines + c_ml * 5,
1096 planes, 5);
1097 for (h = 0; h < 5; h++) {
1098 if (planes[h] == p_ml) {
1099 continue;
1100 }
1101 if (planes[h] == p_il) {
1102 continue;
1103 }
1104 if (planes[h] == p_jl) {
1105 continue;
1106 }
1107 if (planes[h] == p_kl) {
1108 continue;
1109 }
1110 break;
1111 }
1112 if (h == 5) {
1113 cout << "could not find the plane" << endl;
1114 exit(1);
1115 }
1116
1117 int plane_idx, b_m, b_n, a_l;
1118 int X3[2];
1119
1120 plane_idx = planes[h];
1121 if (f_v) {
1122 cout << "plane_idx=" << plane_idx << endl;
1123 }
1124 find_two_lines_in_plane(plane_idx, c_ml, X3[0], X3[1]);
1125 if (f_v) {
1126 cout << "X3=";
1127 int_vec_print(cout, X3, 2);
1128 cout << endl;
1129 }
1130
1131
1132 if (X4[0] == X3[0]) {
1133 b_m = X4[0];
1134 b_n = X4[1];
1135 a_l = X3[1];
1136 }
1137 else if (X4[0] == X3[1]) {
1138 b_m = X4[0];
1139 b_n = X4[1];
1140 a_l = X3[0];
1141 }
1142 else if (X4[1] == X3[0]) {
1143 b_m = X4[1];
1144 b_n = X4[0];
1145 a_l = X3[1];
1146 }
1147 else if (X4[1] == X3[1]) {
1148 b_m = X4[1];
1149 b_n = X4[0];
1150 a_l = X3[0];
1151 }
1152 else {
1153 cout << "surface_object::identify_double_six_from_"
1154 "trihedral_pair_type_one something is wrong "
1155 "with this choice of c2" << endl;
1156 continue;
1157 //exit(1);
1158 }
1159 new_lines[Surf->line_ai(l)] = a_l;
1160 new_lines[Surf->line_bi(m)] = b_m;
1161 new_lines[Surf->line_bi(n)] = b_n;
1162 if (f_v) {
1163 cout << "a_l=" << a_l << " b_m=" << b_m
1164 << " b_n=" << b_n << endl;
1165 }
1166
1167 for (h = 0; h < 6; h++) {
1168 double_sixes[nb_double_sixes * 12 + h] =
1169 new_lines[Surf->line_ai(h)];
1170 }
1171 for (h = 0; h < 6; h++) {
1172 double_sixes[nb_double_sixes * 12 + 6 + h] =
1173 new_lines[Surf->line_bi(h)];
1174 }
1175
1176 cout << "We found the following double six, "
1177 "nb_double_sixes=" << nb_double_sixes << endl;
1178 for (h = 0; h < 6; h++) {
1179 cout << setw(2) << new_lines[Surf->line_ai(h)];
1180 if (h < 6 - 1) {
1181 cout << ", ";
1182 }
1183 }
1184 cout << endl;
1185 for (h = 0; h < 6; h++) {
1186 cout << setw(2) << new_lines[Surf->line_bi(h)];
1187 if (h < 6 - 1) {
1188 cout << ", ";
1189 }
1190 }
1191 cout << endl;
1192
1193 nb_double_sixes++;
1194 } // next c2
1195
1196 } // next c1
1197
1198 if (f_v) {
1199 cout << "surface_object::identify_double_six_from_trihedral_pair_type_one done" << endl;
1200 }
1201}
1202
1203void surface_object::identify_double_six_from_trihedral_pair_type_two(
1204 int *Lines, int t_idx, int *nine_line_idx,
1205 int *double_sixes, int verbose_level)
1206{
1207 int f_v = (verbose_level >= 1);
1208 int idx, rk_h, rk_s;
1209 int subset[6];
1210 int second_subset[6];
1211 int complement[6];
1212 int size_complement;
1213 int l, m, n, p;
1214 int c1, c2;
1215 combinatorics_domain Combi;
1216 sorting Sorting;
1217
1218 if (f_v) {
1219 cout << "surface_object::identify_double_six_from_trihedral_pair_type_two" << endl;
1220 }
1221
1222 idx = t_idx - 20;
1223 rk_h = idx / 6;
1224 rk_s = idx % 6;
1225
1226 Combi.unrank_k_subset(rk_h, subset, 6, 4);
1227 Combi.unrank_k_subset(rk_s, second_subset, 4, 2);
1228 Combi.set_complement(second_subset, 2, complement, size_complement, 4);
1229 l = subset[second_subset[0]];
1230 m = subset[second_subset[1]];
1231 n = subset[complement[0]];
1232 p = subset[complement[1]];
1233
1234
1235 int subset2[4];
1236 int complement2[2];
1237 int r, s;
1238 int T[9];
1239
1240 subset2[0] = l;
1241 subset2[1] = m;
1242 subset2[2] = n;
1243 subset2[3] = p;
1244 Sorting.int_vec_heapsort(subset2, 4);
1245 Combi.set_complement(subset2, 4, complement2, size_complement, 6);
1246 r = complement2[0];
1247 s = complement2[1];
1248 if (f_v) {
1249 cout << "l=" << l << " m=" << m << " n=" << n
1250 << " p=" << p << " r=" << r << " s=" << s << endl;
1251 }
1252
1253 T[0] = Surf->line_ai(l);
1254 T[1] = Surf->line_bi(p);
1255 T[2] = Surf->line_cij(l, p);
1256 T[3] = Surf->line_bi(n);
1257 T[4] = Surf->line_ai(m);
1258 T[5] = Surf->line_cij(m, n);
1259 T[6] = Surf->line_cij(l, n);
1260 T[7] = Surf->line_cij(m, p);
1261 T[8] = Surf->line_cij(r, s);
1262
1263 int new_lines[27];
1264
1265 int_vec_mone(new_lines, 27);
1266
1267 int i, pi, a, line;
1268
1269 for (i = 0; i < 9; i++) {
1270 new_lines[T[i]] = nine_line_idx[i];
1271 }
1272
1273
1274 int X1[5], X1_len;
1275 int X2[6], X2_len;
1276 int X3[5], X3_len;
1277 int X4[6], X4_len;
1278 int X5[6], X5_len;
1279 int X6[27]; //, X6_len;
1280
1281 get_planes_through_line(new_lines, Surf->line_cij(l, n), X1);
1282 X1_len = 5;
1283 if (f_v) {
1284 cout << "X1=";
1285 int_vec_print(cout, X1, X1_len);
1286 cout << endl;
1287 }
1288 int_vec_delete_element_assume_sorted(X1, X1_len,
1289 find_tritangent_plane_through_two_lines(
1290 new_lines[Surf->line_ai(l)],
1291 new_lines[Surf->line_bi(n)]));
1292 int_vec_delete_element_assume_sorted(X1, X1_len,
1293 find_tritangent_plane_through_two_lines(
1294 new_lines[Surf->line_cij(n, l)],
1295 new_lines[Surf->line_cij(p, m)]));
1296 if (f_v) {
1297 cout << "X1=";
1298 int_vec_print(cout, X1, X1_len);
1299 cout << endl;
1300 }
1301 for (i = 0; i < 3; i++) {
1302 pi = X1[i];
1303 find_two_lines_in_plane(pi,
1304 new_lines[Surf->line_cij(l, n)],
1305 X2[2 * i + 0],
1306 X2[2 * i + 1]);
1307 }
1308 X2_len = 6;
1309 if (f_v) {
1310 cout << "X2=";
1311 int_vec_print(cout, X2, X2_len);
1312 cout << endl;
1313 }
1314
1315 get_planes_through_line(new_lines, Surf->line_cij(m, n), X3);
1316 X3_len = 5;
1317 if (f_v) {
1318 cout << "X3=";
1319 int_vec_print(cout, X3, X3_len);
1320 cout << endl;
1321 }
1322 int_vec_delete_element_assume_sorted(X3, X3_len,
1323 find_tritangent_plane_through_two_lines(
1324 new_lines[Surf->line_ai(m)],
1325 new_lines[Surf->line_bi(n)]));
1326 int_vec_delete_element_assume_sorted(X3, X3_len,
1327 find_tritangent_plane_through_two_lines(
1328 new_lines[Surf->line_cij(p, l)],
1329 new_lines[Surf->line_cij(n, m)]));
1330 if (f_v) {
1331 cout << "X3=";
1332 int_vec_print(cout, X3, X3_len);
1333 cout << endl;
1334 }
1335 for (i = 0; i < 3; i++) {
1336 pi = X3[i];
1337 find_two_lines_in_plane(pi,
1338 new_lines[Surf->line_cij(m, n)],
1339 X4[2 * i + 0],
1340 X4[2 * i + 1]);
1341 }
1342 X4_len = 6;
1343 if (f_v) {
1344 cout << "X4=";
1345 int_vec_print(cout, X4, X4_len);
1346 cout << endl;
1347 }
1348 X5_len = 0;
1349 Sorting.int_vec_heapsort(X2, X2_len);
1350 Sorting.int_vec_heapsort(X4, X4_len);
1351 for (i = 0; i < X2_len; i++) {
1352 a = X2[i];
1353 if (Sorting.int_vec_search(X4, X4_len, a, idx)) {
1354 X5[X5_len++] = a;
1355 }
1356 }
1357 if (f_v) {
1358 cout << "found a set X5 of size " << X5_len << " : ";
1359 int_vec_print(cout, X5, X5_len);
1360 cout << endl;
1361 }
1362 if (X5_len != 3) {
1363 cout << "X5_len != 3" << endl;
1364 exit(1);
1365 }
1366
1367 int nb_double_sixes;
1368 nb_double_sixes = 0;
1369
1370
1371 for (c1 = 0; c1 < X5_len; c1++) {
1372
1373 if (f_v) {
1374 cout << "c1=" << c1 << " / " << X5_len << endl;
1375 }
1376
1377 // pick a_n according to c1:
1378 new_lines[Surf->line_ai(n)] = X5[c1];
1379
1380 // determine b_l:
1381 pi = find_tritangent_plane_through_two_lines(
1382 new_lines[Surf->line_ai(n)],
1383 new_lines[Surf->line_cij(l, n)]);
1384 line = find_unique_line_in_plane(pi,
1385 new_lines[Surf->line_ai(n)],
1386 new_lines[Surf->line_cij(l, n)]);
1387 new_lines[Surf->line_bi(l)] = line;
1388
1389 // determine b_m:
1390 pi = find_tritangent_plane_through_two_lines(
1391 new_lines[Surf->line_ai(n)],
1392 new_lines[Surf->line_cij(m, n)]);
1393 line = find_unique_line_in_plane(pi,
1394 new_lines[Surf->line_ai(n)],
1395 new_lines[Surf->line_cij(m, n)]);
1396 new_lines[Surf->line_bi(m)] = line;
1397
1398 // determine a_p:
1399 pi = find_tritangent_plane_through_two_lines(
1400 new_lines[Surf->line_bi(m)],
1401 new_lines[Surf->line_cij(m, p)]);
1402 line = find_unique_line_in_plane(pi,
1403 new_lines[Surf->line_bi(m)],
1404 new_lines[Surf->line_cij(m, p)]);
1405 new_lines[Surf->line_ai(p)] = line;
1406
1407 find_common_transversals_to_four_disjoint_lines(
1408 new_lines[Surf->line_ai(l)],
1409 new_lines[Surf->line_ai(m)],
1410 new_lines[Surf->line_ai(n)],
1411 new_lines[Surf->line_ai(p)], X6);
1412 //X6_len = 2;
1413
1414 for (c2 = 0; c2 < 2; c2++) {
1415
1416 if (f_v) {
1417 cout << "c2=" << c2 << " / " << 2 << endl;
1418 }
1419
1420 // pick b_r according to c2:
1421
1422 new_lines[Surf->line_bi(r)] = X6[c2];
1423 if (c2 == 0) {
1424 new_lines[Surf->line_bi(s)] = X6[1];
1425 }
1426 else {
1427 new_lines[Surf->line_bi(s)] = X6[0];
1428 }
1429
1430 // determine c_nr:
1431 pi = find_tritangent_plane_through_two_lines(
1432 new_lines[Surf->line_ai(n)],
1433 new_lines[Surf->line_bi(r)]);
1434 line = find_unique_line_in_plane(pi,
1435 new_lines[Surf->line_ai(n)],
1436 new_lines[Surf->line_bi(r)]);
1437 new_lines[Surf->line_cij(n, r)] = line;
1438
1439 // determine a_r:
1440 pi = find_tritangent_plane_through_two_lines(
1441 new_lines[Surf->line_bi(n)],
1442 new_lines[Surf->line_cij(n, r)]);
1443 line = find_unique_line_in_plane(pi,
1444 new_lines[Surf->line_bi(n)],
1445 new_lines[Surf->line_cij(n, r)]);
1446 new_lines[Surf->line_ai(r)] = line;
1447
1448 // determine c_ns:
1449 pi = find_tritangent_plane_through_two_lines(
1450 new_lines[Surf->line_ai(n)],
1451 new_lines[Surf->line_bi(s)]);
1452 line = find_unique_line_in_plane(pi,
1453 new_lines[Surf->line_ai(n)],
1454 new_lines[Surf->line_bi(s)]);
1455 new_lines[Surf->line_cij(n, s)] = line;
1456
1457 // determine a_s:
1458 pi = find_tritangent_plane_through_two_lines(
1459 new_lines[Surf->line_bi(n)],
1460 new_lines[Surf->line_cij(n, s)]);
1461 line = find_unique_line_in_plane(pi,
1462 new_lines[Surf->line_bi(n)],
1463 new_lines[Surf->line_cij(n, s)]);
1464 new_lines[Surf->line_ai(s)] = line;
1465
1466 for (i = 0; i < 6; i++) {
1467 double_sixes[nb_double_sixes * 12 + i] =
1468 new_lines[Surf->line_ai(i)];
1469 }
1470 for (i = 0; i < 6; i++) {
1471 double_sixes[nb_double_sixes * 12 + 6 + i] =
1472 new_lines[Surf->line_bi(i)];
1473 }
1474
1475 cout << "We found the following double six, "
1476 "nb_double_sixes=" << nb_double_sixes << endl;
1477 for (i = 0; i < 6; i++) {
1478 cout << setw(2) << new_lines[Surf->line_ai(i)];
1479 if (i < 6 - 1) {
1480 cout << ", ";
1481 }
1482 }
1483 cout << endl;
1484 for (i = 0; i < 6; i++) {
1485 cout << setw(2) << new_lines[Surf->line_bi(i)];
1486 if (i < 6 - 1) {
1487 cout << ", ";
1488 }
1489 }
1490 cout << endl;
1491
1492 nb_double_sixes++;
1493
1494 } // next c2
1495
1496 } // next c1
1497
1498 if (nb_double_sixes != 6) {
1499 cout << "surface_object::identify_double_six_from_"
1500 "trihedral_pair_type_two nb_double_sixes != 6" << endl;
1501 exit(1);
1502 }
1503
1504
1505
1506 if (f_v) {
1507 cout << "surface_object::identify_double_six_from_trihedral_pair_type_two done" << endl;
1508 }
1509}
1510
1511void surface_object::identify_double_six_from_trihedral_pair_type_three(
1512 int *Lines, int t_idx, int *nine_line_idx, int *double_sixes,
1513 int verbose_level)
1514{
1515 int f_v = (verbose_level >= 1);
1516
1517 if (f_v) {
1518 cout << "surface_object::identify_double_six_from_"
1519 "trihedral_pair_type_three" << endl;
1520 }
1521 if (f_v) {
1522 cout << "surface_object::identify_double_six_from_"
1523 "trihedral_pair_type_three done" << endl;
1524 }
1525}
1526
1527
1528void surface_object::find_common_transversals_to_two_disjoint_lines(
1529 int a, int b, int *transversals5)
1530{
1531 int i, c;
1532
1533 c = 0;
1534 for (i = 0; i < 27; i++) {
1535 if (i == a || i == b) {
1536 continue;
1537 }
1538 if (Adj_line_intersection_graph[i * 27 + a]
1539 && Adj_line_intersection_graph[i * 27 + b]) {
1540 transversals5[c++] = i;
1541 }
1542 }
1543 if (c != 5) {
1544 cout << "surface_object::find_common_transversals_"
1545 "to_two_disjoint_lines c != 5" << endl;
1546 exit(1);
1547 }
1548}
1549
1550void surface_object::find_common_transversals_to_three_disjoint_lines(
1551 int a1, int a2, int a3, int *transversals3)
1552{
1553 int i, c;
1554
1555 c = 0;
1556 for (i = 0; i < 27; i++) {
1557 if (i == a1 || i == a2 || i == a3) {
1558 continue;
1559 }
1560 if (Adj_line_intersection_graph[i * 27 + a1]
1561 && Adj_line_intersection_graph[i * 27 + a2]
1562 && Adj_line_intersection_graph[i * 27 + a3]) {
1563 transversals3[c++] = i;
1564 }
1565 }
1566 if (c != 3) {
1567 cout << "surface_object::find_common_transversals_"
1568 "to_three_disjoint_lines c != 3" << endl;
1569 cout << "c=" << c << endl;
1570 exit(1);
1571 }
1572}
1573
1574void surface_object::find_common_transversals_to_four_disjoint_lines(
1575 int a1, int a2, int a3, int a4, int *transversals2)
1576{
1577 int i, c;
1578
1579 c = 0;
1580 for (i = 0; i < 27; i++) {
1581 if (i == a1 || i == a2 || i == a3 || i == a4) {
1582 continue;
1583 }
1584 if (Adj_line_intersection_graph[i * 27 + a1]
1585 && Adj_line_intersection_graph[i * 27 + a2]
1586 && Adj_line_intersection_graph[i * 27 + a3]
1587 && Adj_line_intersection_graph[i * 27 + a4]) {
1588 transversals2[c++] = i;
1589 }
1590 }
1591 if (c != 2) {
1592 cout << "surface_object::find_common_transversals_"
1593 "to_four_disjoint_lines c != 2" << endl;
1594 exit(1);
1595 }
1596}
1597
1598int surface_object::find_tritangent_plane_through_two_lines(
1599 int line_a, int line_b)
1600{
1601 int i, idx, pi;
1602 sorting Sorting;
1603
1604 for (i = 0; i < 5; i++) {
1605 pi = Tritangent_planes_on_lines[line_a * 5 + i];
1606 if (Sorting.lint_vec_search_linear(
1607 Lines_in_tritangent_plane + pi * 3, 3,
1608 line_b, idx)) {
1609 return pi;
1610 }
1611 }
1612 cout << "surface_object::find_tritangent_plane_through_"
1613 "two_lines we could not find the tritangent "
1614 "plane through these two lines" << endl;
1615 exit(1);
1616}
1617
1618void surface_object::get_planes_through_line(int *new_lines,
1619 int line_idx, int *planes5)
1620{
1621 int f_v = FALSE;
1622
1623 if (f_v) {
1624 cout << "surface_object::get_planes_through_line " << endl;
1625 cout << "line=" << Surf->Line_label[line_idx] << endl;
1626 }
1627 int_vec_copy(Tritangent_planes_on_lines + new_lines[line_idx] * 5,
1628 planes5, 5);
1629}
1630
1631void surface_object::find_two_lines_in_plane(int plane_idx,
1632 int forbidden_line, int &line1, int &line2)
1633{
1634 int i;
1635
1636 for (i = 0; i < 3; i++) {
1637 if (Lines_in_tritangent_plane[plane_idx * 3 + i] == forbidden_line) {
1638 if (i == 0) {
1639 line1 = Lines_in_tritangent_plane[plane_idx * 3 + 1];
1640 line2 = Lines_in_tritangent_plane[plane_idx * 3 + 2];
1641 }
1642 else if (i == 1) {
1643 line1 = Lines_in_tritangent_plane[plane_idx * 3 + 0];
1644 line2 = Lines_in_tritangent_plane[plane_idx * 3 + 2];
1645 }
1646 else if (i == 2) {
1647 line1 = Lines_in_tritangent_plane[plane_idx * 3 + 0];
1648 line2 = Lines_in_tritangent_plane[plane_idx * 3 + 1];
1649 }
1650 return;
1651 }
1652 }
1653 cout << "surface_object::find_two_lines_in_plane we "
1654 "could not find the forbidden line" << endl;
1655}
1656
1657int surface_object::find_unique_line_in_plane(int plane_idx,
1658 int forbidden_line1, int forbidden_line2)
1659{
1660 int i, a;
1661
1662 for (i = 0; i < 3; i++) {
1663 a = Lines_in_tritangent_plane[plane_idx * 3 + i];
1664 if (a == forbidden_line1) {
1665 continue;
1666 }
1667 if (a == forbidden_line2) {
1668 continue;
1669 }
1670 return a;
1671 }
1672 cout << "surface_object::find_unique_line_in_plane we "
1673 "could not find the unique line" << endl;
1674 exit(1);
1675}
1676
1677int surface_object::choose_tritangent_plane(
1678 int line_a, int line_b, int transversal_line, int verbose_level)
1679{
1680 int f_v = TRUE; // (verbose_level >= 1);
1681 int i, plane, idx, a;
1682 sorting Sorting;
1683
1684 if (f_v) {
1685 cout << "surface_object::choose_tritangent_plane" << endl;
1686 cout << "line_a=" << line_a << endl;
1687 cout << "line_b=" << line_b << endl;
1688 cout << "transversal_line=" << transversal_line << endl;
1689 //cout << "Tritangent_planes_on_lines:" << endl;
1690 //int_matrix_print(Tritangent_planes_on_lines, 27, 5);
1691 }
1692 if (FALSE) {
1693 cout << "Testing the following planes: ";
1694 int_vec_print(cout,
1695 Tritangent_planes_on_lines + transversal_line * 5, 5);
1696 cout << endl;
1697 }
1698 for (i = 4; i >= 0; i--) {
1699 a = Tritangent_planes_on_lines[transversal_line * 5 + i];
1700 plane = Tritangent_plane_to_Eckardt[a];
1701 if (f_v) {
1702 cout << "testing plane " << a << " = " << plane << endl;
1703 }
1704 if (Sorting.lint_vec_search_linear(
1705 Lines_in_tritangent_plane + a * 3, 3, line_a, idx)) {
1706 if (f_v) {
1707 cout << "The plane is bad, it contains line_a" << endl;
1708 }
1709 continue;
1710 }
1711 if (Sorting.lint_vec_search_linear(
1712 Lines_in_tritangent_plane + a * 3, 3, line_b, idx)) {
1713 if (f_v) {
1714 cout << "The plane is bad, it contains line_b" << endl;
1715 }
1716 continue;
1717 }
1718 break;
1719 }
1720 if (i == 5) {
1721 cout << "surface_object::choose_tritangent_plane "
1722 "could not find a tritangent plane" << endl;
1723 exit(1);
1724 }
1725 if (f_v) {
1726 cout << "surface_object::choose_tritangent_plane done" << endl;
1727 }
1728 return plane;
1729}
1730
1731void surface_object::find_all_tritangent_planes(
1732 int line_a, int line_b, int transversal_line,
1733 int *tritangent_planes3,
1734 int verbose_level)
1735{
1736 int f_v = TRUE; // (verbose_level >= 1);
1737 int i, plane, idx, a, nb;
1738 sorting Sorting;
1739
1740 if (f_v) {
1741 cout << "surface_object::find_all_tritangent_planes" << endl;
1742 cout << "line_a=" << line_a << endl;
1743 cout << "line_b=" << line_b << endl;
1744 cout << "transversal_line=" << transversal_line << endl;
1745 //cout << "Tritangent_planes_on_lines:" << endl;
1746 //int_matrix_print(Tritangent_planes_on_lines, 27, 5);
1747 }
1748 if (FALSE) {
1749 cout << "Testing the following planes: ";
1750 int_vec_print(cout,
1751 Tritangent_planes_on_lines + transversal_line * 5, 5);
1752 cout << endl;
1753 }
1754 nb = 0;
1755 for (i = 4; i >= 0; i--) {
1756 a = Tritangent_planes_on_lines[transversal_line * 5 + i];
1757 plane = Tritangent_plane_to_Eckardt[a];
1758 if (f_v) {
1759 cout << "testing plane " << a << " = " << plane << endl;
1760 }
1761 if (Sorting.lint_vec_search_linear(
1762 Lines_in_tritangent_plane + a * 3, 3, line_a, idx)) {
1763 if (f_v) {
1764 cout << "The plane is bad, it contains line_a" << endl;
1765 }
1766 continue;
1767 }
1768 if (Sorting.lint_vec_search_linear(
1769 Lines_in_tritangent_plane + a * 3, 3, line_b, idx)) {
1770 if (f_v) {
1771 cout << "The plane is bad, it contains line_b" << endl;
1772 }
1773 continue;
1774 }
1775 tritangent_planes3[nb++] = plane;
1776 }
1777 if (nb != 3) {
1778 cout << "surface_object::find_all_tritangent_planes "
1779 "nb != 3" << endl;
1780 exit(1);
1781 }
1782 if (f_v) {
1783 cout << "surface_object::choose_tritangent_plane "
1784 "done" << endl;
1785 }
1786}
1787#endif
1788
1789void surface_object::identify_lines(long int *lines, int nb_lines,
1790 int *line_idx, int verbose_level)
1791{
1792 int f_v = (verbose_level >= 1);
1793 int i, idx;
1795
1796 if (f_v) {
1797 cout << "surface_object::identify_lines" << endl;
1798 }
1799 for (i = 0; i < nb_lines; i++) {
1800 if (!Sorting.lint_vec_search_linear(Lines, 27, lines[i], idx)) {
1801 cout << "surface_object::identify_lines could "
1802 "not find lines[" << i << "]=" << lines[i]
1803 << " in Lines[]" << endl;
1804 exit(1);
1805 }
1806 line_idx[i] = idx;
1807 }
1808 if (f_v) {
1809 cout << "surface_object::identify_lines done" << endl;
1810 }
1811}
1812
1814 long int *nine_lines, int *nine_lines_idx)
1815{
1817 int i, j, idx;
1818
1819 ost << "$$";
1821 nine_lines, 3, 3, TRUE /* f_tex*/);
1822
1823
1824 ost << "\\qquad" << endl;
1825 ost << "\\begin{array}{c|ccc}" << endl;
1826 for (j = 0; j < 3; j++) {
1827 ost << " & " << j;
1828 }
1829 ost << "\\\\" << endl;
1830 ost << "\\hline" << endl;
1831 for (i = 0; i < 3; i++) {
1832 ost << i << " & ";
1833 for (j = 0; j < 3; j++) {
1834
1835 idx = nine_lines_idx[i * 3 + j];
1836 ost << "\\ell_{" << idx << "}";
1837 if (j < 3 - 1) {
1838 ost << " & ";
1839 }
1840 }
1841 ost << "\\\\" << endl;
1842 }
1843 ost << "\\end{array}" << endl;
1844 ost << "\\qquad" << endl;
1845 ost << "\\begin{array}{c|ccc}" << endl;
1846 for (j = 0; j < 3; j++) {
1847 ost << " & " << j;
1848 }
1849 ost << "\\\\" << endl;
1850 ost << "\\hline" << endl;
1851 for (i = 0; i < 3; i++) {
1852 ost << i << " & ";
1853 for (j = 0; j < 3; j++) {
1854
1855 idx = nine_lines_idx[i * 3 + j];
1856 ost << Surf->Schlaefli->Labels->Line_label_tex[idx];
1857 if (j < 3 - 1) {
1858 ost << " & ";
1859 }
1860 }
1861 ost << "\\\\" << endl;
1862 }
1863 ost << "\\end{array}" << endl;
1864 ost << "$$" << endl;
1865}
1866
1867#if 0
1868void surface_object::compute_clebsch_maps(int verbose_level)
1869{
1870 int f_v = (verbose_level >= 1);
1871 int i, j;
1872
1873 if (f_v) {
1874 cout << "surface_object::compute_clebsch_maps" << endl;
1875 }
1876
1877 int line_idx[2];
1878 int *Clebsch_map;
1879 int *Clebsch_coeff;
1880 int cnt, h;
1881 int Arc[6];
1882 int Blown_up_lines[6];
1883 int Blown_up2[6];
1884 int transversal_line, plane_rk, plane_rk_global;
1885
1886 cnt = 0;
1887 Clebsch_map = NEW_int(nb_pts);
1888 Clebsch_coeff = NEW_int(nb_pts * 4);
1889 // loop over all pairs of disjoint lines:
1890 for (i = 0; i < 27; i++) {
1891 for (j = i + 1; j < 27; j++) {
1892 if (Adj_line_intersection_graph[i * 27 + j] == 1) {
1893 continue;
1894 }
1895 line_idx[0] = i;
1896 line_idx[1] = j;
1897
1898 cout << "#######################" << endl;
1899 cout << "clebsch map for lines " << i << ", "
1900 << j << ":" << endl;
1901
1902 transversal_line = compute_transversal_line(i, j,
1903 0 /* verbose_level */);
1904
1905 plane_rk = choose_tritangent_plane(i, j,
1906 transversal_line, 0 /* verbose_level */);
1907
1908 plane_rk_global = Tritangent_planes[plane_rk];
1909
1910 cout << "transversal\\_line = " << transversal_line
1911 << "\\\\" << endl;
1912 cout << "plane\\_rank = " << plane_rk << " = "
1913 << plane_rk_global << "\\\\" << endl;
1914
1915
1916 if (!Surf->clebsch_map(Lines, Pts, nb_pts,
1917 line_idx, plane_rk_global,
1918 Clebsch_map, Clebsch_coeff, 0 /*verbose_level*/)) {
1919 cout << "The plane contains one of the lines, "
1920 "this should not happen" << endl;
1921 exit(1);
1922 }
1923
1924 cout << "clebsch map for lines " << i << ", " << j
1925 << " clebsch_map_print_fibers:" << endl;
1926 clebsch_map_print_fibers(Clebsch_map);
1927
1928
1929 cout << "clebsch map for lines " << i << ", " << j
1930 << " clebsch_map_find_arc_and_lines:" << endl;
1931 clebsch_map_find_arc_and_lines(Clebsch_map, Arc,
1932 Blown_up_lines, 1 /* verbose_level */);
1933
1934 cout << "after clebsch_map_find_arc_and_lines" << endl;
1935 //clebsch_map_find_arc(Clebsch_map, Pts, nb_pts,
1936 //Arc, 0 /* verbose_level */);
1937 cout << "Clebsch map for lines " << i << ", " << j
1938 << " cnt=" << cnt << " : arc = ";
1939 int_vec_print(cout, Arc, 6);
1940 cout << " : blown up lines = ";
1941 int_vec_print(cout, Blown_up_lines, 6);
1942
1943
1944
1945
1946 cout << " : ";
1947
1948 int_vec_copy(Blown_up_lines, Blown_up2, 6);
1949 int_vec_heapsort(Blown_up2, 6);
1950 for (h = 0; h < 6; h++) {
1951 if (Blown_up2[h] >= 0 && Blown_up2[h] < 27) {
1952 cout << Surf->Line_label[Blown_up2[h]];
1953 if (h < 6 - 1) {
1954 cout << ", ";
1955 }
1956 }
1957 }
1958 cout << endl;
1959
1960 cnt++;
1961 }
1962 }
1963
1964 FREE_int(Clebsch_map);
1965 FREE_int(Clebsch_coeff);
1966
1967 if (f_v) {
1968 cout << "surface_object::compute_clebsch_maps done" << endl;
1969 }
1970}
1971#endif
1972
1973
1974
1975int surface_object::find_point(long int P, int &idx)
1976{
1978
1979 if (Sorting.lint_vec_search(Pts, nb_pts, P,
1980 idx, 0 /* verbose_level */)) {
1981 return TRUE;
1982 }
1983 else {
1984 return FALSE;
1985 }
1986}
1987
1988
1989
1990}}}
1991
1992
int create_double_six_from_five_lines_with_a_common_transversal(long int *five_pts, long int *double_six, int verbose_level)
Given a five-plus-one five_pts[5], complete the double-six.
ring_theory::homogeneous_polynomial_domain * Poly3_4
void list_starter_configurations(long int *Lines, int nb_lines, data_structures::set_of_sets *line_intersections, int *&Table, int &N, int verbose_level)
void enumerate_points(int *coeff, std::vector< long int > &Pts, int verbose_level)
void compute_adjacency_matrix_of_line_intersection_graph(int *&Adj, long int *S, int n, int verbose_level)
Given a set of lines in S[n], compute the associated line intersection graph.
void create_starter_configuration(int line_idx, int subset_idx, data_structures::set_of_sets *line_neighbors, long int *Lines, long int *S, int verbose_level)
void create_remaining_fifteen_lines(long int *double_six, long int *fifteen_lines, int verbose_level)
properties of a particular cubic surface in PG(3,q), as defined by an object of class surface_object
void init_equation(surface_domain *Surf, int *eqn, int verbose_level)
void identify_lines(long int *lines, int nb_lines, int *line_idx, int verbose_level)
void find_double_six_and_rearrange_lines(long int *Lines, int verbose_level)
void init_with_27_lines(surface_domain *Surf, long int *Lines27, int *eqn, int f_find_double_six_and_rearrange_lines, int verbose_level)
void init_equation_points_and_lines_only(surface_domain *Surf, int *eqn, int verbose_level)
void print_nine_lines_latex(std::ostream &ost, long int *nine_lines, int *nine_lines_idx)
void find_real_lines(std::vector< long int > &The_Lines, int verbose_level)
void init_from_adjacency_matrix(int n, int *Adj, int verbose_level)
Definition: set_of_sets.cpp:87
a collection of functions related to sorted vectors
int lint_vec_search_linear(long int *v, int len, long int a, int &idx)
Definition: sorting.cpp:699
int lint_vec_search(long int *v, int len, long int a, int &idx, int verbose_level)
Definition: sorting.cpp:1157
void unrank_lint_here(int *Mtx, long int rk, int verbose_level)
Definition: grassmann.cpp:269
void find_lines_which_are_contained(std::vector< long int > &Points, std::vector< long int > &Lines, int verbose_level)
long int dual_rank_of_plane_in_three_space(long int plane_rank, int verbose_level)
void print_lint_matrix_with_standard_labels(std::ostream &ost, long int *p, int m, int n, int f_tex)
void substitute_line(int *coeff_in, int *coeff_out, int *Pt1_coeff, int *Pt2_coeff, int verbose_level)
#define Lint_vec_copy(A, B, C)
Definition: foundations.h:694
#define FREE_int(p)
Definition: foundations.h:640
#define NEW_OBJECT(type)
Definition: foundations.h:638
#define Lint_vec_print(A, B, C)
Definition: foundations.h:686
#define FREE_OBJECT(p)
Definition: foundations.h:651
#define NEW_int(n)
Definition: foundations.h:625
#define TRUE
Definition: foundations.h:231
#define FALSE
Definition: foundations.h:234
#define Int_vec_copy(A, B, C)
Definition: foundations.h:693
#define FREE_lint(p)
Definition: foundations.h:642
#define NEW_lint(n)
Definition: foundations.h:628
#define Int_vec_print(A, B, C)
Definition: foundations.h:685
orbiter_kernel_system::orbiter_session * Orbiter
global Orbiter session
the orbiter library for the classification of combinatorial objects