16namespace layer1_foundations {
23 color_white_simple.assign(
"texture{ pigment{ White*0.5 transmit 0.2 } finish {ambient 0.4 diffuse 0.5 roughness 0.001 reflection 0.1 specular .8} }");
24 color_white.assign(
"texture{ pigment{ White*0.5 transmit 0.5 } finish {ambient 0.4 diffuse 0.5 roughness 0.001 reflection 0.1 specular .8} }");
25 color_white_very_transparent.assign(
"texture{ pigment{ White*0.5 transmit 0.75 } finish {ambient 0.4 diffuse 0.5 roughness 0.001 reflection 0.1 specular .8} }");
26 color_black.assign(
"texture{ pigment{ color Black } finish { diffuse 0.9 phong 1}}");
27 color_pink.assign(
"texture{ pigment{ color Pink } finish { diffuse 0.9 phong 1}}");
28 color_pink_transparent.assign(
"texture{ pigment{ color Pink transmit 0.5 } finish {diffuse 0.9 phong 0.6} }");
29 color_green.assign(
"texture{ pigment{ color Green } finish { diffuse 0.9 phong 1}}");
30 color_gold.assign(
"texture{ pigment{ color Gold } finish { diffuse 0.9 phong 1}}");
31 color_red.assign(
"texture{ pigment{ color Red } finish { diffuse 0.9 phong 1}}");
32 color_blue.assign(
"texture{ pigment{ color Blue } finish { diffuse 0.9 phong 1}}");
33 color_yellow.assign(
"texture{ pigment{ color Yellow } finish { diffuse 0.9 phong 1}}");
35 color_scarlet.assign(
"texture{ pigment{ color Scarlet } finish { diffuse 0.9 phong 1}}");
36 color_brown.assign(
"texture{ pigment{ color Brown } finish { diffuse 0.9 phong 1}}");
37 color_orange.assign(
"texture{ pigment{ color Orange transmit 0.5 } finish { diffuse 0.9 phong 1}}");
39 color_orange_no_phong.assign(
"texture{ pigment{ color Orange transmit 0.6 } finish { diffuse 0.6 brilliance 5 phong 0.3 metallic }}");
40 color_chrome.assign(
"texture{ Polished_Chrome pigment{quick_color White} }");
41 color_gold_dode.assign(
"texture{ pigment{color Gold transmit 0.7 } finish {ambient 0.4 diffuse 0.5 roughness 0.001 reflection 0.1 specular .8} }");
42 color_gold_transparent.assign(
"texture{ pigment{color Gold transmit 0.7 } finish { diffuse 0.6 brilliance 5 phong 0.3 metallic } }");
63 int f_with_background)
70 ost <<
"//Files with predefined colors and textures" << endl;
71 ost <<
"#version 3.7;" << endl;
72 ost <<
"#include \"colors.inc\"" << endl;
73 ost <<
"#include \"glass.inc\"" << endl;
74 ost <<
"#include \"golds.inc\"" << endl;
75 ost <<
"#include \"metals.inc\"" << endl;
76 ost <<
"#include \"stones.inc\"" << endl;
77 ost <<
"#include \"woods.inc\"" << endl;
78 ost <<
"#include \"textures.inc\"" << endl;
83 for (i = 0; i < 3; i++) {
90 ost <<
"//Place the camera" << endl;
91 ost <<
"camera {" << endl;
92 ost <<
" sky <0,0,1> " << endl;
93 ost <<
" direction <-1,0,0>" << endl;
94 ost <<
" right <-4/3,0,0> " << endl;
95 ost <<
" //location <-2.5,0.6,-3>*3" << endl;
96 ost <<
" //look_at<0,0.2,0>" << endl;
97 ost <<
" location <0,5,0> //Camera location" << endl;
98 ost <<
" look_at <0,0,0> //Where camera is pointing" << endl;
99 ost <<
" angle " << angle <<
" //Angle of the view" << endl;
100 ost <<
" // 22 is default, 18 is closer, 28 is further away" << endl;
103 ost <<
"//Ambient light to brighten up darker pictures" << endl;
104 ost <<
"//global_settings { ambient_light White }" << endl;
105 ost <<
"global_settings { max_trace_level 10 }" << endl;
108 ost <<
"//Place a light" << endl;
109 ost <<
"//light_source { <15,30,1> color White*2 } " << endl;
110 ost <<
"//light_source { <10,10,0> color White*2 } " << endl;
111 ost <<
"light_source { <0,2,0> color White*2 } " << endl;
112 ost <<
"light_source { <0,0,2> color White }" << endl;
113 ost <<
"//light_source { <0,10,0> color White*2}" << endl;
117 ost <<
"//plane{z,7 pigment {SkyBlue} }" << endl;
118 ost <<
"plane{y,7 pigment {SkyBlue} }" << endl;
120 ost <<
"//texture {T_Silver_3A}" << endl;
122 ost <<
"//Set a background color" << endl;
123 ost <<
"background { color SkyBlue }" << endl;
125 ost <<
"union{ " << endl;
126 ost <<
"/* #declare r=0.09 ; " << endl;
128 ost <<
"object{ // x-axis" << endl;
129 ost <<
"cylinder{< 0,0,0 >,<1.5,0,0 > ,r }" << endl;
130 ost <<
" pigment{Red} " << endl;
133 ost <<
"object{ // y-axis" << endl;
134 ost <<
"cylinder{< 0,0,0 >,<0,1.5,0 > ,r }" << endl;
135 ost <<
" pigment{Green} " << endl;
138 ost <<
"object{ // z-axis" << endl;
139 ost <<
"cylinder{< 0,0,0 >,<0,0,1.5 > ,r }" << endl;
140 ost <<
" pigment{Blue} " << endl;
142 ost <<
"} */" << endl;
144 ost <<
"//Place the camera" << endl;
145 ost <<
"camera {" << endl;
146 ost <<
" sky <" <<
sky[0] <<
"," <<
sky[1] <<
"," <<
sky[2] <<
">" << endl;
148 ost <<
" //direction <1,0,0>" << endl;
149 ost <<
" //right <1,1,0> " << endl;
153 ost <<
" angle " << angle <<
" //Angle of the view" << endl;
154 ost <<
" // smaller numbers are closer. Must be less than 180" << endl;
157 ost <<
"//Ambient light to brighten up darker pictures" << endl;
158 ost <<
"//global_settings { ambient_light White }" << endl;
159 ost <<
"global_settings { max_trace_level 10 }" << endl;
160 ost <<
"global_settings { assumed_gamma 1.0 }" << endl;
162 ost <<
"//Place a light" << endl;
165 ost <<
"light_source { <" <<
sky[0] * 6 <<
"," <<
sky[1] * 6 <<
"," <<
sky[2] * 6 <<
"> color White } " << endl;
166 ost <<
"light_source { <" <<
location[0] <<
"," <<
location[1] <<
"," <<
location[2] <<
"> color White * 2 }" << endl;
169 if (f_with_background) {
170 ost <<
"//Set a background color" << endl;
171 ost <<
"background { color SkyBlue }" << endl;
175 ost <<
"//Set a background color" << endl;
176 ost <<
"background { color White }" << endl;
179 ost <<
"// main part:" << endl;
188 ost <<
" // the next three steps will perform a rotation" << endl;
189 ost <<
" // around the axis of symmetry 1,1,1:" << endl;
191 ost <<
" // move 1,1,1 to sqrt(3),0,0:" << endl;
192 ost <<
" matrix<" << endl;
193 ost <<
" 1/sqrt(3),2/sqrt(6),0," << endl;
194 ost <<
" 1/sqrt(3),-1/sqrt(6),1/sqrt(2)," << endl;
195 ost <<
" 1/sqrt(3),-1/sqrt(6),-1/sqrt(2)," << endl;
196 ost <<
" 0,0,0>" << endl;
199 ost <<
" rotate <360*clock,0,0> " << endl;
201 ost <<
" // move sqrt(3),0,0 back to 1,1,1:" << endl;
203 ost <<
" matrix<" << endl;
204 ost <<
" 1/sqrt(3),1/sqrt(3),1/sqrt(3)," << endl;
205 ost <<
" 2/sqrt(6),-1/sqrt(6),-1/sqrt(6)," << endl;
206 ost <<
" 0,1/sqrt(2),-1/sqrt(2)," << endl;
207 ost <<
" 0,0,0>" << endl;
213 double *v, ostream &ost)
221 ost <<
" // the next three steps will perform a rotation" << endl;
222 ost <<
" // around the axis of symmetry (" << v[0] <<
", " << v[1] <<
"," << v[2] <<
"):" << endl;
224 ost <<
" // move axis of symmetry to 1,0,0:" << endl;
225 ost <<
" matrix<" << endl;
248 ost <<
" 0,0,0>" << endl;
251 ost <<
" rotate <360*clock,0,0> " << endl;
253 ost <<
" // move 1,0,0 back to axis of symmetry:" << endl;
255 ost <<
" matrix<" << endl;
278 ost <<
" 0,0,0>" << endl;
284 double angle_x_deg,
double angle_y_deg,
double angle_z_deg, ostream &ost)
298 double *v,
double angle_zero_one, ostream &ost)
306 ost <<
" // the next three steps will perform a rotation" << endl;
307 ost <<
" // around the axis of symmetry (" << v[0] <<
", " << v[1] <<
"," << v[2] <<
"):" << endl;
309 ost <<
" // move axis of symmetry to (" << v[0] <<
", " << v[1] <<
", " << v[2] <<
") " << endl;
310 ost <<
" matrix<" << endl;
333 ost <<
" 0,0,0>" << endl;
336 ost <<
" rotate <" << angle_zero_one * 360. <<
",0,0> " << endl;
338 ost <<
" // move (" << v[0] <<
", " << v[1] <<
", " << v[2] <<
") back to axis:" << endl;
340 ost <<
" matrix<" << endl;
363 ost <<
" 0,0,0>" << endl;
371 ost <<
"union{ " << endl;
374 ost <<
"// uncomment this if you need axes:" << endl;
375 ost <<
"/* #declare r=0.09 ; " << endl;
377 ost <<
"object{ // x-axis" << endl;
378 ost <<
"cylinder{< 0,0,0 >,<1.5,0,0 > ,r }" << endl;
379 ost <<
" pigment{Red} " << endl;
382 ost <<
"object{ // y-axis" << endl;
383 ost <<
"cylinder{< 0,0,0 >,<0,1.5,0 > ,r }" << endl;
384 ost <<
" pigment{Green} " << endl;
387 ost <<
"object{ // z-axis" << endl;
388 ost <<
"cylinder{< 0,0,0 >,<0,0,1.5 > ,r }" << endl;
389 ost <<
" pigment{Blue} " << endl;
391 ost <<
"} */" << endl;
397 ost <<
" scale " << scale_factor << endl;
400 ost <<
" clipped_by { sphere{ < 0.,0.,0. > , " << clipping_radius <<
" } }" << endl;
401 ost <<
" bounded_by { clipped_by }" << endl;
403 ost <<
"} // union" << endl;
407 double box_x,
double box_y,
double box_z)
410 ost <<
" scale " << scale_factor << endl;
413 ost <<
" clipped_by { box{ < " << -1 * box_x <<
", " << -1 * box_y <<
", " << -1 * box_z <<
" > * " << scale_factor <<
", "
414 " < " << box_x <<
", " << box_y <<
", " << box_z <<
" > * " << scale_factor <<
" } }" << endl;
415 ost <<
" bounded_by { clipped_by }" << endl;
417 ost <<
"} // union" << endl;
423 ost <<
" scale " << scale_factor << endl;
427 ost <<
"} // union" << endl;
434 ost <<
"//bottom plane:" << endl;
435 ost <<
"plane {" << endl;
436 ost <<
" <1,1,1>*1/sqrt(3), -2" << endl;
437 ost <<
" texture {" << endl;
438 ost <<
" pigment {SteelBlue}" << endl;
439 ost <<
" finish {" << endl;
440 ost <<
" diffuse 0.6" << endl;
441 ost <<
" ambient 0.2" << endl;
442 ost <<
" phong 1" << endl;
443 ost <<
" phong_size 100" << endl;
444 ost <<
" reflection 0.25" << endl;
447 ost <<
" } // end plane" << endl;
452 ost <<
"#declare d = .8; " << endl;
454 ost <<
"plane {" << endl;
455 ost <<
" //y, -d" << endl;
456 ost <<
" z, -d" << endl;
457 ost <<
" texture {" << endl;
458 ost <<
" pigment {SkyBlue} // Yellow" << endl;
459 ost <<
" //pigment {" << endl;
460 ost <<
" // checker" << endl;
461 ost <<
" // color rgb<0.5, 0, 0>" << endl;
462 ost <<
" // color rgb<0, 0.5, 0.5>" << endl;
463 ost <<
" //}" << endl;
464 ost <<
" finish {" << endl;
465 ost <<
" diffuse 0.6" << endl;
466 ost <<
" ambient 0.2" << endl;
467 ost <<
" phong 1" << endl;
468 ost <<
" phong_size 100" << endl;
469 ost <<
" reflection 0.25" << endl;
483 double angle_zero_one = 1. - (h * 1. / (double) nb_frames);
486 double v[3] = {1.,1.,1.};
489 v, angle_zero_one, fp);
496 double angle_zero_one = 1. - (h * 1. / (double) nb_frames);
499 double v[3] = {0,0,1.};
502 v, angle_zero_one, fp);
507 int first_frame,
int last_frame)
509 ost <<
"; Persistence Of Vision raytracer version 3.7 example file." << endl;
510 ost <<
"Antialias=On" << endl;
512 ost <<
"Antialias_Threshold=0.1" << endl;
513 ost <<
"Antialias_Depth=2" << endl;
514 ost <<
"Input_File_Name=" << fname_pov << endl;
516 ost <<
"Initial_Frame=" << first_frame << endl;
517 ost <<
"Final_Frame=" << last_frame << endl;
518 ost <<
"Initial_Clock=0" << endl;
519 ost <<
"Final_Clock=1" << endl;
521 ost <<
"Cyclic_Animation=on" << endl;
522 ost <<
"Pause_when_Done=off" << endl;
std::string color_red_wine_transparent
void union_end(std::ostream &ost, double scale_factor, double clipping_radius)
void rotate_111(int h, int nb_frames, std::ostream &fp)
std::string color_orange_transparent
std::string color_white_simple
void beginning(std::ostream &ost, double angle, double *sky, double *location, double *look_at, int f_with_background)
std::string color_orange_no_phong
void bottom_plane(std::ostream &ost)
std::string color_gold_dode
std::string color_gold_transparent
void animation_rotate_xyz(double angle_x_deg, double angle_y_deg, double angle_z_deg, std::ostream &ost)
std::string color_yellow_lemon_transparent
void rotate_around_z_axis(int h, int nb_frames, std::ostream &fp)
void union_start(std::ostream &ost)
std::string color_scarlet
void animation_rotate_around_origin_and_1_1_1(std::ostream &ost)
std::string color_pink_transparent
void ini(std::ostream &ost, const char *fname_pov, int first_frame, int last_frame)
void animation_rotate_around_origin_and_given_vector(double *v, std::ostream &ost)
void union_end_no_clipping(std::ostream &ost, double scale_factor)
std::string color_white_very_transparent
std::string color_yellow_transparent
void union_end_box_clipping(std::ostream &ost, double scale_factor, double box_x, double box_y, double box_z)
void animation_rotate_around_origin_and_given_vector_by_a_given_angle(double *v, double angle_zero_one, std::ostream &ost)
numerical functions, mostly concerned with double
void orthogonal_transformation_from_point_to_basis_vector(double *from, double *A, double *Av, int verbose_level)
void output_double(double a, std::ostream &ost)
the orbiter library for the classification of combinatorial objects