42#include "ramCanvas.hpp"
45typedef mjr::ramCanvas3c8b rcT;
49 std::chrono::time_point<std::chrono::system_clock> startTime = std::chrono::system_clock::now();
50 const int MAXITR = 255;
51 const int CCLMAG = 130;
52 const int DCLMAG = 30;
53 const int NUMFRM = 4*8;
54 const double ZMAGMX = 1e10;
55 const double RELSIZ = 7.0;
56 const double XCENTR = 0.0;
57 const double YCENTR = 0.0;
58 const double ZROEPS = .0001;
59 const int IMGSIZ = 7680/16;
60 const std::complex<double> r1( 1.0, 0.0);
61 const std::complex<double> r2(-0.5, std::sin(2*std::numbers::pi/3));
62 const std::complex<double> r3(-0.5, -std::sin(2*std::numbers::pi/3));
64# pragma omp parallel for schedule(static,1)
65 for(
int frame=0; frame<NUMFRM; frame++) {
67 std::cout <<
"frame " << (frame+1) <<
" of " << NUMFRM << std::endl;
68 rcT theRamCanvas(IMGSIZ, IMGSIZ, XCENTR-RELSIZ, XCENTR+RELSIZ, YCENTR-RELSIZ, YCENTR+RELSIZ);
69 double angle = 2.0*std::numbers::pi/6.0/NUMFRM*frame;
70 std::complex<double> a(std::cos(angle), std::sin(angle));
72 for(
int y=0;y<theRamCanvas.getNumPixY();y++) {
73 for(
int x=0;x<theRamCanvas.getNumPixX();x++) {
74 std::complex<double> z = theRamCanvas.int2real(x, y);
75 std::complex<double> zL = z + 100.0;
76 for(
int count=0; count<MAXITR; count++) {
77 if(std::abs(z-zL) <= ZROEPS) {
78 theRamCanvas.drawPoint(x, y, rcT::colorType::csCCu0R::c(count*CCLMAG));
break;
79 }
else if(std::abs(z) <= ZROEPS) {
81 }
else if(std::abs(z) > ZMAGMX) {
82 theRamCanvas.drawPoint(x, y, rcT::colorType::csCCu0W::c(count*DCLMAG));
break;
87 z = (-pow(a, 6.0) * pow(z, 12.0) + (7.0 * pow(a, 6.0) + (5.0 * b)) * pow(z, 6.0) + b) /
88 pow(z, 5.0) / (pow(a, 6.0) + b) / 6.0;
90 z = (5.0 * pow(z, 6.0) + 1.0) / pow(z, 5.0) / 6.0;
94 theRamCanvas.writeTIFFfile(
"newton_roter_" + mjr::math::str::fmt_int(frame, 3,
'0') +
".tiff");
96 std::chrono::duration<double> runTime = std::chrono::system_clock::now() - startTime;
97 std::cout <<
"Total Runtime " << runTime.count() <<
" sec" << std::endl;
int main(int argc, char *argv[])