42#include "ramCanvas.hpp"
45typedef mjr::ramCanvas3c8b rcT;
46typedef rcT::colorChanType rcccT;
50 std::chrono::time_point<std::chrono::system_clock> startTime = std::chrono::system_clock::now();
51 constexpr int MAXITR = 255;
52 constexpr double ZROEPS = .0001;
53 constexpr int IMGSIZ = 7680;
54 constexpr double ang1 = 0.0;
55 constexpr double ang2 = 2*std::numbers::pi/3;
56 constexpr double ang3 = -2*std::numbers::pi/3;
57 constexpr double ang12 = (ang1+ang2)/2.0;
58 constexpr double ang13 = (ang1+ang3)/2.0;
59 constexpr double ang23 = std::numbers::pi;
60 const double normer = std::log(2*std::numbers::pi/3);
61 const double r = 0.010;
62 std::complex<double> r1( 1.0, sin(ang1));
63 std::complex<double> r2(-0.5, sin(ang2));
64 std::complex<double> r3(-0.5, sin(ang3));
65 rcT theRamCanvas(IMGSIZ, IMGSIZ, -2.15/10.0, 1.85/10.0, -1.88/10.0, 1.89/10.0);
67# pragma omp parallel for schedule(static,1)
68 for(
int y=0;y<theRamCanvas.getNumPixY();y++) {
71 std::cout <<
"line " << y <<
" of " << IMGSIZ << std::endl;
72 for(
int x=0;x<theRamCanvas.getNumPixX();x++) {
73 std::complex<double> z = theRamCanvas.int2real(x, y);
74 double minAngleDelta1 = std::numbers::pi;
75 double minAngleDelta2 = std::numbers::pi;
76 double minAngleDelta3 = std::numbers::pi;
77 for(
int count=0; count<MAXITR; count++) {
78 double modz = std::abs(z);
81 z = (-pow(z, 0.6e1) + (0.2e1 * r + 0.4e1) * pow(z, 0.3e1) + r) * pow(z, -0.2e1) / (r + 0.1e1) / 0.3e1;
82 double curAngle = std::arg(z);
83 double curAngleDelta1 = std::abs(ang12-curAngle);
84 double curAngleDelta2 = std::abs(ang13-curAngle);
85 double curAngleDelta3 = std::min(std::abs(curAngle-ang23), std::abs(curAngle+ang23));
86 if(curAngleDelta1 < minAngleDelta1) minAngleDelta1 = curAngleDelta1;
87 if(curAngleDelta2 < minAngleDelta2) minAngleDelta2 = curAngleDelta2;
88 if(curAngleDelta3 < minAngleDelta3) minAngleDelta3 = curAngleDelta3;
89 if ((modz<ZROEPS) || (std::abs(z-r1)<ZROEPS) || (std::abs(z-r2)<ZROEPS) || (std::abs(z-r3)<ZROEPS))
92 rcccT r =
static_cast<rcccT
>(50.0*std::log(minAngleDelta1)/normer);
93 rcccT g =
static_cast<rcccT
>(50.0*std::log(minAngleDelta2)/normer);
94 rcccT b =
static_cast<rcccT
>(50.0*std::log(minAngleDelta3)/normer);
95 theRamCanvas.drawPoint(x, y, rcT::colorType(r, g, b));
99 theRamCanvas.applyHomoPixTfrm(&rcT::colorType::tfrmPow, 0.4);
100 theRamCanvas.writeTIFFfile(
"newton_min_angle_starfish.tiff");
101 std::chrono::duration<double> runTime = std::chrono::system_clock::now() - startTime;
102 std::cout <<
"Total Runtime " << runTime.count() <<
" sec" << std::endl;
int main(int argc, char *argv[])