40#include "ramCanvas.hpp"
41#include "MRMathSTR.hpp"
45 std::chrono::time_point<std::chrono::system_clock> startTime = std::chrono::system_clock::now();
47 const int imageSize = 540;
48 const unsigned long int maxIters = 300000000ul;
49 const unsigned long int itersTick = 10000000ul;
50 const int numFrames = 24*8;
51 const double a = 1.50503;
52 const double b = -1.44118;
53 const double c = -1.23281;
54 const double d = 1.78607;
55 const double e = 1.709360;
56 const double f = 1.794210;
57 const double g = 1.893750;
58 const double h = -1.38227;
59 const double p = 2.10;
61 mjr::ramCanvas1c16b::colorType aColor;
64# pragma omp parallel for schedule(static,1)
65 for(
int frame=0; frame<numFrames; frame++) {
66 mjr::ramCanvas1c16b theRamCanvas(imageSize, imageSize, -2, 2, -2, 2);
70 mjr::ramCanvas1c16b::colorChanArithSPType maxII = 0;
71 for(mjr::ramCanvas1c16b::colorChanArithSPType i=0;i<maxIters;i++) {
72 double da = 0.07 * cos(frame * 2 * std::numbers::pi / numFrames);
73 double dc = 0.04 * sin(frame * 2 * std::numbers::pi / numFrames);
74 double db = 0.05 * cos(frame * 2 * std::numbers::pi / numFrames);
75 double dd = 0.13 * sin(frame * 2 * std::numbers::pi / numFrames);
76 double de = 0.18 * sin(frame * 2 * std::numbers::pi / numFrames);
77 double dg = 0.05 * cos(frame * 2 * std::numbers::pi / numFrames);
78 double df = 0.09 * sin(frame * 2 * std::numbers::pi / numFrames);
79 double dh = 0.12 * cos(frame * 2 * std::numbers::pi / numFrames);
80 double xNew = sin((a + da)*y + e + de) - cos((b+db)*x + f + df);
81 double yNew = sin((c + dc)*x + g + dg) - cos((d+dd)*y + h + dh);
82 theRamCanvas.drawPoint(x, y, theRamCanvas.getPxColor(x, y).tfrmAdd(aColor));
83 if(theRamCanvas.getPxColor(x, y).getC0() > maxII) {
84 maxII = theRamCanvas.getPxColor(x, y).getC0();
86 std::cout <<
"FRAME(" << frame <<
"): " << i <<
" MAXS: " << maxII <<
" EXIT: Maximum image intensity reached" << std::endl;
90 if((i % itersTick) == 0)
91 std::cout <<
"FRAME(" << frame <<
"): " << i <<
" MAXS: " << maxII << std::endl;
97 theRamCanvas.writeTIFFfile(
"peterdejongM_" + mjr::math::str::fmt_int(frame, 3,
'0') +
".mrw");
100 theRamCanvas.applyHomoPixTfrm(&mjr::ramCanvas1c16b::colorType::tfrmStdPow, 1.0/p);
101 maxII =
static_cast<mjr::ramCanvas1c16b::colorChanArithSPType
>(65535.0 * pow(
static_cast<double>(maxII)/65535.0, 1.0/p));
105 mjr::ramCanvas3c8b anotherRamCanvas(imageSize, imageSize);
106 mjr::ramCanvas3c8b::colorType bColor;
107 for(
int yi=0;yi<theRamCanvas.getNumPixY();yi++)
108 for(
int xi=0;xi<theRamCanvas.getNumPixX();xi++)
109 anotherRamCanvas.drawPoint(xi, yi, bColor.cmpRGBcornerDGradiant(
static_cast<mjr::ramCanvas3c8b::csIntType
>(theRamCanvas.getPxColor(xi, yi).getC0() * 1275 / maxII),
"0RYBCW"));
110 anotherRamCanvas.writeTIFFfile(
"peterdejongM_" + mjr::math::str::fmt_int(frame, 3,
'0') +
".tiff");
113 std::chrono::duration<double> runTime = std::chrono::system_clock::now() - startTime;
114 std::cout <<
"Total Runtime " << runTime.count() <<
" sec" << std::endl;
int main(int argc, char *argv[])