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