35#include "ramCanvas.hpp"
39 std::chrono::time_point<std::chrono::system_clock> startTime = std::chrono::system_clock::now();
40 constexpr int MaxCount = 255;
41 constexpr double Tol = .0001;
42 constexpr int IMGSIZ = 7680/4;
43 std::complex<double> r1( 1.0, 0.0);
44 std::complex<double> r2(-0.5, sin(2*std::numbers::pi/3));
45 std::complex<double> r3(-0.5, -sin(2*std::numbers::pi/3));
46 mjr::ramCanvas3c16b theRamCanvas(IMGSIZ, IMGSIZ, -2.15, 1.85, -2.0, 2.0);
47 std::complex<double> orbit [MaxCount];
49 for(
int y=0;y<theRamCanvas.getNumPixY();y++) {
50 for(
int x=0;x<theRamCanvas.getNumPixX();x++) {
51 std::complex<double> z = theRamCanvas.int2real(x, y);
53 while((count < MaxCount) && (abs(z)>Tol) && (abs(z-r1) >= Tol) && (abs(z-r2) >= Tol) && (abs(z-r3) >= Tol)) {
54 z = z-(z*z*z-1.0)/(z*z*3.0);
59 decltype(theRamCanvas)::colorType cDelta;
61 cDelta =
decltype(theRamCanvas)::colorType(1, 0, 0);
62 else if(abs(z-r2) <= Tol)
63 cDelta =
decltype(theRamCanvas)::colorType(0, 1, 0);
64 else if(abs(z-r3) <= Tol)
65 cDelta =
decltype(theRamCanvas)::colorType(0, 0, 1);
67 cDelta =
decltype(theRamCanvas)::colorType(0, 0, 0);
69 for(
int i=0; i<count; i++) {
70 int zri = theRamCanvas.real2intX(std::real(orbit[i]));
71 int zii = theRamCanvas.real2intY(std::imag(orbit[i]));
72 if( !(theRamCanvas.isCliped(zri, zii)))
73 theRamCanvas.getPxColorRefNC(zri, zii).tfrmAdd(cDelta);
77 theRamCanvas.applyHomoPixTfrm(&
decltype(theRamCanvas)::colorType::tfrmLn, 11271.0);
78 theRamCanvas.autoMaxHistStrechRGB();
79 theRamCanvas.writeTIFFfile(
"newton_orbits_col.tiff");
81 auto tf1 = mjr::ramCanvasPixelFilter::MonoIntensity<decltype(theRamCanvas), mjr::colChanI8>(theRamCanvas);
82 auto tf2 = mjr::ramCanvasPixelFilter::Rotate90CW<decltype(tf1)>(tf1);
83 theRamCanvas.writeTIFFfile(
"newton_orbits_mon.tiff", tf2);
85 std::chrono::duration<double> runTime = std::chrono::system_clock::now() - startTime;
86 std::cout <<
"Total Runtime " << runTime.count() <<
" sec" << std::endl;
int main(int argc, char *argv[])