35#include "ramCanvas.hpp"
38typedef mjr::ramCanvas3c8b rcT;
39typedef rcT::colorType rccT;
40typedef rcT::csIntType rccsiT;
44 std::chrono::time_point<std::chrono::system_clock> startTime = std::chrono::system_clock::now();
45 const int MAXITR = 255;
46 const int COLMAG = 400;
47 const double ZROEPS = .0001;
48 const int IMGSIZ = 7680;
49 std::complex<double> r1( 1.0, 0.0);
50 std::complex<double> r2(-0.5, sin(2*std::numbers::pi/3));
51 std::complex<double> r3(-0.5, -sin(2*std::numbers::pi/3));
52 rcT theRamCanvas(IMGSIZ, IMGSIZ, -2.15, 1.85, -2.0, 2.0);
54# pragma omp parallel for schedule(static,1)
55 for(
int y=0;y<theRamCanvas.getNumPixY();y++) {
56 for(
int x=0;x<theRamCanvas.getNumPixX();x++) {
57 std::complex<double> z = theRamCanvas.int2real(x, y);
59 for(
int count=0; count<MAXITR; count++) {
60 if(std::abs(z-r1) <= ZROEPS) {
61 theRamCanvas.drawPoint(x, y, rccT::csCCu0R::c(
static_cast<rccsiT
>(255-maxMod*COLMAG)));
break;
62 }
else if(std::abs(z-r2) <= ZROEPS) {
63 theRamCanvas.drawPoint(x, y, rccT::csCCu0G::c(
static_cast<rccsiT
>(255-maxMod*COLMAG)));
break;
64 }
else if(std::abs(z-r3) <= ZROEPS) {
65 theRamCanvas.drawPoint(x, y, rccT::csCCu0B::c(
static_cast<rccsiT
>(255-maxMod*COLMAG)));
break;
66 }
else if(std::abs(z) <= ZROEPS) {
71 z = z-(z*z*z-1.0)/(z*z*3.0);
75 theRamCanvas.writeTIFFfile(
"newton_max_mod.tiff");
76 std::chrono::duration<double> runTime = std::chrono::system_clock::now() - startTime;
77 std::cout <<
"Total Runtime " << runTime.count() <<
" sec" << std::endl;
int main(int argc, char *argv[])