#include #include #include #include #include "movie.h" #include "putable.h" using namespace std; int main(int argc, char **argv) { srand(time(0)); //rectangle on dome subtends twice this horizontally. const double hdegrees = 32; const double tangent = tan(hdegrees * pi / 180); const double d = picture::xmax / tangent; //distance to screen //POV moves this number of times the length of d. const double times = 2.75; const size_t n = 335000; xyz a[n]; for (size_t i = 0; i < n; ++i) { a[i] = d * xyz(2 * myrand() - 1, 2 * myrand() - 1, myrand()); a[i].x *= (times + picture::visible) * tangent, a[i].y *= (times + picture::visible) * tangent *picture::height / picture::width, a[i].z *= times + picture::visible; a[i].z -= d * picture::visible; } putable stars; stars.push_back(putable().putable_set(a, a + n)); const picture empty; picture stars_begin(xyz(), xyz(0, 0, -1), d); stars_begin << stars; movie(empty, stars_begin).write( "fade_in_trek.gif", "empty", "stars"); movie trek( interpolate(xyz(), xyz(0, 0, times * d)), //POV constant(xyz(0, 0, -1)), //looking in this direction constant(d), //distance to screen 4 * movie::nf //number of frames ); (trek << stars).write( "recede.gif", "approaching stars", "receding stars"); system( "rm -f approach_r.gif;" "ln recede.gif approach_r.gif;" "rm -f approach.gif;" "ln recede_r.gif approach.gif;" "rm -f fade_out_trek.gif;" "ln fade_in_trek_r.gif fade_out_trek.gif;" "rm -f fade_out_trek_r.gif;" "ln fade_in_trek.gif fade_out_trek_r.gif;" ); #if 0 picture stars_end(xyz(0, 0, times * d), xyz(0, 0, -1), d); stars_end << stars; movie(stars_end, empty).write( "fade_out_trek.gif", "stars", "empty"); #endif return EXIT_SUCCESS; }