35#include "ramCanvas.hpp"
39 std::chrono::time_point<std::chrono::system_clock> startTime = std::chrono::system_clock::now();
40 const int MAXITR = 255;
41 const int COLMAG = 25;
42 const double ZROEPS = .0001;
43 const int IMGSIZ = 7680;
44 std::complex<double> r1( 1.0, 0.0);
45 std::complex<double> r2(-0.5, sin(2*std::numbers::pi/3));
46 std::complex<double> r3(-0.5, -sin(2*std::numbers::pi/3));
47 mjr::ramCanvas3c8b theRamCanvas(IMGSIZ, IMGSIZ, -2.0, 2, -2, 2);
49# pragma omp parallel for schedule(static,1)
50 for(
int y=0;y<theRamCanvas.getNumPixY();y++) {
51 for(
int x=0;x<theRamCanvas.getNumPixX();x++) {
52 std::complex<double> z = theRamCanvas.int2real(x, y);
53 for(
int count=0; count<MAXITR; count++) {
54 if(std::abs(z-r1) <= ZROEPS) {
55 theRamCanvas.drawPoint(x, y, mjr::ramCanvas3c8b::colorType::csCCu0R::c(255-count*COLMAG));
break;
56 }
else if(std::abs(z-r2) <= ZROEPS) {
57 theRamCanvas.drawPoint(x, y, mjr::ramCanvas3c8b::colorType::csCCu0G::c(255-count*COLMAG));
break;
58 }
else if(std::abs(z-r3) <= ZROEPS) {
59 theRamCanvas.drawPoint(x, y, mjr::ramCanvas3c8b::colorType::csCCu0B::c(255-count*COLMAG));
break;
60 }
else if(std::abs(z) <= ZROEPS) {
63 z = z-(z*z*z-1.0)/(z*z*3.0);
67 theRamCanvas.writeTIFFfile(
"newton_simple.tiff");
68 std::chrono::duration<double> runTime = std::chrono::system_clock::now() - startTime;
69 std::cout <<
"Total Runtime " << runTime.count() <<
" sec" << std::endl;
int main(int argc, char *argv[])