34#include "ramCanvas.hpp"
37typedef mjr::ramCanvas3c8b::colorType ct;
40double lp(std::complex<double> z,
int n) {
41 std::complex<double> lpv(0.0, 0.0);
42 for(
int i=0; i<n; i++)
43 lpv = std::pow(lpv, 2) + z;
44 return std::abs(lpv) - 2;
49 std::chrono::time_point<std::chrono::system_clock> startTime = std::chrono::system_clock::now();
50 const int IMGSIZ = 7680;
51 const int MAXITR = 1024;
52 const double MAXZSQ = 4.0;
53 const int NUMFRM = 10;
55# pragma omp parallel for schedule(static,1)
56 for(
int frame=1;frame<=NUMFRM;frame++) {
58 std::cout <<
"Frame " << frame <<
" of " << NUMFRM << std::endl;
59 mjr::ramCanvas3c8b theRamCanvas(IMGSIZ, IMGSIZ, -2.2, 0.8, -1.5, 1.5);
60 for(
int y=0;y<theRamCanvas.getNumPixY();y++) {
61 for(
int x=0;x<theRamCanvas.getNumPixX();x++) {
62 std::complex<double> c = theRamCanvas.int2real(x, y);
63 std::complex<double> z(0.0, 0.0);
64 double minDval = theRamCanvas.getCanvasWidD();
67 while((std::norm(z)<MAXZSQ) && (count<=MAXITR)) {
69 double ld = lp(z, frame);
70 if (std::abs(ld) < minDval) {
71 minDval = std::abs(ld);
72 minDsgn = (ld > 0 ? 1 : -1);
77 ct::csIntType csIdx =
static_cast<ct::csIntType
>(std::log(1+minDval)*100);
79 theRamCanvas.drawPoint(x, y, ct::csCCfractalYB::c(csIdx));
81 theRamCanvas.drawPoint(x, y, ct::csCCfractalYR::c(csIdx));
85 theRamCanvas.writeTIFFfile(
"mandelbrot_ltrap_" + mjr::math::str::fmt_int(frame, 2,
'0') +
".tiff");
87 std::chrono::duration<double> runTime = std::chrono::system_clock::now() - startTime;
88 std::cout <<
"Total Runtime " << runTime.count() <<
" sec" << std::endl;
int main(int argc, char *argv[])