#include #include #include #include "movie.h" #include "putable.h" using namespace std; int main(int argc, char **argv) { const double earth_radius = picture::height / 3; const double original_man_height = 3; const double man_height = earth_radius / 2; //Magnify the man by this factor. const double factor = man_height / original_man_height; const double head_radius = .5; const double center_height = factor * (original_man_height - head_radius); putable Earth; Earth .circle() .push_back(putable().line().scale(2).translate(-1)) .scale(earth_radius) .translate(xyz(0, -earth_radius / 2)); putable man; man //head .push_back(putable().circle() .scale(head_radius) .translate(xyz(0, original_man_height - head_radius)) ) //body .push_back(putable().line() .zrot(pi / 2) .translate(xyz(0, 1)) ) //arms .push_back(putable().line() .scale(2) .translate(xyz(-1, 1.5)) ) //right leg .push_back(putable().line() .scale(sqrt(2) * 9 / 10) .zrot(-pi / 4) .translate(xyz(0, 1)) ) //left leg .push_back(putable().line() .scale(sqrt(2) * 9 / 10) .zrot(pi * 5 / 4) .translate(xyz(0, 1)) ) .scale(man_height / original_man_height) .translate(xyz(0, earth_radius)) .push_back(putable().line().zrot(pi / 2).scale(earth_radius)); picture empty; picture earth_picture; earth_picture << Earth; movie(empty, earth_picture).write( "fade_in_peary_earth.gif", "empty", "earth with equator"); picture peary_picture; peary_picture << Earth << putable(man).translate(xyz(0, -earth_radius / 2)); movie(earth_picture, peary_picture).write( "fade_in_peary.gif", "earth with equator", "Peary"); putable arrow; arrow //shaft .push_back(putable() .line() .scale(original_man_height - head_radius) .translate(2 * head_radius)) //blade of arrowhead .push_back(putable().line() .scale(original_man_height / 3) .zrot(7 * pi / 8) .translate(original_man_height + head_radius)) //other of arrowhead .push_back(putable().line() .scale(original_man_height / 3) .zrot(-7 * pi / 8) .translate(original_man_height + head_radius)) .zrot(pi / 2) .scale(man_height / original_man_height); picture arrow_picture; arrow_picture << Earth << putable(man).translate(xyz(0, -earth_radius / 2)) << putable(arrow) .translate(xyz(0, earth_radius / 2 + center_height)); movie(peary_picture, arrow_picture).write( "fade_in_arrow.gif", "Peary", "Pearys arrow"); //Man walks counterclockwise from north pole to Yonkers. movie rotate_to_yonkers( constant(xyz(0, 0, picture::dmax)), constant(xyz()), constant(picture::dmax) ); rotate_to_yonkers << Earth << putable(man) .zrot(0, (49 + 3/60) * pi / 180) .translate(xyz(0, -earth_radius / 2)) << putable(arrow) .zrot(0, -(49 + 3/60) * pi / 180) .translate(xyz(0, earth_radius + center_height)) .zrot(0, (49 + 3/60) * pi / 180) .translate(xyz(0, -earth_radius / 2)); rotate_to_yonkers.write( "rotate_to_yonkers.gif", "Pearys arrow", "Yonkers"); //Man walks counterclockwise from Yonkers to equator. movie rotate_to_equator( constant(xyz(0, 0, picture::dmax)), constant(xyz()), constant(picture::dmax) ); rotate_to_equator << Earth << putable(man) .zrot((49 + 3/60) * pi / 180, pi / 2) .translate(xyz(0, -earth_radius / 2)) << putable(arrow) .zrot(-(49 + 3/60) * pi / 180, -pi / 2) .translate(xyz(0, earth_radius + center_height)) .zrot((49 + 3/60) * pi / 180, pi / 2) .translate(xyz(0, -earth_radius / 2)); rotate_to_equator.write( "rotate_to_equator.gif", "Yonkers", "equator"); movie(rotate_to_equator.v[rotate_to_equator.nframes - 1], empty).write( "fade_out_equator.gif", "equator", "empty"); return EXIT_SUCCESS; }