19namespace layer1_foundations {
24static double Hilbert_Cohn_Vossen_Lines[] = {
37 4./5., 3./5., 0, 0., 1., 1.,
38 3./5., 0., 4./5., 1, 1., 0.,
40 -4./5., 3./5., 0., 0., -1., 1.,
41 -3./5., 0., -4./5., -1., 1., 0.,
42 -3./5., 4./5., 0., 1., 0., 1.,
43 -4./5., -3./5., 0., 0., -1., 1.,
44 0., 1., 0., 1., 0., 0.,
45 3./5., -4./5., 0., -1., 0., 1.,
46 3./5., 0., -4./5., -1., 1., 0.,
47 -3./5., -4./5., 0., -1., 0., 1.,
48 0., 0., 1., 0., 1., 0.,
49 4./5., -3./5., 0., 0., 1., 1.,
50 -3./5., 0., 4./5., 1., 1., 0.,
51 3./5., 4./5., 0., 1., 0., 1.,
55static double Hilbert_Cohn_Vossen_tritangent_planes[] = {
120 Quadric_coords = NULL;
122 Quartic_coords = NULL;
124 Quintic_coords = NULL;
130 Nb_face_points = NULL;
155 delete [] Line_coords;
161 delete [] Point_coords;
164 delete [] Plane_coords;
166 if (Quadric_coords) {
167 delete [] Quadric_coords;
170 delete [] Cubic_coords;
172 if (Quartic_coords) {
173 delete [] Quartic_coords;
175 if (Quintic_coords) {
176 delete [] Quintic_coords;
179 delete [] Octic_coords;
181 if (Nb_face_points) {
197 cout <<
"scene::label idx >= nb_points, "
198 "idx=" << idx <<
" nb_points=" <<
nb_points << endl;
203 pair<int, string> P(idx, txt);
212 cout <<
"scene::point_coords idx >= nb_points, "
213 "idx=" << idx <<
" nb_points=" <<
nb_points << endl;
217 cout <<
"scene::point_coords j >= 3, "
221 return Point_coords[idx * 3 + j];
227 cout <<
"scene::line_coords idx >= nb_lines, "
228 "idx=" << idx <<
" nb_lines=" <<
nb_lines << endl;
232 cout <<
"scene::line_coords j >= 6, "
236 return Line_coords[idx * 6 + j];
242 cout <<
"scene::plane_coords idx >= nb_planes, "
243 "idx=" << idx <<
" nb_planes=" <<
nb_planes << endl;
247 cout <<
"scene::plane_coords j >= 4, "
251 return Plane_coords[idx * 4 + j];
257 cout <<
"scene::cubic_coords idx >= nb_cubics, "
258 "idx=" << idx <<
" nb_cubics=" <<
nb_cubics << endl;
262 cout <<
"scene::cubic_coords j >= 20, "
266 return Cubic_coords[idx * 20 + j];
272 cout <<
"scene::quadric_coords idx >= nb_quadrics, "
273 "idx=" << idx <<
" nb_quadrics=" <<
nb_quadrics << endl;
277 cout <<
"scene::quadric_coords j >= 10, "
281 return Quadric_coords[idx * 10 + j];
287 cout <<
"scene::edge_points idx >= nb_edges, "
288 "idx=" << idx <<
" nb_edges=" <<
nb_edges << endl;
292 cout <<
"scene::edge_points j >= 2, "
296 return Edge_points[idx * 2 + j];
303 for (j = 0; j < 3; j++) {
304 cout << Point_coords[idx * 3 + j] <<
"\t";
332 d = Num.
distance_euclidean(Point_coords + pt1_idx * 3, Point_coords + pt2_idx * 3, 3);
338 int f_v = (verbose_level >= 1);
341 cout <<
"scene::init" << endl;
365 cout <<
"scene::done" << endl;
370 double rad,
int verbose_level)
372 int f_v = (verbose_level >= 1);
376 cout <<
"scene::transformed_copy" << endl;
380 S->
init(verbose_level);
393 cout <<
"scene::transformed_copy done" << endl;
403 cout <<
"scene:" << endl;
404 cout <<
"nb_lines=" <<
nb_lines << endl;
406 cout << i <<
" / " <<
nb_lines <<
" : ";
412 cout <<
"nb_planes=" <<
nb_planes << endl;
414 cout << i <<
" / " <<
nb_planes <<
" : ";
418 cout <<
"nb_points=" <<
nb_points << endl;
420 cout << i <<
" / " <<
nb_points <<
" : ";
424 cout <<
"nb_cubics=" <<
nb_cubics << endl;
426 cout << i <<
" / " <<
nb_cubics <<
" : ";
433 cout <<
"nb_edges=" <<
nb_edges << endl;
435 cout << k <<
" / " <<
nb_edges <<
" : ";
442 double *A4,
double *A4_inv,
446 int f_v = (verbose_level >= 1);
449 double xxx[4], yyy[4];
455 cout <<
"scene::transform_lines" << endl;
459 N.
vec_copy(Line_coords + i * 6 + 0, x, 3);
461 N.
vec_copy(Line_coords + i * 6 + 3, y, 3);
465 if (
ABS(xx[3]) < 0.0001) {
466 cout <<
"scene::transform_lines warning, "
467 "point x is moved to infinity" << endl;
470 if (
ABS(yy[3]) < 0.0001) {
471 cout <<
"scene::transform_lines warning, "
472 "point y is moved to infinity" << endl;
476 if (
ABS(xx[3] - 1.) > 0.0001) {
477 cout <<
"scene::transform_lines warning, "
478 "point xx is not an affine point" << endl;
482 if (
ABS(yy[3] - 1.) > 0.0001) {
483 cout <<
"scene::transform_lines warning, "
484 "point yy is not an affine point" << endl;
487 if (N.
line_centered(xx, yy, xxx, yyy, 10., verbose_level - 1)) {
488 S->
line(xxx[0], xxx[1], xxx[2], yyy[0], yyy[1], yyy[2]);
493 cout <<
"scene::transform_lines done" << endl;
500 int f_v = (verbose_level >= 1);
506 cout <<
"scene::copy_edges" << endl;
510 a = Edge_points[i * 2 + 0];
511 b = Edge_points[i * 2 + 1];
515 cout <<
"scene::copy_edges done" << endl;
522 int f_v = (verbose_level >= 1);
530 cout <<
"scene::transform_points" << endl;
534 N.
vec_copy(Point_coords + i * 3, x, 3);
537 if (
ABS(xx[3]) < 0.0001) {
538 cout <<
"scene::transform_lines warning, "
539 "point x is moved to infinity" << endl;
543 if (
ABS(xx[3] - 1.) > 0.0001) {
544 cout <<
"scene::transform_lines warning, "
545 "point xx is not an affine point" << endl;
548 S->
point(xx[0], xx[1], xx[2]);
552 cout <<
"scene::transform_points done" << endl;
559 int f_v = (verbose_level >= 1);
568 cout <<
"scene::transform_planes" << endl;
575 N.
vec_copy(Plane_coords + i * 4, x, 4);
581 S->
plane(xx[0], xx[1], xx[2], xx[3]);
585 cout <<
"scene::transform_planes done" << endl;
592 int f_v = (verbose_level >= 1);
594 double coeff_out[10];
600 cout <<
"scene::transform_quadrics" << endl;
605 N.
vec_copy(Quadric_coords + i * 10, coeff_in, 10);
608 A4_inv, verbose_level);
614 cout <<
"scene::transform_quadrics done" << endl;
621 int f_v = (verbose_level >= 1);
623 double coeff_out[20];
629 cout <<
"scene::transform_cubics" << endl;
634 N.
vec_copy(Cubic_coords + i * 20, coeff_in, 20);
637 A4_inv, verbose_level);
643 cout <<
"scene::transform_cubics done" << endl;
650 int f_v = (verbose_level >= 1);
654 cout <<
"scene::transform_quartics" << endl;
657 cout <<
"scene::transform_quartics not yet implemented" << endl;
660 double coeff_out[35];
666 N.
vec_copy(Quartic_coords + i * 35, coeff_in, 35);
669 A4_inv, verbose_level);
675 cout <<
"scene::transform_quartics done" << endl;
682 int f_v = (verbose_level >= 1);
686 cout <<
"scene::transform_quartics" << endl;
689 cout <<
"scene::transform_quintics not yet implemented" << endl;
692 double coeff_out[56];
698 N.
vec_copy(Quintic_coords + i * 56, coeff_in, 56);
701 A4_inv, verbose_level);
707 cout <<
"scene::transform_quintics done" << endl;
714 int f_v = (verbose_level >= 1);
720 cout <<
"scene::copy_faces" << endl;
724 pts = Face_points[i];
725 nb_pts = Nb_face_points[i];
726 S->
face(pts, nb_pts);
729 cout <<
"scene::copy_faces done" << endl;
736 int f_v = (verbose_level >= 1);
743 cout <<
"scene::line_pt_and_dir" << endl;
748 pt[3] = x6[0] + x6[3];
749 pt[4] = x6[1] + x6[4];
750 pt[5] = x6[2] + x6[5];
753 rad, verbose_level)) {
754 Line_coords[
nb_lines * 6 + 0] = pt2[0];
755 Line_coords[
nb_lines * 6 + 1] = pt2[1];
756 Line_coords[
nb_lines * 6 + 2] = pt2[2];
757 Line_coords[
nb_lines * 6 + 3] = pt2[3];
758 Line_coords[
nb_lines * 6 + 4] = pt2[4];
759 Line_coords[
nb_lines * 6 + 5] = pt2[5];
762 cout <<
"too many lines" << endl;
771 cout <<
"scene::line_pt_and_dir done" << endl;
778 int f_v = (verbose_level >= 1);
785 cout <<
"scene::line_pt_and_dir_and_copy_points" << endl;
790 pt[3] = x6[0] + x6[3];
791 pt[4] = x6[1] + x6[4];
792 pt[5] = x6[2] + x6[5];
795 rad, verbose_level)) {
796 Line_coords[
nb_lines * 6 + 0] = pt2[0];
797 Line_coords[
nb_lines * 6 + 1] = pt2[1];
798 Line_coords[
nb_lines * 6 + 2] = pt2[2];
799 Line_coords[
nb_lines * 6 + 3] = pt2[3];
800 Line_coords[
nb_lines * 6 + 4] = pt2[4];
801 Line_coords[
nb_lines * 6 + 5] = pt2[5];
804 cout <<
"too many lines" << endl;
811 cout <<
"line_pt_and_dir_and_copy_points could not create points" << endl;
815 cout <<
"scene::line_pt_and_dir_and_copy_points done" << endl;
826 int verbose_level = 0;
836 rad, verbose_level)) {
837 Line_coords[
nb_lines * 6 + 0] = pt2[0];
838 Line_coords[
nb_lines * 6 + 1] = pt2[1];
839 Line_coords[
nb_lines * 6 + 2] = pt2[2];
840 Line_coords[
nb_lines * 6 + 3] = pt2[3];
841 Line_coords[
nb_lines * 6 + 4] = pt2[4];
842 Line_coords[
nb_lines * 6 + 5] = pt2[5];
845 cout <<
"too many lines" << endl;
857 Line_coords[
nb_lines * 6 + 0] = x6[0];
858 Line_coords[
nb_lines * 6 + 1] = x6[1];
859 Line_coords[
nb_lines * 6 + 2] = x6[2];
860 Line_coords[
nb_lines * 6 + 3] = x6[3];
861 Line_coords[
nb_lines * 6 + 4] = x6[4];
862 Line_coords[
nb_lines * 6 + 5] = x6[5];
865 cout <<
"too many lines" << endl;
872 double y1,
double y2,
double y3)
882 cout <<
"too many lines" << endl;
889 double y1,
double y2,
double y3,
double rad)
894 int verbose_level = 0;
905 Line_coords[
nb_lines * 6 + 0] = xx[0];
906 Line_coords[
nb_lines * 6 + 1] = xx[1];
907 Line_coords[
nb_lines * 6 + 2] = xx[2];
908 Line_coords[
nb_lines * 6 + 3] = yy[0];
909 Line_coords[
nb_lines * 6 + 4] = yy[1];
910 Line_coords[
nb_lines * 6 + 5] = yy[2];
914 cout <<
"too many lines" << endl;
925 int verbose_level = 0;
927 N.
vec_copy(Point_coords + pt1 * 3, x, 3);
928 N.
vec_copy(Point_coords + pt2 * 3, y, 3);
932 Line_coords[
nb_lines * 6 + 0] = xx[0];
933 Line_coords[
nb_lines * 6 + 1] = xx[1];
934 Line_coords[
nb_lines * 6 + 2] = xx[2];
935 Line_coords[
nb_lines * 6 + 3] = yy[0];
936 Line_coords[
nb_lines * 6 + 4] = yy[1];
937 Line_coords[
nb_lines * 6 + 5] = yy[2];
940 cout <<
"too many lines" << endl;
948 Edge_points[
nb_edges * 2 + 0] = pt1;
949 Edge_points[
nb_edges * 2 + 1] = pt2;
952 cout <<
"too many edges" << endl;
963 point(Coords[i * 3 + 0], Coords[i * 3 + 1], Coords[i * 3 + 2]);
974 cout <<
"too many points" << endl;
996 return point(x[0], x[1], x[2]);
1001 int f_v = (verbose_level >= 1);
1005 cout <<
"scene::triangle" << endl;
1010 idx =
face3(pt[0], pt[1], pt[2]);
1012 cout <<
"scene::triangle done" << endl;
1019 double x[3], y[3], z[3], u[3], v[3];
1027 N.
vec_copy(Line_coords + line1 * 6, x, 3);
1028 N.
vec_copy(Line_coords + line2 * 6, y, 3);
1029 N.
vec_subtract(Line_coords + line1 * 6 + 3, Line_coords + line1 * 6, u, 3);
1030 N.
vec_subtract(Line_coords + line2 * 6 + 3, Line_coords + line2 * 6, v, 3);
1037 for (i = 0; i < 3; i++) {
1038 System[i * 3 + 0] = u[i];
1039 System[i * 3 + 1] = -1. * v[i];
1040 System[i * 3 + 2] = y[i] - x[i];
1046 cout <<
"scene::point_as_intersection_of_two_lines ker != 1" << endl;
1052 for (i = 0; i < 3; i++) {
1053 z[i] = x[i] + lambda * u[i];
1055 idx =
point(z[0], z[1], z[2]);
1063 d = sqrt(x4[0] * x4[0] + x4[1] * x4[1] + x4[2] * x4[2]);
1068 y[3] = - x4[3] * dv;
1069 return plane(y[0], y[1], y[2], y[3]);
1101 cout <<
"too many planes" << endl;
1109 double p1[3], p2[3], p3[3], n[3], d;
1112 N.
vec_copy(Point_coords + pt1 * 3, p1, 3);
1113 N.
vec_copy(Point_coords + pt2 * 3, p2, 3);
1114 N.
vec_copy(Point_coords + pt3 * 3, p3, 3);
1117 cout <<
"p1=" << endl;
1118 print_system(p1, 1, 3);
1120 cout <<
"p2=" << endl;
1121 print_system(p2, 1, 3);
1123 cout <<
"p3=" << endl;
1124 print_system(p3, 1, 3);
1129 return plane(n[0], n[1], n[2], d);
1133 int line_idx1,
int line_idx2,
int line_idx3,
1136 int f_v = (verbose_level >= 1);
1139 double System[9 * 10];
1147 cout <<
"scene::quadric_through_three_lines" << endl;
1168 for (i = 0; i < 9; i++) {
1172 System[i * 10 + 0] = x * x;
1173 System[i * 10 + 1] = x * y;
1174 System[i * 10 + 2] = x * z;
1175 System[i * 10 + 3] = x;
1176 System[i * 10 + 4] = y * y;
1177 System[i * 10 + 5] = y * z;
1178 System[i * 10 + 6] = y;
1179 System[i * 10 + 7] = z * z;
1180 System[i * 10 + 8] = z;
1181 System[i * 10 + 9] = 1;
1186 cout <<
"scene::quadric_through_three_lines k != 1" << endl;
1193 cout <<
"scene::quadric_through_three_lines done" << endl;
1205 cout <<
"too many quintics" << endl;
1208 for (i = 0; i < 56; i++) {
1209 Quintic_coords[
nb_quintics * 56 + i] = coeff_56[i];
1222 cout <<
"too many octics" << endl;
1225 for (i = 0; i < 165; i++) {
1226 Octic_coords[
nb_octics * 165 + i] = coeff_165[i];
1250 cout <<
"too many quadrics" << endl;
1253 for (i = 0; i < 10; i++) {
1278 eqn[13] = coeff[11];
1279 eqn[14] = coeff[19];
1280 eqn[15] = coeff[14];
1282 eqn[17] = coeff[12];
1283 eqn[18] = coeff[15];
1314 for (i = 0; i < 20; i++) {
1315 Cubic_coords[
nb_cubics * 20 + i] = coeff[i];
1319 cout <<
"too many cubics" << endl;
1326 double angle_start,
double angle_max,
double angle_min,
1327 double *coeff1,
double *coeff2,
1330 int f_v = (verbose_level >= 1);
1333 cout <<
"scene::deformation_of_cubic_lex" << endl;
1335 double phi_step, phi, s1, s2, c, theta, t, mu, lambda;
1337 int h, nb_frames_half, i;
1339 nb_frames_half = nb_frames >> 1;
1340 phi_step = 2 * 2 *
M_PI / (nb_frames - 1);
1341 s1 = (angle_max - angle_start) / 2.;
1342 s2 = (angle_start - angle_min) / 2.;
1344 for (h = 0; h < nb_frames; h++) {
1347 if (h < nb_frames_half) {
1348 theta = angle_start + c * s1;
1351 theta = angle_start - c * s2;
1354 if (isnan(t) ||
ABS(t) > 1000000.) {
1366 for (i = 0; i < 20; i++) {
1367 coeff3[i] = mu * coeff1[i] + lambda * coeff2[i];
1372 cout <<
"scene::deformation_of_cubic_lex done" << endl;
1381 for (i = 0; i < 20; i++) {
1389 return cubic(coeffs);
1399 cout <<
"too many quartics" << endl;
1402 for (i = 0; i < 35; i++) {
1416 cout <<
"too many faces" << endl;
1429 return face(pts, 3);
1440 return face(pts, 4);
1452 return face(pts, 5);
1458 std::string &options, ostream &ost)
1464 ost <<
" union{ // lines" << endl;
1466 ost <<
" #declare r=" <<
line_radius <<
"; " << endl;
1469 for (i = 0; i < nb_select; i++) {
1472 ost <<
" cylinder{<";
1473 for (h = 0; h < 3; h++) {
1480 for (h = 0; h < 3; h++) {
1486 ost <<
">, r } // line " << j << endl;
1489 ost <<
" " << options <<
"" << endl;
1491 ost <<
" }" << endl;
1495 std::string &options, ostream &ost)
1501 ost <<
" union{ // lines" << endl;
1503 ost <<
" #declare r=" <<
line_radius <<
"; " << endl;
1508 ost <<
" cylinder{<";
1509 for (h = 0; h < 3; h++) {
1516 for (h = 0; h < 3; h++) {
1522 ost <<
">, r } // line " << j << endl;
1524 ost <<
" " << options <<
"" << endl;
1526 ost <<
" }" << endl;
1536 ost <<
" union{ // cij lines" << endl;
1538 ost <<
" #declare r=" <<
line_radius <<
"; " << endl;
1541 for (i = 0; i < nb_select; i++) {
1544 ost <<
" cylinder{<";
1545 for (h = 0; h < 3; h++) {
1552 for (h = 0; h < 3; h++) {
1558 ost <<
">, r } // line " << j << endl;
1561 ost <<
" pigment{Yellow}" << endl;
1562 ost <<
" }" << endl;
1567 int selection[] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14};
1577 for (i = 0; i < number_of_lines; i++) {
1578 selection[i] = offset + i;
1590 ost <<
" union{ // ai lines" << endl;
1592 ost <<
" #declare r=" <<
line_radius <<
"; " << endl;
1595 for (i = 0; i < nb_select; i++) {
1598 ost <<
" cylinder{<";
1599 for (h = 0; h < 3; h++) {
1606 for (h = 0; h < 3; h++) {
1612 ost <<
">, r } // line " << j << endl;
1615 ost <<
" pigment{Red}" << endl;
1616 ost <<
" }" << endl;
1621 int selection[] = {0,1,2,3,4,5};
1631 for (i = 0; i < 6; i++) {
1632 selection[i] = offset + i;
1644 ost <<
" union{ // bj lines" << endl;
1646 ost <<
" #declare r=" <<
line_radius <<
"; " << endl;
1649 for (i = 0; i < nb_select; i++) {
1652 ost <<
" cylinder{<";
1653 for (h = 0; h < 3; h++) {
1660 for (h = 0; h < 3; h++) {
1666 ost <<
">, r } // line " << j << endl;
1669 ost <<
" pigment{Blue}" << endl;
1670 ost <<
" }" << endl;
1675 int selection[] = {0,1,2,3,4,5};
1685 for (i = 0; i < 6; i++) {
1686 selection[i] = offset + i;
1695 std::string &options, ostream &ost)
1697 int s, i, j, h, pt1, pt2;
1701 ost <<
" union{ // edges" << endl;
1703 ost <<
" #declare r=" <<
line_radius <<
" ; " << endl;
1705 for (i = 0; i < nb_select; i++) {
1708 pt1 = Edge_points[j * 2 + 0];
1709 pt2 = Edge_points[j * 2 + 1];
1710 ost <<
" cylinder{<";
1711 for (h = 0; h < 3; h++) {
1718 for (h = 0; h < 3; h++) {
1724 ost <<
">, r } // line " << j << endl;
1727 ost <<
" " << options <<
" " << endl;
1729 ost <<
" }" << endl;
1733 double thickness_half, std::string &options, ostream &ost)
1738 ost <<
" union{ // faces" << endl;
1742 for (i = 0; i < nb_select; i++) {
1745 ost <<
"\t\t// face " << j <<
":" << endl;
1746 draw_face(j, thickness_half, options, ost);
1750 ost <<
" }" << endl;
1767 nb_pts = Nb_face_points[idx];
1768 pts = Face_points[idx];
1769 Pts_in =
new double [nb_pts * 3];
1770 Pts_out =
new double [nb_pts * 2];
1772 cout <<
"scene::draw_face" << endl;
1774 for (i = 0; i < nb_pts; i++) {
1775 N.
vec_copy(Point_coords + pts[i] * 3, Pts_in + i * 3, 3);
1777 cout <<
"vertex i= " << i <<
" pts[i] = " << pts[i]
1778 <<
" x=" << Pts_in[i * 3 + 0]
1779 <<
" y=" << Pts_in[i * 3 + 1]
1780 <<
" z=" << Pts_in[i * 3 + 2]
1799 ost <<
"\t\tprism { ";
1803 ost <<
", " << nb_pts + 1 << endl;
1804 ost <<
"\t\t\t< 0, 0 >," << endl;
1807 ost <<
", " << 0 <<
" >," << endl;
1812 ost <<
" >," << endl;
1813 for (i = 3; i < nb_pts; i++) {
1818 ost <<
" >," << endl;
1820 ost <<
"\t\t\t< 0, 0 >" << endl;
1821 ost <<
"\t\t\t " << options <<
" " << endl;
1828 ost <<
"\t\trotate<";
1830 ost <<
",0,0>" << endl;
1831 ost <<
"\t\trotate<0, ";
1833 ost <<
",0>" << endl;
1834 ost <<
"\t\trotate<0,0, ";
1837 ost <<
"\t\ttranslate<";
1844 ost <<
"\t\t}" << endl;
1852 int *selection,
int nb_select,
1853 std::string &options, ostream &ost)
1860 ost <<
" union{ // planes" << endl;
1863 for (i = 0; i < nb_select; i++) {
1867 for (h = 0; h < 3; h++) {
1878 ost <<
" " << options <<
" " << endl;
1880 ost <<
" }" << endl;
1885 std::string &options, ostream &ost)
1893 ost <<
" object{" << endl;
1895 for (h = 0; h < 3; h++) {
1904 ost <<
" " << options <<
" " << endl;
1906 ost <<
" }" << endl;
1911 int *selection,
int nb_select,
1912 double rad, std::string &options, ostream &ost)
1919 ost <<
" union{ // points" << endl;
1921 ost <<
" #declare r=" << rad <<
";" << endl;
1923 for (i = 0; i < nb_select; i++) {
1927 for (h = 0; h < 3; h++) {
1933 ost <<
">, r }" << endl;
1936 ost <<
" " << options <<
" " << endl;
1941 ost <<
" }" << endl;
1945 std::string &options, std::ostream &ost)
1951 ost <<
" union{ // cubics" << endl;
1953 for (i = 0; i < nb_select; i++) {
1957 cout <<
"scene::draw_cubic_with_selection j=" << j <<
":" << endl;
1958 for (h = 0; h < 20; h++) {
1959 cout << h <<
" : " << Cubic_coords[j * 20 + h] << endl;
1961 ost <<
" poly{3, <";
1963 for (h = 0; h < 20; h++) {
1972 ost <<
" " << options <<
" " << endl;
1977 ost <<
" }" << endl;
1978 ost <<
" }" << endl;
1982 std::string &options, std::ostream &ost)
1988 ost <<
" union{ // quartics" << endl;
1990 for (i = 0; i < nb_select; i++) {
1994 cout <<
"scene::draw_quartic_with_selection j=" << j <<
":" << endl;
1995 for (h = 0; h < 35; h++) {
1996 cout << h <<
" : " << Quartic_coords[j * 35 + h] << endl;
1998 ost <<
" poly{4, <";
2000 for (h = 0; h < 35; h++) {
2009 ost <<
" " << options <<
" " << endl;
2014 ost <<
" }" << endl;
2015 ost <<
" }" << endl;
2019 std::string &options, std::ostream &ost)
2025 ost <<
" union{ // quintics" << endl;
2027 for (i = 0; i < nb_select; i++) {
2031 cout <<
"scene::draw_quintic_with_selection j=" << j <<
":" << endl;
2032 for (h = 0; h < 56; h++) {
2033 cout << h <<
" : " << Quintic_coords[j * 56 + h] << endl;
2035 ost <<
" poly{5, <";
2037 for (h = 0; h < 56; h++) {
2046 ost <<
" " << options <<
" " << endl;
2051 ost <<
" }" << endl;
2052 ost <<
" }" << endl;
2056 std::string &options, std::ostream &ost)
2062 ost <<
" union{ // octics" << endl;
2064 for (i = 0; i < nb_select; i++) {
2068 cout <<
"scene::draw_quartic_with_selection j=" << j <<
":" << endl;
2069 for (h = 0; h < 165; h++) {
2070 cout << h <<
" : " << Quartic_coords[j * 165 + h] << endl;
2072 ost <<
" poly{8, <";
2074 for (h = 0; h < 165; h++) {
2083 ost <<
" " << options <<
" " << endl;
2088 ost <<
" }" << endl;
2089 ost <<
" }" << endl;
2093 std::string &options, ostream &ost)
2099 ost <<
" union{ // quadrics" << endl;
2101 for (i = 0; i < nb_select; i++) {
2104 ost <<
" poly{2, <";
2106 for (h = 0; h < 10; h++) {
2112 ost <<
">}" << endl;
2115 ost <<
" " << options <<
" " << endl;
2120 ost <<
" }" << endl;
2124 std::string &options, ostream &ost)
2130 ost <<
" object{ // quadric clipped by plane" << endl;
2132 ost <<
" poly{2, <";
2133 for (h = 0; h < 10; h++) {
2139 ost <<
">}" << endl;
2140 ost <<
" clipped_by{ plane{<";
2153 ost <<
" " << options <<
" " << endl;
2158 ost <<
" }" << endl;
2163 std::string &options, ostream &ost)
2169 ost <<
" object{ // line with clipping" << endl;
2171 ost <<
" #declare r=" <<
line_radius <<
"; " << endl;
2174 ost <<
" cylinder{<";
2175 for (h = 0; h < 3; h++) {
2182 for (h = 0; h < 3; h++) {
2188 ost <<
">, r }" << endl;
2189 ost <<
" clipped_by{ plane{<";
2200 ost <<
" " << options <<
"" << endl;
2202 ost <<
" }" << endl;
2210 int &intersection_point_idx,
2213 int f_v = (verbose_level >= 1);
2224 cout <<
"scene::intersect_line_and_plane" << endl;
2227 cout <<
"scene::intersect_line_and_plane line_idx=" << line_idx << endl;
2228 cout <<
"scene::intersect_line_and_plane plane_idx=" << plane_idx << endl;
2247 M[0 * 4 + 3] = -1. * Line_coords[line_idx * 6 + 0];
2248 M[1 * 4 + 3] = -1. * Line_coords[line_idx * 6 + 1];
2249 M[2 * 4 + 3] = -1. * Line_coords[line_idx * 6 + 2];
2253 for (i = 0; i < 3; i++) {
2254 v[i] = Line_coords[line_idx * 6 + 3 + i] -
2255 Line_coords[line_idx * 6 + i];
2256 M[i * 4 + 0] = v[i];
2260 cout <<
"scene::intersect_line_and_plane M=" << endl;
2267 B[0 * 3 + 0] = Plane_coords[plane_idx * 4 + 0];
2268 B[0 * 3 + 1] = Plane_coords[plane_idx * 4 + 1];
2269 B[0 * 3 + 2] = Plane_coords[plane_idx * 4 + 2];
2273 a = 1. / B[0 * 3 + 0];
2274 for (i = 0; i < 3; i++) {
2288 cout <<
"scene::intersect_line_and_plane "
2289 "ABS(B[0 * 3 + 0]) is too small" << endl;
2292 a = 1. / B[0 * 3 + 1];
2293 for (i = 0; i < 3; i++) {
2294 B[3 + i] = B[i] * a;
2307 cout <<
"scene::intersect_line_and_plane "
2308 "ABS(B[0 * 3 + 0]) and ABS(B[0 * 3 + 1]) are too small" << endl;
2311 a = 1. / B[0 * 3 + 2];
2312 for (i = 0; i < 3; i++) {
2313 B[6 + i] = B[i] * a;
2325 cout <<
"scene::intersect_line_and_plane the first three entries of B are zero" << endl;
2331 M[0 * 4 + 1] = -1. * B[0 * 3 + b1];
2332 M[1 * 4 + 1] = -1. * B[1 * 3 + b1];
2333 M[2 * 4 + 1] = -1. * B[2 * 3 + b1];
2335 M[0 * 4 + 2] = -1. * B[0 * 3 + b2];
2336 M[1 * 4 + 2] = -1. * B[1 * 3 + b2];
2337 M[2 * 4 + 2] = -1. * B[2 * 3 + b2];
2345 a = B[0] * Plane_coords[plane_idx * 4 + 0];
2346 a += B[1] * Plane_coords[plane_idx * 4 + 1];
2347 a += B[2] * Plane_coords[plane_idx * 4 + 2];
2352 av = (1. / a) * Plane_coords[plane_idx * 4 + 3];
2353 for (i = 0; i < 3; i++) {
2357 M[0 * 4 + 3] += B[0];
2358 M[1 * 4 + 3] += B[1];
2359 M[2 * 4 + 3] += B[2];
2367 cout <<
"scene::intersect_line_and_plane "
2368 "before Gauss elimination:" << endl;
2377 cout <<
"scene::intersect_line_and_plane "
2378 "after Gauss elimination:" << endl;
2384 cout <<
"scene::intersect_line_and_plane "
2385 "the matrix M does not have full rank" << endl;
2388 lambda = 1. * M[0 * 4 + 3];
2389 for (i = 0; i < 3; i++) {
2390 B[i] = Line_coords[line_idx * 6 + i] + lambda * v[i];
2394 cout <<
"scene::intersect_line_and_plane "
2395 "The intersection point is "
2396 << B[0] <<
", " << B[1] <<
", " << B[2] << endl;
2398 point(B[0], B[1], B[2]);
2403 cout <<
"scene::intersect_line_and_plane done" << endl;
2412 int f_v = (verbose_level >= 1);
2417 cout <<
"scene::intersect_line_and_line" << endl;
2420 double pt_coords[3];
2423 &Line_coords[line1_idx * 6 + 0], &Line_coords[line1_idx * 6 + 3],
2424 &Line_coords[line2_idx * 6 + 0], &Line_coords[line2_idx * 6 + 3],
2429 point(pt_coords[0], pt_coords[1], pt_coords[2]);
2432 cout <<
"scene::intersect_line_and_line done" << endl;
2439 double x1,
double x2,
double x3,
2440 double y1,
double y2,
double y3,
double r)
2444 double a, b, c, av, d, e;
2445 double lambda1, lambda2;
2458 a = v[0] * v[0] + v[1] * v[1] + v[2] * v[2];
2459 b = 2 * (x1 * v[0] + x2 * v[1] + x3 * v[2]);
2460 c = x1 * x1 + x2 * x2 + x3 * x3 - r * r;
2464 d = b * b * 0.25 - c;
2466 cout <<
"line_extended d < 0" << endl;
2467 return line(x1, x2, x3, y1, y2, y3);
2470 lambda1 = -b * 0.5 + e;
2471 lambda2 = -b * 0.5 - e;
2472 Line_coords[
nb_lines * 6 + 0] = x1 + lambda1 * v[0];
2473 Line_coords[
nb_lines * 6 + 1] = x2 + lambda1 * v[1];
2474 Line_coords[
nb_lines * 6 + 2] = x3 + lambda1 * v[2];
2475 Line_coords[
nb_lines * 6 + 3] = x1 + lambda2 * v[0];
2476 Line_coords[
nb_lines * 6 + 4] = x2 + lambda2 * v[1];
2477 Line_coords[
nb_lines * 6 + 5] = x3 + lambda2 * v[2];
2480 cout <<
"too many lines" << endl;
2487 int plane_idx,
int line_idx,
double spread,
2489 int *New_line_idx,
int &nb_new_lines,
2490 int *New_pt_idx,
int &nb_new_points,
2493 int f_v = (verbose_level >= 1);
2494 double line_pt1_in[3], line_pt2_in[3];
2495 double line_pt1[3], line_pt2[3];
2496 double direction[3], direction_step[3];
2502 cout <<
"map_a_line" << endl;
2507 N.
vec_copy(Line_coords + line_idx * 6, line_pt1_in, 3);
2508 N.
vec_copy(Line_coords + line_idx * 6 + 3, line_pt2_in, 3);
2510 line_pt1, line_pt2, spread , verbose_level - 1);
2512 for (i = 0; i < 3; i++) {
2513 direction[i] = line_pt2[i] - line_pt1[i];
2515 for (i = 0; i < 3; i++) {
2516 direction_step[i] = direction[i] / (double) (nb_pts - 1);
2518 for (h = 0; h < nb_pts; h++) {
2520 cout <<
"map_a_line point " << h <<
" / "
2521 << nb_pts <<
":" << endl;
2523 for (i = 0; i < 3; i++) {
2524 line_pt[i] = line_pt1[i] + (double) h * direction_step[i];
2527 New_pt_idx[nb_new_points] =
point(line_pt[0], line_pt[1], line_pt[2]);
2531 New_line_idx[nb_new_lines], New_pt_idx[nb_new_points],
2541 cout <<
"map_a_line done" << endl;
2546 int plane_idx,
double pt_in[3],
2547 int &new_line_idx,
int &new_pt_idx,
2550 int f_v = (verbose_level >= 1);
2552 double line1_pt1[4], line1_pt2[4];
2553 double line2_pt1[4], line2_pt2[4];
2564 cout <<
"map_a_point" << endl;
2567 N.
vec_copy(Line_coords + line1 * 6, line1_pt1, 3);
2569 N.
vec_copy(Line_coords + line1 * 6 + 3, line1_pt2, 3);
2572 N.
vec_copy(Line_coords + line2 * 6, line2_pt1, 3);
2574 N.
vec_copy(Line_coords + line2 * 6 + 3, line2_pt2, 3);
2582 cout <<
"M1:" << endl;
2591 cout <<
"M2:" << endl;
2597 cout <<
"map_a_point k1 != 1" << endl;
2601 cout <<
"M1 after:" << endl;
2603 cout <<
"K1:" << endl;
2609 cout <<
"map_a_point k2 != 1" << endl;
2613 cout <<
"K2:" << endl;
2621 cout <<
"map_a_point k3 != 2" << endl;
2625 cout <<
"K4:" << endl;
2631 if (
ABS(K4[3] - 1.) > 0.01 &&
ABS(K4[4 + 3] - 1.) > 0.01) {
2632 cout <<
"K4 (1) and (2) are not affine points, "
2633 "this is not good" << endl;
2636 if (
ABS(K4[3] - 1.) > 0.01) {
2637 for (i = 0; i < 4; i++) {
2638 K4[i] = K4[i] + K4[4 + i];
2641 if (
ABS(K4[3] - 1.) > 0.01) {
2642 cout <<
"after fixing, K4 (1) is not an affine point, "
2643 "this is not good" << endl;
2647 else if (
ABS(K4[4 + 3] - 1.) > 0.01) {
2648 for (i = 0; i < 4; i++) {
2649 K4[4 + i] = K4[i] + K4[4 + i];
2652 if (
ABS(K4[4 + 3] - 1.) > 0.01) {
2653 cout <<
"after fixing, K4 (2) is not an affine point, "
2654 "this is not good" << endl;
2659 K4[4 + 0], K4[4 + 1], K4[4 + 2], 10.);
2665 cout <<
"map_a_point done" << endl;
2680 for (r = 0; r < 2; r++) {
2687 for (i = 0; i < 2; i++) {
2689 for (j = 0; j < 2; j++) {
2691 for (k = 0; k < 2; k++) {
2693 for (h = 0; h < 3; h++) {
2701 point(x[0], x[1], x[2]);
2708 rescale(first_pt_idx, rad_desired);
2718 for (i = first_pt_idx; i <
nb_points; i++) {
2720 Point_coords + i * 3, 3);
2721 if (i == first_pt_idx) {
2730 a = rad_desired / rad;
2750 Point_coords[pt * 3 + 0],
2751 Point_coords[pt * 3 + 1], Point_coords[pt * 3 + 2]);
2760 for (i = 0; i < 8; i++) {
2761 edge(first_pt_idx + i, first_pt_idx + 8 + i);
2763 for (i = 0; i < 8; i++) {
2764 for (j = i + 1; j < 8; j++) {
2766 cout <<
"i=" << i <<
" j=" << j <<
" d=" << d << endl;
2767 if (
ABS(d - 2) < 0.2) {
2768 cout <<
"EDGE " << i <<
", " << j << endl;
2769 edge(first_pt_idx + i, first_pt_idx + j);
2770 edge(first_pt_idx + 8 + i, first_pt_idx + 8 + j);
2788 int N, i, j, h, k, d;
2803 Basis =
new double [n * 3];
2808 Basis[0 * 3 + 0] = sqrt(8./9.);
2809 Basis[0 * 3 + 1] = 0;
2810 Basis[0 * 3 + 2] = -1 / 3.;
2811 Basis[1 * 3 + 0] = -sqrt(2./9.);
2812 Basis[1 * 3 + 1] = sqrt(2/3);
2813 Basis[1 * 3 + 2] = -1 / 3.;
2814 Basis[2 * 3 + 0] = -sqrt(2./9.);
2815 Basis[2 * 3 + 1] = -sqrt(2/3);
2816 Basis[2 * 3 + 2] = -1 / 3.;
2817 Basis[3 * 3 + 0] = 0;
2818 Basis[3 * 3 + 1] = 0;
2819 Basis[3 * 3 + 2] = -1 / 3.;
2823 for (i = 0; i < n; i++) {
2825 Basis[i * 3 + 0] = cos(
M_PI * t);
2826 Basis[i * 3 + 1] = sin(
M_PI * t);
2827 Basis[i * 3 + 2] = t;
2830 for (i = 0; i < n; i++) {
2834 for (h = 0; h < N; h++) {
2836 for (j = 0; j < 3; j++) {
2839 for (i = 0; i < n; i++) {
2841 for (j = 0; j < 3; j++) {
2842 x[j] += Basis[i * 3 + j];
2846 for (j = 0; j < 3; j++) {
2847 x[j] -= Basis[i * 3 + j];
2851 point(x[0], x[1], x[2]);
2853 for (h = 0; h < N; h++) {
2855 for (k = h + 1; k < N; k++) {
2858 for (i = 0; i < n; i++) {
2864 edge(first_pt_idx + h, first_pt_idx + k);
2870 rescale(first_pt_idx, rad_desired);
2880 double one, minus_one;
2881 double phi, minus_phi;
2882 double phi_inv, minus_phi_inv;
2886 phi = (1. + sqrt(5)) * 0.5;
2887 phi_inv = (sqrt(5) - 1.) * 0.5;
2888 minus_one = -1. * one;
2889 minus_phi = -1. * phi;
2890 minus_phi_inv = -1. * phi_inv;
2894 point(one,one,minus_one);
2895 point(one,minus_one,one);
2896 point(one,minus_one,minus_one);
2897 point(minus_one,one,one);
2898 point(minus_one,one,minus_one);
2899 point(minus_one,minus_one,one);
2900 point(minus_one,minus_one,minus_one);
2902 point(zero,phi,phi_inv);
2903 point(zero,phi,minus_phi_inv);
2904 point(zero,minus_phi,phi_inv);
2905 point(zero,minus_phi,minus_phi_inv);
2907 point(phi_inv,zero,phi);
2908 point(phi_inv,zero,minus_phi);
2909 point(minus_phi_inv,zero,phi);
2910 point(minus_phi_inv,zero,minus_phi);
2912 point(phi,phi_inv,zero);
2913 point(phi,minus_phi_inv,zero);
2914 point(minus_phi,phi_inv,zero);
2915 point(minus_phi,minus_phi_inv,zero);
2936 double two_over_phi;
2938 phi = (1. + sqrt(5)) * 0.5;
2939 two_over_phi = 2. / phi;
2941 for (i = 0; i < 20; i++) {
2942 for (j = i + 1; j < 20; j++) {
2944 first_pt_idx + i, first_pt_idx + j);
2947 if (
ABS(d - two_over_phi) < 0.2) {
2948 cout <<
"EDGE " << i <<
", " << j << endl;
2949 edge(first_pt_idx + i, first_pt_idx + j);
2968 for (i = 0; i < 12; i++) {
2969 faces[i] += first_pt_idx;
2989 for (i = 0; i < 12 * 5; i++) {
2990 faces[i] += first_pt_idx;
2992 for (i = 0; i < 12; i++) {
2993 face(faces + i * 5, 5);
3000 plane(1/sqrt(3),1/sqrt(3),1/sqrt(3), 3*1/sqrt(3));
3001 plane(1/sqrt(3),1/sqrt(3),1/sqrt(3), 1*1/sqrt(3));
3002 plane(1/sqrt(3),1/sqrt(3),1/sqrt(3), -1*1/sqrt(3));
3012 double coeff[20] = {-3,7,7,1,7,-2,-14,7,-14,3,-3,7,1,7,-14,3,-3,1,3,-1.};
3023 (-sqrt(5)-3) * t1 + (3*sqrt(5)+7)/2 , t1 , -sqrt(5) * t1 +(sqrt(5)+3)/2 ,
3024 (-sqrt(5)-3) * t2 + (3*sqrt(5)+7)/2 , t2 , -sqrt(5) * t2 +(sqrt(5)+3)/2);
3028 -sqrt(5) * t1 +(sqrt(5)+3)/2, (-sqrt(5)-3) * t1 + (3*sqrt(5)+7)/2 , t1 ,
3029 -sqrt(5) * t2 +(sqrt(5)+3)/2, (-sqrt(5)-3) * t2 + (3*sqrt(5)+7)/2 , t2);
3033 t1, -sqrt(5) * t1 +(sqrt(5)+3)/2, (-sqrt(5)-3) * t1 + (3*sqrt(5)+7)/2 ,
3034 t2, -sqrt(5) * t2 +(sqrt(5)+3)/2, (-sqrt(5)-3) * t2 + (3*sqrt(5)+7)/2);
3038 -(sqrt(5)+3)/4 * t1 + (-sqrt(5)+3)/4 , t1 , (sqrt(5)+1)/4 + (-3*sqrt(5)-5)/4 * t1 ,
3039 -(sqrt(5)+3)/4 * t2 + (-sqrt(5)+3)/4 , t2 , (sqrt(5)+1)/4 + (-3*sqrt(5)-5)/4 * t2);
3043 (sqrt(5)+1)/4 + (-3*sqrt(5)-5)/4 * t1, -(sqrt(5)+3)/4 * t1 + (-sqrt(5)+3)/4 , t1 ,
3044 (sqrt(5)+1)/4 + (-3*sqrt(5)-5)/4 * t2, -(sqrt(5)+3)/4 * t2 + (-sqrt(5)+3)/4 , t2);
3048 t1, (sqrt(5)+1)/4 + (-3*sqrt(5)-5)/4 * t1, -(sqrt(5)+3)/4 * t1 + (-sqrt(5)+3)/4 ,
3049 t2, (sqrt(5)+1)/4 + (-3*sqrt(5)-5)/4 * t2, -(sqrt(5)+3)/4 * t2 + (-sqrt(5)+3)/4);
3060 (sqrt(5)-3) * t1 + (-3*sqrt(5)+7)/2 , t1 , (-sqrt(5)+3)/2 + sqrt(5) * t1 ,
3061 (sqrt(5)-3) * t2 + (-3*sqrt(5)+7)/2 , t2 , (-sqrt(5)+3)/2 + sqrt(5) * t2);
3065 (-sqrt(5)+3)/2 + sqrt(5) * t1, (sqrt(5)-3) * t1 + (-3*sqrt(5)+7)/2 , t1 ,
3066 (-sqrt(5)+3)/2 + sqrt(5) * t2, (sqrt(5)-3) * t2 + (-3*sqrt(5)+7)/2 , t2);
3070 t1, (-sqrt(5)+3)/2 + sqrt(5) * t1, (sqrt(5)-3) * t1 + (-3*sqrt(5)+7)/2 ,
3071 t2, (-sqrt(5)+3)/2 + sqrt(5) * t2, (sqrt(5)-3) * t2 + (-3*sqrt(5)+7)/2);
3075 (sqrt(5)-3)/4 * t1 + (sqrt(5)+3)/4 , t1 , (-sqrt(5)+1)/4 + (3*sqrt(5)-5)/4 * t1 ,
3076 (sqrt(5)-3)/4 * t2 + (sqrt(5)+3)/4 , t2 , (-sqrt(5)+1)/4 + (3*sqrt(5)-5)/4 * t2);
3080 (-sqrt(5)+1)/4 + (3*sqrt(5)-5)/4 * t1, (sqrt(5)-3)/4 * t1 + (sqrt(5)+3)/4 , t1 ,
3081 (-sqrt(5)+1)/4 + (3*sqrt(5)-5)/4 * t2, (sqrt(5)-3)/4 * t2 + (sqrt(5)+3)/4 , t2);
3085 t1, (-sqrt(5)+1)/4 + (3*sqrt(5)-5)/4 * t1, (sqrt(5)-3)/4 * t1 + (sqrt(5)+3)/4 ,
3086 t2, (-sqrt(5)+1)/4 + (3*sqrt(5)-5)/4 * t2, (sqrt(5)-3)/4 * t2 + (sqrt(5)+3)/4);
3096 line(-1. * b, -3. * b - 1, 0., b, 3. * b - 1, 0.);
3101 line(-3. * b -1, 0, -1. * b, 3. * b - 1, 0, b);
3106 line(b, -1. * b, -1., -1. * b, b, -1.);
3111 line(2. + b, 1, -1. * b, 2. -1. * b, 1, b);
3117 line(0, b + 1, -1. * b , 0, -1.*b + 1, b);
3122 line(0, -1. * b, -3. * b -1., 0, b, 3. * b - 1.);
3127 line(b + 1, 0, -1. * b, -1. * b + 1, 0, b);
3132 line(-1, b, -1. * b, -1, -1. * b, b);
3137 line(2. + b, -1. * b, 1., 2. -1. * b, b, 1.);
3142 line(1, 2. + b, -1. * b, 1, 2. -1. * b, b);
3147 line(b + 1, -1. * b, 0., -1. * b + 1, b, 0.);
3152 line(b, -1, -1. * b, -1. * b, -1, b);
3157 line(0, -3. * b - 1, -1. * b, 0, 3. * b - 1, b);
3162 line(-3. * b - 1, -1. * b, 0., 3. * b - 1, b, 0.);
3167 line(-1. * b, 0, -3. * b - 1., b, 0, 3. * b - 1.);
3251#define scene_alpha ((1. + sqrt(5)) * .5)
3252#define scene_beta ((-1. + sqrt(5)) * .5)
3267 for (i = 0; i < 6; i++) {
3269 if (
ABS(L[3]) < 0.001 &&
ABS(L[7]) < 0.001) {
3270 cout <<
"scene::clebsch_cubic_version2_lines_a line A" << i <<
" lies at infinity" << endl;
3273 if (
ABS(L[7]) >
ABS(L[3])) {
3280 for (j = 0; j < 4; j++) {
3281 L[4 + j] += L[j] * a;
3283 line_extended(L[0], L[1], L[2], L[0] + L[4], L[1] + L[5], L[2] + L[6], 10.);
3300 for (i = 0; i < 6; i++) {
3302 if (
ABS(L[3]) < 0.001 &&
ABS(L[7]) < 0.001) {
3303 cout <<
"scene::clebsch_cubic_version2_lines_b line B" << i <<
" lies at infinity" << endl;
3306 if (
ABS(L[7]) >
ABS(L[3])) {
3313 for (j = 0; j < 4; j++) {
3314 L[4 + j] += L[j] * a;
3316 line_extended(L[0], L[1], L[2], L[0] + L[4], L[1] + L[5], L[2] + L[6], 10.);
3347 for (i = 0; i < 15; i++) {
3349 if (
ABS(L[3]) < 0.001 &&
ABS(L[7]) < 0.001) {
3350 cout <<
"scene::clebsch_cubic_version2_lines_c line C" << i <<
" lies at infinity" << endl;
3353 if (
ABS(L[7]) >
ABS(L[3])) {
3360 for (j = 0; j < 4; j++) {
3361 L[4 + j] += L[j] * a;
3363 line_extended(L[0], L[1], L[2], L[0] + L[4], L[1] + L[5], L[2] + L[6], 10.);
3377 x1 = Point_coords[pt1 * 3 + 0];
3378 x2 = Point_coords[pt1 * 3 + 1];
3379 x3 = Point_coords[pt1 * 3 + 2];
3380 y1 = Point_coords[pt2 * 3 + 0];
3381 y2 = Point_coords[pt2 * 3 + 1];
3382 y3 = Point_coords[pt2 * 3 + 2];
3386 d = sqrt(d1 * d1 + d2 * d2 + d3 * d3);
3392 plane(0., 0., 1., 0.);
3393 plane(0., 1., 0., 0.);
3397 0., (sqrt(5) + 1.)/2., (-sqrt(5) + 3.)/2.,
3400 (-sqrt(5)-1.)/2., 1., (sqrt(5)+3.)/2.,
3407 int f_v = (verbose_level >= 1);
3411 cout <<
"scene::create_Clebsch_surface" << endl;
3416 cout <<
"scene::create_Clebsch_surface creating lines" << endl;
3429 for (i = 0; i < 27; i++) {
3432 cout <<
"scene::create_Clebsch_surface creating line" << i << endl;
3438 double coeff[20] = {0,0,0,-1,0,5./2.,0,0,0,0,0,0,-1,0,0,0,0,-1,0,1};
3443 for (i = 0; i < 45; i++) {
3454 cout <<
"scene::create_Clebsch_surface done" << endl;
3461 int f_v = (verbose_level >= 1);
3465 cout <<
"scene::create_Hilbert_Cohn_Vossen_surface" << endl;
3470 cout <<
"scene::create_Hilbert_Cohn_Vossen_surface creating lines" << endl;
3475 for (i = 0; i < 27; i++) {
3478 cout <<
"scene::create_Hilbert_Cohn_Vossen_surface creating line" << i << endl;
3484 double coeff[20] = {0,0,0,-1,0,5./2.,0,0,0,0,0,0,-1,0,0,0,0,-1,0,1};
3489 for (i = 0; i < 45; i++) {
3498 cout <<
"scene::create_Hilbert_Cohn_Vossen_surface done" << endl;
3505 int f_v = (verbose_level >= 1);
3509 cout <<
"scene::create_Hilbert_model" << endl;
3518 cout <<
"scene::create_Hilbert_model before create_Hilbert_cube" << endl;
3522 cout <<
"scene::create_Hilbert_model after create_Hilbert_cube" << endl;
3585 cout <<
"scene::create_Hilbert_model creating edges for double six" << endl;
3611 cout <<
"scene::create_Hilbert_model creating the tetrahedron" << endl;
3640 point(4./5., -2./5.,-1.);
3641 point(4./5., -1.,-8./5.);
3642 point(1., -2./5.,-4./5.);
3643 point(8./5., -1.,-4./5.);
3644 point(-2./5., 4./5., -1.);
3645 point(-1., 4./5.,-8./5.);
3649 point(8./5., 1.,4./5.);
3650 point(-4./5., -8./5.,1.);
3651 point(1.,-4./5., -8./5.);
3652 point(-4./5.,-1., 2./5.);
3653 point(2./5.,-4./5.,-1.);
3654 point(1.,2./5.,4./5.);
3655 point(2./5.,-1.,-4./5.);
3656 point(1.,-8./5.,-4./5.);
3662 -1./2., -1., 1., 1.,
3664 -5./7., -5./7., 5./7., 1.,
3668 (double)5/(
double)4,0,0,1,
3723 for (i = 0; i < 12 + 45; i++) {
3730 cout <<
"scene::create_Hilbert_model creating lines" << endl;
3734 for (i = 0; i < 27; i++) {
3737 cout <<
"scene::create_Hilbert_model creating line" << i << endl;
3739 line_pt_and_dir(Hilbert_Cohn_Vossen_Lines + i * 6, r, verbose_level - 1);
3743 double coeff[20] = {0,0,0,-1,0,5./2.,0,0,0,0,0,0,-1,0,0,0,0,-1,0,1};
3748 double coeff[10] = {-2,-5,5,5,-2,-5,-5,-2,5,7};
3754 double coeff_in[20] = {0,0,0,0,0,1,1,0,1,0,0,0,0,0,1,0,0,0,0,0};
3755 double coeff_out[20];
3757 for (i = 0; i < 20; i++) {
3776 cout <<
"scene::create_Hilbert_model before substitute_cubic_linear_using_povray_ordering" << endl;
3779 coeff_in, coeff_out,
3783 cout <<
"i : coeff_in[i] : coeff_out[i]" << endl;
3784 for (i = 0; i < 20; i++) {
3785 cout << i <<
" : " << coeff_in[i] <<
" : " << coeff_out[i] << endl;
3793 3 : 0 : -0.0625 : x^2
3802 12 : 0 : -0.0625 : y^2
3807 17 : 0 : -0.0625 : z^2
3814 int pts[4] = {0, 6, 3, 5};
3818 cout <<
"scene::create_Hilbert_model lines on Cayley's nodal" << endl;
3829 for (i = 0; i < 4; i++) {
3830 pts[0] =
point(A4[0 * 4 + 0], A4[0 * 4 + 1], A4[0 * 4 + 2]);
3843 cout <<
"scene::create_Hilbert_model fermat" << endl;
3845 double coeff_fermat[20] = {1,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,1,0,0,1};
3846 cubic(coeff_fermat);
3855 for (i = 0; i < 3; i++) {
3862 double coeff_cayley_ruled[20] =
3863 {0,0,0,-1,0,1,0,0,0,0,-1,0,0,0,0,0,0,0,0,0};
3864 cubic(coeff_cayley_ruled);
3867 double coeff_cayley_ruled2[20] =
3868 {0,0,0,0,0,0,0,0,0,-1,0,0,0,0,1,0,-1,0,0,0};
3869 cubic(coeff_cayley_ruled2);
3871 double coeff_cayley_ruled3[20] =
3872 {-1,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,-1,0};
3873 cubic(coeff_cayley_ruled3);
3877 cout <<
"scene::create_Hilbert_model create lines on Cayley's ruled surface" << endl;
3883 double phi, delta_phi;
3886 int nb_lines_wanted = 18;
3887 int nb_lines_actual = 0;
3888 delta_phi =
M_PI / nb_lines_wanted;
3889 for (i = 0; i < nb_lines_wanted; i++) {
3890 phi =
M_PI / 2 + (double) i * delta_phi;
3893 if (
ABS(s0) > 0.01) {
3895 Line[1] = Line[0] * Line[0];
3901 cout <<
"creating line " << i <<
" phi=" << phi <<
" ";
3909 cout <<
"line could not be created" << endl;
3914 cout <<
"nb_lines0 = " << nb_lines0 << endl;
3915 cout <<
"nb_lines_actual = " << nb_lines_actual << endl;
3916 cout <<
"nb_lines = " <<
nb_lines << endl;
3921 cout <<
"scene::create_Hilbert_model create osculating_tangent_line" << endl;
3923 double osculating_tangent_line[6] = {0,0,0,1,0,0};
3928 double coeff[10] = {2,5,5,5,2,5,5,2,5,3};
3933 double coeff[10] = {-4,-10,0,0,-4,0,0,1,5,4};
3938 double coeff[10] = {-2,0,-5,0,8,0,10,-2,0,2};
3943 double coeff[10] = {-2,-5,-5,-5,-2,5,5,-2,5,7};
3948 cout <<
"scene::create_Hilbert_model create coeff_surf_lifted" << endl;
3951 double coeff_surf_lifted[20] = {0, 0, 0, -4/(double)25,
3952 0, -1, 1, 0, 1, -41/(
double)25,
3953 0, 0, -1, 0, -2, 4, 0, -1, 4, -91/(double)25};
3957 cubic(coeff_surf_lifted);
3960 double coeff_surf_lifted[20] = {0, 0, 0, (double)-1/(
double)4, 0,
3961 (double)-5/(
double)4, 0, 0, 0, (double)-6/(
double)5,
3962 0, 0, -1, 0, -3, 0, 0, -1, 0, (double)-11/(
double)25};
3963 cubic(coeff_surf_lifted);
3967 cout <<
"scene::create_Hilbert_model create long lines" << endl;
3972 cout <<
"the long lines start at " <<
nb_lines << endl;
3974 for (i = 0; i < 27; i++) {
3975 line_pt_and_dir(Hilbert_Cohn_Vossen_Lines + i * 6, r, verbose_level - 1);
3987 cout <<
"scene::create_Hilbert_model done" << endl;
3993 int f_v = (verbose_level >= 1);
3998 cout <<
"scene::create_Cayleys_nodal_cubic" << endl;
4004 double coeff_in[20] = {0,0,0,0,0,1,1,0,1,0,0,0,0,0,1,0,0,0,0,0};
4005 double coeff_out[20];
4007 for (i = 0; i < 20; i++) {
4026 coeff_in, coeff_out,
4032 cout <<
"i : coeff_in[i] : coeff_out[i]" << endl;
4033 for (i = 0; i < 20; i++) {
4034 cout << i <<
" : " << coeff_in[i] <<
" : " << coeff_out[i] << endl;
40423 : 0 : -0.0625 : x^2
405112 : 0 : -0.0625 : y^2
405617 : 0 : -0.0625 : z^2
4060 idx =
cubic(coeff_out);
4061 cout <<
"created cubic " << idx << endl;
4064 int pts[4] = {0, 6, 3, 5};
4070 cout <<
"created line " << idx << endl;
4072 cout <<
"created line " << idx << endl;
4074 cout <<
"created line " << idx << endl;
4076 cout <<
"created line " << idx << endl;
4078 cout <<
"created line " << idx << endl;
4080 cout <<
"created line " << idx << endl;
4084 for (i = 0; i < 4; i++) {
4085 pts[0] =
point(A4[0 * 4 + 0], A4[0 * 4 + 1], A4[0 * 4 + 2]);
4092 cout <<
"scene::create_Cayleys_nodal_cubic done" << endl;
4098 int f_v = (verbose_level >= 1);
4102 cout <<
"scene::create_Hilbert_cube" << endl;
4112 cout <<
"scene::create_Hilbert_cube before create_cube" << endl;
4116 cout <<
"scene::create_Hilbert_cube after create_cube" << endl;
4171 cout <<
"scene::create_Hilbert_cube done" << endl;
4177 int f_v = (verbose_level >= 1);
4181 cout <<
"scene::create_cube" << endl;
4205 cout <<
"scene::create_cube done" << endl;
4211 int f_v = (verbose_level >= 1);
4215 cout <<
"scene::create_cube_and_tetrahedra" << endl;
4222 for (i = 0; i < 8; i++) {
4223 for (j = i + 1; j < 8; j++) {
4237 int first_three_face;
4241 cout <<
"first_three_face = " << first_three_face << endl;
4243 for (rk = 0; rk < nCk; rk++) {
4245 face3(set[0], set[1], set[2]);
4247 cout <<
"rk=" << rk <<
" set=";
4254 cout <<
"scene::create_cube_and_tetrahedra done" << endl;
4260 int f_v = (verbose_level >= 1);
4264 cout <<
"scene::create_affine_space" << endl;
4268 double half = 3.6 / sqrt(3);
4269 double dx = 2 * half / (double) q;
4270 double dx_half = dx * 0.5;
4275 basis[0] = sqrt(6) / 3.;
4276 basis[1] = -1 * sqrt(6) / 6.;
4277 basis[2] = -1 * sqrt(6) / 6.;
4279 basis[4] = sqrt(2) * 0.5;
4280 basis[5] = -1 * sqrt(2) * 0.5;
4286 cout <<
"dx = " << dx << endl;
4287 cout <<
"dx_half = " << dx_half << endl;
4296 cout <<
"start_point for affine space over F_" << q
4299 for (x = 0; x < q; x++) {
4300 for (y = 0; y < q; y++) {
4301 for (z = 0; z < q; z++) {
4303 -half + x * dx + dx_half, basis + 0,
4304 -half + y * dx + dx_half, basis + 3,
4305 -half + z * dx + dx_half, basis + 6,
4308 point(v[0], v[1], v[2]);
4314 cout <<
"scene::create_affine_space done" << endl;
4321 int f_v = (verbose_level >= 1);
4325 cout <<
"scene::create_Eckardt_surface" << endl;
4334 double coeff_orig[20] = {0,0,0,-1,0,2.5,0,0,0,0,0,0,-1,0,0,0,0,-1,0,1};
4366 double coeff_trans[20] = {1,0,0,0,-1,0,0,-1,0,-1,0,0,0,0,2.5,0,0,0,0,0};
4369 double coeff_out[20];
4389 coeff_orig, coeff_out,
4395 cout <<
"i : coeff_orig[i] : coeff_out[i]" << endl;
4396 for (i = 0; i < 20; i++) {
4397 cout << i <<
" : " << coeff_orig[i] <<
" : " << coeff_out[i] << endl;
44053 : 0 : -0.0625 : x^2
441412 : 0 : -0.0625 : y^2
441917 : 0 : -0.0625 : z^2
4425 double sqrt3 = sqrt(3.);
4426 double one_over_sqrt3 = 1. / sqrt3;
4428 plane(-1 * one_over_sqrt3, one_over_sqrt3, -1 * one_over_sqrt3, -1 * one_over_sqrt3);
4440 for (i = 0; i < 3; i++) {
4443 lines[k + 0], lines[k + 1], lines[k + 2],
4444 lines[k + 0] + lines[k + 3], lines[k + 1] + lines[k + 4], lines[k + 2] + lines[k + 5], 10);
4463 4./5., 3./5., 0, 0., 1., 1.,
4464 3./5., 0., 4./5., 1, 1., 0.,
4466 -4./5., 3./5., 0., 0., -1., 1.,
4467 -3./5., 0., -4./5., -1., 1., 0.,
4468 -3./5., 4./5., 0., 1., 0., 1.,
4469 -4./5., -3./5., 0., 0., -1., 1.,
4470 0., 1., 0., 1., 0., 0.,
4471 3./5., -4./5., 0., -1., 0., 1.,
4472 3./5., 0., -4./5., -1., 1., 0.,
4473 -3./5., -4./5., 0., -1., 0., 1.,
4474 0., 0., 1., 0., 1., 0.,
4475 4./5., -3./5., 0., 0., 1., 1.,
4476 -3./5., 0., 4./5., 1., 1., 0.,
4477 3./5., 4./5., 0., 1., 0., 1.,
4491 Lines4_in =
new double[27 * 2 * 4];
4492 Lines4_out =
new double[27 * 2 * 4];
4493 for (i = 0; i < 27; i++) {
4494 for (j = 0; j < 3; j++) {
4495 Lines4_in[i * 8 + j] = Lines[6 * i + j];
4496 Lines4_in[i * 8 + 4 + j] = Lines[6 * i + 3 + j];
4498 if (i == 14 || i == 19 || i == 23) {
4499 Lines4_in[i * 8 + 3] = 0;
4500 Lines4_in[i * 8 + 4 + 3] = 0;
4503 Lines4_in[i * 8 + 3] = 1;
4504 Lines4_in[i * 8 + 4 + 3] = 0;
4508 Lines4_in, T, Lines4_out, 2 * 27, 4, 4);
4516 -1./6.,-1./6.,0,-1./6.,-1./6.,1,
4527 1./6.,1./6.,0,1./6.,1./6.,1,
4532 1./9.,2./9.,0,-1./9.,-2./9.,1,
4534 -9./2.,-1./2.,0,-1,0,1,
4536 1,0,0,9./2.,1./2.,1,
4539 1./2.,9./2.,0,0,1,1,
4540 -9./2.,0,1./2.,1,1,0,
4543 0,-1,0,-1./2.,-9./2.,1,
4544 -2./9.,-1./9.,0,2./9.,1./9.,1,
4548 for (i = 0; i < 27; i++) {
4562 cout <<
"scene::create_Eckardt_surface done" << endl;
4568 int f_v = (verbose_level >= 1);
4571 cout <<
"scene::create_E4_surface" << endl;
4582 double coeff_orig[20] = {0,0,0,2,0,0,0,0,0,0,3,0,0,0,1,0,3,0,0,5};
4585 double coeff_trans[20] = {5,0,0,0,0,1,0,0,0,2,3,0,0,0,0,0,3,0,0,0};
4602 line_idx =
line6(x6);
4603 cout <<
"line_idx=" << line_idx << endl;
4607 cout <<
"scene::create_E4_surface done" << endl;
4619 cout <<
"scene::create_twisted_cubic" << endl;
4652 for (i = 0; i < N; i++) {
4653 t = i * 1. / (double) (N - 1);
4659 edge(8 + i, 8 + i - 1);
4668 int f_v = (verbose_level >= 1);
4672 cout <<
"scene::create_triangulation_of_cube" << endl;
4730 cout <<
"Line " << line_idx <<
" is ";
4731 Num.
vec_print(Line_coords + line_idx * 6 + 0, 3);
4733 Num.
vec_print(Line_coords + line_idx * 6 + 3, 3);
4742 cout <<
"Plane " << plane_idx <<
" : ";
4743 Num.
vec_print(Plane_coords + plane_idx * 4, 4);
4749 cout <<
"face " << face_idx <<
" has " << Nb_face_points[face_idx] <<
" points: ";
4750 Int_vec_print(cout, Face_points[face_idx], Nb_face_points[face_idx]);
4755#define MY_OWN_BUFSIZE ONE_MILLION
4759 int f_v = (verbose_level >= 1);
4765 double sx = 0, sy = 0, sz = 0;
4772 int nb_faces_read = 0;
4776 cout <<
"scene::read_obj_file" << endl;
4796 if (strlen(buf) == 0) {
4801 if (strncmp(buf,
"#", 1) == 0) {
4804 else if (strncmp(buf,
"v ", 2) == 0) {
4826 cout <<
"x coordinate out of range, skipping: " << x << endl;
4827 cout <<
"read line " << line_nb <<
" : '" << buf <<
"'" << endl;
4831 cout <<
"y coordinate out of range, skipping: " << y << endl;
4832 cout <<
"read line " << line_nb <<
" : '" << buf <<
"'" << endl;
4836 cout <<
"z coordinate out of range, skipping: " << z << endl;
4837 cout <<
"read line " << line_nb <<
" : '" << buf <<
"'" << endl;
4847 else if (strncmp(buf,
"f ", 2) == 0) {
4853 while (strlen(p_buf)) {
4856 if (strlen(str) == 0) {
4860 for (h = 0; h < l; h++) {
4861 if (str[h] ==
'/') {
4875 for (h = 0; h < l; h++) {
4876 w[h] = v[h] - 1 + nb_points0;
4878 if (w[l - 1] != w[0]) {
4886 if (
FALSE && idx == 2920) {
4887 cout <<
"added face " << idx <<
": ";
4890 for (h = 0; h < l; h++) {
4896 cout <<
"Point " << pt_idx <<
" : x="
4897 << x <<
" y=" << y <<
" z=" << z << endl;
4903 cout <<
"midpoint: " << sx / nb_pts <<
", " << sy / nb_pts <<
", " << sz / nb_pts << endl;
4904 cout <<
"x-interval: [" << x0 <<
", " << x1 <<
"]" << endl;
4905 cout <<
"y-interval: [" << y0 <<
", " << y1 <<
"]" << endl;
4906 cout <<
"z-interval: [" << z0 <<
", " << z1 <<
"]" << endl;
4907 cout <<
"number points read: " << nb_pts << endl;
4908 cout <<
"number faces read: " << nb_faces_read << endl;
4911 cout <<
"scene::read_obj_file done" << endl;
4917 int f_v = (verbose_level >= 1);
4922 cout <<
"scene::add_a_group_of_things" << endl;
4925 for (i = 0; i < sz; i++) {
4926 v.push_back(Idx[i]);
4934 cout <<
"scene::add_a_group_of_things done" << endl;
a collection of combinatorial functions
void unrank_k_subset(int rk, int *set, int n, int k)
long int int_n_choose_k(int n, int k)
various functions related to geometries
void AG_element_unrank(int q, int *v, int stride, int len, long int a)
a collection of 3D geometry objects
int line_through_two_pts(double *x6, double rad)
void draw_lines_cij(std::ostream &ost)
void draw_lines_cij_with_selection(int *selection, int nb_select, std::ostream &ost)
int line_extended(double x1, double x2, double x3, double y1, double y2, double y3, double r)
void transform_quartics(scene *S, double *A4, double *A4_inv, int verbose_level)
void draw_planes_with_selection(int *selection, int nb_select, std::string &options, std::ostream &ost)
void draw_points_with_selection(int *selection, int nb_select, double rad, std::string &options, std::ostream &ost)
void add_a_group_of_things(int *Idx, int sz, int verbose_level)
int edge(int pt1, int pt2)
int point(double x1, double x2, double x3)
void clebsch_cubic_lines_b()
void Dodecahedron_points()
void draw_plane(int idx, std::string &options, std::ostream &ost)
double cubic_coords(int idx, int j)
void create_Hilbert_cube(int verbose_level)
int edge_points(int idx, int j)
void create_E4_surface(int N, int verbose_level)
int line_pt_and_dir_and_copy_points(double *x6, double rad, int verbose_level)
void draw_quadric_with_selection(int *selection, int nb_select, std::string &options, std::ostream &ost)
void transform_quadrics(scene *S, double *A4, double *A4_inv, int verbose_level)
int line_pt_and_dir(double *x6, double rad, int verbose_level)
void rescale(int first_pt_idx, double rad_desired)
int cubic_Goursat_ABC(double A, double B, double C)
int line(double x1, double x2, double x3, double y1, double y2, double y3)
void clebsch_cubic_lines_cij()
void print_a_line(int line_idx)
void clebsch_cubic_version2_lines_b()
void create_Eckardt_surface(int N, int verbose_level)
int point_center_of_mass_of_edge(int edge_idx)
int point_as_intersection_of_two_lines(int line1, int line2)
std::vector< std::vector< int > > group_of_things
void map_a_line(int line1, int line2, int plane_idx, int line_idx, double spread, int nb_pts, int *New_line_idx, int &nb_new_lines, int *New_pt_idx, int &nb_new_points, int verbose_level)
double distance_from_origin(int pt)
int plane_from_dual_coordinates(double *x4)
void create_affine_space(int q, int verbose_level)
void clebsch_cubic_lines_a()
void create_five_plus_one()
int plane_through_three_points(int pt1, int pt2, int pt3)
int octic(double *coeff_165)
void draw_lines_cij_with_offset(int offset, int number_of_lines, std::ostream &ost)
double label(int idx, std::string &txt)
int triangle(int line1, int line2, int line3, int verbose_level)
int face3(int pt1, int pt2, int pt3)
void points(double *Coords, int nb_points)
void draw_lines_ai_with_selection(int *selection, int nb_select, std::ostream &ost)
void draw_lines_bj_with_selection(int *selection, int nb_select, std::ostream &ost)
void draw_lines_ai(std::ostream &ost)
void create_cube_and_tetrahedra(int verbose_level)
void print_a_face(int face_idx)
void create_Cayleys_nodal_cubic(int verbose_level)
void clebsch_cubic_version2_Hessian()
void draw_octic_with_selection(int *selection, int nb_select, std::string &options, std::ostream &ost)
int point_center_of_mass_of_face(int face_idx)
int affine_space_starting_point
void copy_edges(scene *S, double *A4, double *A4_inv, int verbose_level)
void create_cube(int verbose_level)
void draw_lines_bj_with_offset(int offset, std::ostream &ost)
void copy_faces(scene *S, double *A4, double *A4_inv, int verbose_level)
int face5(int pt1, int pt2, int pt3, int pt4, int pt5)
int line_after_recentering(double x1, double x2, double x3, double y1, double y2, double y3, double rad)
int quadric(double *coeff)
void transform_planes(scene *S, double *A4, double *A4_inv, int verbose_level)
void draw_line_clipped_by_plane(int line_idx, int plane_idx, std::string &options, std::ostream &ost)
int intersect_line_and_line(int line1_idx, int line2_idx, double &lambda, int verbose_level)
int map_a_point(int line1, int line2, int plane_idx, double pt_in[3], int &new_line_idx, int &new_pt_idx, int verbose_level)
double quadric_coords(int idx, int j)
void deformation_of_cubic_lex(int nb_frames, double angle_start, double angle_max, double angle_min, double *coeff1, double *coeff2, int verbose_level)
void transform_points(scene *S, double *A4, double *A4_inv, int verbose_level)
void clebsch_cubic_version2()
int quartic(double *coeff)
void draw_quintic_with_selection(int *selection, int nb_select, std::string &options, std::ostream &ost)
int intersect_line_and_plane(int line_idx, int plane_idx, int &intersection_point_idx, int verbose_level)
void clebsch_cubic_version2_lines_a()
int face4(int pt1, int pt2, int pt3, int pt4)
void draw_line_with_selection(int line_idx, std::string &options, std::ostream &ost)
void Dodecahedron_edges(int first_pt_idx)
std::vector< std::pair< int, std::string > > Labels
void fourD_cube_edges(int first_pt_idx)
double point_coords(int idx, int j)
void draw_face(int idx, double thickness_half, std::string &options, std::ostream &ost)
void transform_quintics(scene *S, double *A4, double *A4_inv, int verbose_level)
void create_twisted_cubic(int N, int verbose_level)
void read_obj_file(std::string &fname, int verbose_level)
double distance_euclidean_point_to_point(int pt1_idx, int pt2_idx)
void create_triangulation_of_cube(int N, int verbose_level)
void draw_edges_with_selection(int *selection, int nb_select, std::string &options, std::ostream &ost)
void draw_quartic_with_selection(int *selection, int nb_select, std::string &options, std::ostream &ost)
double point_distance_from_origin(int pt_idx)
void create_Hilbert_Cohn_Vossen_surface(int verbose_level)
int quintic(double *coeff_56)
int line_through_two_points(int pt1, int pt2, double rad)
void clebsch_cubic_version2_lines_c()
void draw_faces_with_selection(int *selection, int nb_select, double thickness_half, std::string &options, std::ostream &ost)
int face(int *pts, int nb_pts)
void print_point_coords(int idx)
int point_center_of_mass(int *Pt_idx, int nb_pts)
void init(int verbose_level)
void Clebsch_Eckardt_points()
void transform_cubics(scene *S, double *A4, double *A4_inv, int verbose_level)
double line_coords(int idx, int j)
int plane(double x1, double x2, double x3, double a)
scene * transformed_copy(double *A4, double *A4_inv, double rad, int verbose_level)
void draw_cubic_with_selection(int *selection, int nb_select, std::string &options, std::ostream &ost)
int quadric_through_three_lines(int line_idx1, int line_idx2, int line_idx3, int verbose_level)
double distance_between_two_points(int pt1, int pt2)
void transform_lines(scene *S, double *A4, double *A4_inv, double rad, int verbose_level)
void draw_lines_bj(std::ostream &ost)
void draw_quadric_clipped_by_plane(int quadric_idx, int plane_idx, std::string &options, std::ostream &ost)
void draw_lines_with_selection(int *selection, int nb_select, std::string &options, std::ostream &ost)
int cubic_in_orbiter_ordering(double *coeff)
void Dodecahedron_planes(int first_pt_idx)
void create_Hilbert_model(int verbose_level)
double point_distance_euclidean(int pt_idx, double *y)
double plane_coords(int idx, int j)
void hypercube(int n, double rad_desired)
double euclidean_distance(int pt1, int pt2)
void create_Clebsch_surface(int verbose_level)
void draw_lines_ai_with_offset(int offset, std::ostream &ost)
void fourD_cube(double rad_desired)
void print_a_plane(int plane_idx)
basic number theoretic functions
int i_power_j(int i, int j)
numerical functions, mostly concerned with double
int triangular_prism(double *P1, double *P2, double *P3, double *abc3, double *angles3, double *T3, int verbose_level)
void vec_add(double *a, double *b, double *c, int len)
void vec_linear_combination3(double c1, double *v1, double c2, double *v2, double c3, double *v3, double *w, int len)
int intersect_line_and_line(double *line1_pt1_coords, double *line1_pt2_coords, double *line2_pt1_coords, double *line2_pt2_coords, double &lambda, double *pt_coords, int verbose_level)
double distance_euclidean(double *x, double *y, int len)
void vec_scalar_multiple(double *a, double lambda, int len)
void plane_through_three_points(double *p1, double *p2, double *p3, double *n, double &d)
int Gauss_elimination(double *A, int m, int n, int *base_cols, int f_complete, int verbose_level)
void substitute_quadric_linear(double *coeff_in, double *coeff_out, double *A4_inv, int verbose_level)
void print_system(double *A, int m, int n)
double distance_from_origin(double x1, double x2, double x3)
void vec_print(double *a, int len)
int general_prism(double *Pts, int nb_pts, double *Pts_xy, double *abc3, double *angles3, double *T3, int verbose_level)
void make_unit_vector(double *v, int len)
void mult_matrix_4x4(double *v, double *R, double *vR)
int Null_space(double *M, int m, int n, double *K, int verbose_level)
int line_centered(double *pt1_in, double *pt2_in, double *pt1_out, double *pt2_out, double r, int verbose_level)
void output_double(double a, std::ostream &ost)
void vec_subtract(double *a, double *b, double *c, int len)
int line_centered_tolerant(double *pt1_in, double *pt2_in, double *pt1_out, double *pt2_out, double r, int verbose_level)
void center_of_mass(double *Pts, int len, int *Pt_idx, int nb_pts, double *c)
void substitute_quartic_linear_using_povray_ordering(double *coeff_in, double *coeff_out, double *A4_inv, int verbose_level)
double rad2deg(double phi)
void transpose_matrix_4x4(double *A, double *At)
void vec_swap(double *from, double *to, int len)
void substitute_cubic_linear_using_povray_ordering(double *coeff_in, double *coeff_out, double *A4_inv, int verbose_level)
void vec_normalize_from_back(double *v, int len)
void vec_normalize_to_minus_one_from_back(double *v, int len)
void mult_matrix_matrix(double *A, double *B, double *C, int m, int n, int o)
void vec_copy(double *from, double *to, int len)
void matrix_double_inverse(double *A, double *Av, int n, int verbose_level)
interface to system functions
int random_integer(int p)
#define Int_vec_copy(A, B, C)
#define Int_vec_print(A, B, C)
#define SCENE_MAX_QUINTICS
#define SCENE_MAX_QUARTICS
#define SCENE_MAX_QUADRICS
the orbiter library for the classification of combinatorial objects