35#include "ramCanvas.hpp"
38double f(
double x,
double y) {
39 return std::pow(x, 2) * std::pow(y, 3) - std::pow(std::pow(x, 2) + std::pow(y, 2) - 1, 3);
44 std::chrono::time_point<std::chrono::system_clock> startTime = std::chrono::system_clock::now();
47 double maxH = std::hypot(width/5, height/5);
48 double ar =
static_cast<double>(width) /
static_cast<double>(height);
49 mjr::ramCanvas3c8b theRamCanvas(width, height, -2*ar, 2*ar, -2, 2);
51 for(
decltype(theRamCanvas)::coordIntType y=0;y<theRamCanvas.getNumPixY();y++)
52 for(
decltype(theRamCanvas)::coordIntType x=0;x<theRamCanvas.getNumPixX();x++) {
53 double fxy = f(theRamCanvas.int2realX(x), theRamCanvas.int2realY(y));
56 theRamCanvas.drawPoint(x, y,
decltype(theRamCanvas)::colorType::csFPcmoceanAmp::c(0.8*sqrt(1-std::abs(fxy))));
59 auto d = std::hypot(x-theRamCanvas.getNumPixX()/2, y-theRamCanvas.getNumPixY()/2);
60 theRamCanvas.drawPoint(x, y,
decltype(theRamCanvas)::colorType::csPLYquad::c(mjr::math::linm::gen_map(d, maxH, 0.0, 0.5, 1.0)));
64 theRamCanvas.drawString(
"MWU. M", mjr::hershey::font::ROMAN_SL_SANSERIF, theRamCanvas.getNumPixX()-130, 200-30,
"red", 1, 20);
65 theRamCanvas.drawString(
"2025 ", mjr::hershey::font::ROMAN_SL_SANSERIF, theRamCanvas.getNumPixX()-130, 200-60,
"red", 1, 20);
66 theRamCanvas.drawString(
" -m", mjr::hershey::font::ROMAN_SL_SANSERIF, theRamCanvas.getNumPixX()-130, 200-90,
"red", 1, 20);
68 theRamCanvas.writeTIFFfile(
"heart2025.tiff");
69 std::chrono::duration<double> runTime = std::chrono::system_clock::now() - startTime;
70 std::cout <<
"Total Runtime " << runTime.count() <<
" sec" << std::endl;
int main(int argc, char *argv[])