35#include "ramCanvas.hpp"
38typedef mjr::ramCanvas1c16b::rcConverterMonoIntensity<mjr::ramCanvas3c16b, mjr::colChanI16> g2mono;
42 std::chrono::time_point<std::chrono::system_clock> startTime = std::chrono::system_clock::now();
43 constexpr int MaxCount = 255;
44 constexpr double Tol = .0001;
45 constexpr int IMGSIZ = 7680;
46 std::complex<double> r1( 1.0, 0.0);
47 std::complex<double> r2(-0.5, sin(2*std::numbers::pi/3));
48 std::complex<double> r3(-0.5, -sin(2*std::numbers::pi/3));
49 mjr::ramCanvas3c16b theRamCanvas(IMGSIZ, IMGSIZ, -2.15, 1.85, -2.0, 2.0);
50 std::complex<double> orbit [MaxCount];
52 for(
int y=0;y<theRamCanvas.getNumPixY();y++) {
53 for(
int x=0;x<theRamCanvas.getNumPixX();x++) {
54 std::complex<double> z = theRamCanvas.int2real(x, y);
56 while((count < MaxCount) && (abs(z)>Tol) && (abs(z-r1) >= Tol) && (abs(z-r2) >= Tol) && (abs(z-r3) >= Tol)) {
57 z = z-(z*z*z-1.0)/(z*z*3.0);
62 mjr::ramCanvas3c16b::colorType cDelta;
64 cDelta = mjr::ramCanvas3c16b::colorType(1, 0, 0);
65 else if(abs(z-r2) <= Tol)
66 cDelta = mjr::ramCanvas3c16b::colorType(0, 1, 0);
67 else if(abs(z-r3) <= Tol)
68 cDelta = mjr::ramCanvas3c16b::colorType(0, 0, 1);
70 cDelta = mjr::ramCanvas3c16b::colorType(0, 0, 0);
72 for(
int i=0; i<count; i++) {
73 int zri = theRamCanvas.real2intX(std::real(orbit[i]));
74 int zii = theRamCanvas.real2intY(std::imag(orbit[i]));
75 if( !(theRamCanvas.isCliped(zri, zii)))
76 theRamCanvas.getPxColorRefNC(zri, zii).tfrmAdd(cDelta);
80 theRamCanvas.applyHomoPixTfrm(&mjr::ramCanvas3c16b::colorType::tfrmLn, 11271.0);
81 theRamCanvas.autoMaxHistStrechRGB();
82 theRamCanvas.writeTIFFfile(
"newton_orbits_col.tiff");
84 theRamCanvas.rotate90CW();
85 g2mono rcFilt(theRamCanvas);
86 theRamCanvas.writeTIFFfile(
"newton_orbits_mon.tiff", rcFilt,
false);
88 std::chrono::duration<double> runTime = std::chrono::system_clock::now() - startTime;
89 std::cout <<
"Total Runtime " << runTime.count() <<
" sec" << std::endl;
int main(int argc, char *argv[])