39#include "ramCanvas.hpp"
42typedef mjr::ramCanvas3c8b rcT;
43typedef rcT::colorChanType rcccT;
47 std::chrono::time_point<std::chrono::system_clock> startTime = std::chrono::system_clock::now();
48 constexpr int MAXITR = 255;
49 constexpr double ZROEPS = .0001;
50 constexpr int IMGSIZ = 7680;
51 constexpr double ang1 = 0.0;
52 constexpr double ang2 = 2*std::numbers::pi/3;
53 constexpr double ang3 = -2*std::numbers::pi/3;
54 constexpr double ang12 = (ang1+ang2)/2.0;
55 constexpr double ang13 = (ang1+ang3)/2.0;
56 constexpr double ang23 = std::numbers::pi;
57 const double normer = std::log(2*std::numbers::pi/3);
58 std::complex<double> r1( 1.0, sin(ang1));
59 std::complex<double> r2(-0.5, sin(ang2));
60 std::complex<double> r3(-0.5, sin(ang3));
61 rcT theRamCanvas(IMGSIZ, IMGSIZ, -2.15, 1.85, -2.0, 2.0);
63# pragma omp parallel for schedule(static,1)
64 for(
int y=0;y<theRamCanvas.getNumPixY();y++) {
67 std::cout <<
"line " << y <<
" of " << IMGSIZ << std::endl;
68 for(
int x=0;x<theRamCanvas.getNumPixX();x++) {
69 std::complex<double> z = theRamCanvas.int2real(x, y);
70 double minAngleDelta1 = std::numbers::pi;
71 double minAngleDelta2 = std::numbers::pi;
72 double minAngleDelta3 = std::numbers::pi;
73 for(
int count=0; count<MAXITR; count++) {
74 double modz = std::abs(z);
77 z = z-(z*z*z-1.0)/(z*z*3.0);
78 double curAngle = std::arg(z);
79 double curAngleDelta1 = std::abs(ang12-curAngle);
80 double curAngleDelta2 = std::abs(ang13-curAngle);
81 double curAngleDelta3 = std::min(std::abs(curAngle-ang23), std::abs(curAngle+ang23));
82 if(curAngleDelta1 < minAngleDelta1) minAngleDelta1 = curAngleDelta1;
83 if(curAngleDelta2 < minAngleDelta2) minAngleDelta2 = curAngleDelta2;
84 if(curAngleDelta3 < minAngleDelta3) minAngleDelta3 = curAngleDelta3;
85 if ((modz<ZROEPS) || (std::abs(z-r1)<ZROEPS) || (std::abs(z-r2)<ZROEPS) || (std::abs(z-r3)<ZROEPS))
88 rcccT r =
static_cast<rcccT
>(50.0*std::log(minAngleDelta1)/normer);
89 rcccT g =
static_cast<rcccT
>(50.0*std::log(minAngleDelta2)/normer);
90 rcccT b =
static_cast<rcccT
>(50.0*std::log(minAngleDelta3)/normer);
91 theRamCanvas.drawPoint(x, y, rcT::colorType(r, g, b));
95 theRamCanvas.applyHomoPixTfrm(&rcT::colorType::tfrmPow, 0.4);
96 theRamCanvas.writeTIFFfile(
"newton_min_angle.tiff");
97 std::chrono::duration<double> runTime = std::chrono::system_clock::now() - startTime;
98 std::cout <<
"Total Runtime " << runTime.count() <<
" sec" << std::endl;
int main(int argc, char *argv[])