56#include "ramCanvas.hpp"
60 std::chrono::time_point<std::chrono::system_clock> startTime = std::chrono::system_clock::now();
61 const int XSIZ = 7680/4;
62 const int YSIZ = 4320/4;
64 const int NUMFRM = 120;
66 const double zLevStart = -4.0;
67 const double zLevEnd = 4.0;
69 const double isectDistToGo = 5e7;
74 const double x0 = 0.0;
75 const double y0 = 2.0;
76 const double z0 = 1.0;
78 const double targetDist = 0.025;
79 const int maxNumUpBisect = 5;
80 const int maxNumDownBisect = 10;
82# pragma omp parallel for schedule(static,1)
83 for(
int frame=0; frame<NUMFRM; frame++) {
84 std::chrono::time_point<std::chrono::system_clock> frameStartTime = std::chrono::system_clock::now();
85 mjr::ramCanvas3c8b theRamCanvas(XSIZ, YSIZ, -10, 10, -10, 10);
86 double zLev = zLevStart + frame*(zLevEnd-zLevStart)/(NUMFRM-1);
97 double Xdelta, Ydelta, Zdelta, movDist;
98 while (dist < isectDistToGo) {
102 tDelta += (2 * tDelta);
103 Xdelta = (y) * tDelta;
104 Ydelta = (-x-z*y) * tDelta;
105 Zdelta = (y*y-a+b*z) * tDelta;
106 movDist = sqrt (fabs (Xdelta * Xdelta + Ydelta * Ydelta + Zdelta * Zdelta));
108 }
while ((numUpBisect < maxNumUpBisect) && (movDist < targetDist));
111 int numDownBisect = 0;
114 Xdelta = (y) * tDelta;
115 Ydelta = (-x-z*y) * tDelta;
116 Zdelta = (y*y-a+b*z) * tDelta;
117 movDist = sqrt (fabs (Xdelta * Xdelta + Ydelta * Ydelta + Zdelta * Zdelta));
119 }
while ((numDownBisect < maxNumDownBisect) && (movDist > targetDist));
126 if((z-zLev)*(zOld-zLev)<=0.0)
127 theRamCanvas.drawPoint((x+xOld)/2.0, (y+yOld)/2.0, mjr::ramCanvas3c8b::colorType::cornerColorEnum::WHITE);
133 theRamCanvas.writeTIFFfile(
"attracting_torus_shadowM_" + mjr::math::str::fmt_int(frame, 3,
'0') +
".tiff");
134 std::chrono::duration<double> frameRunTime = std::chrono::system_clock::now() - frameStartTime;
136 std::cout <<
"Frame " << frame <<
" of " << NUMFRM <<
" Runtime " << frameRunTime.count() <<
" sec" << std::endl;
139 std::chrono::duration<double> runTime = std::chrono::system_clock::now() - startTime;
140 std::cout <<
"Total Runtime " << runTime.count() <<
" sec" << std::endl;
int main(int argc, char *argv[])