40#include "ramCanvas.hpp"
41#include "MRMathESGN.hpp"
44double f(
double x,
double y);
48 std::chrono::time_point<std::chrono::system_clock> startTime = std::chrono::system_clock::now();
50 mjr::ramCanvas3c8b theRamCanvas(7680/2, 4320/2, -10.0, 10.0, -6.0, 6.0);
54 for(
int yi=0;yi<theRamCanvas.getNumPixY();yi++) {
55 for(
int xi=0;xi<theRamCanvas.getNumPixX();xi++) {
56 double fxy = f(theRamCanvas.int2realX(xi), theRamCanvas.int2realY(yi));
57 theRamCanvas.drawPoint(xi, yi, mjr::ramCanvas3c8b::colorType::csPGrey3x::c(
static_cast<mjr::ramCanvas3c8b::csIntType
>((382*(1+fxy)))));
63 for(
int yi=0;yi<theRamCanvas.getNumPixY();yi++) {
64 for(
int xi=0;xi<theRamCanvas.getNumPixX();xi++) {
65 std::vector<mjr::math::esgn::signT> signs(4);
66 for(
int c=0;c<4;c++) {
67 auto fpt = theRamCanvas.int2realCorner(xi, yi, c);
68 signs[c] = mjr::math::esgn::sgn(f(fpt.x, fpt.y));
70 if (mjr::math::esgn::zero_or_change(signs))
71 theRamCanvas.drawPoint(xi, yi, mjr::ramCanvas3c8b::colorType::cornerColorEnum::RED);
75 theRamCanvas.writeTIFFfile(
"demo_corners.tiff");
76 std::chrono::duration<double> runTime = std::chrono::system_clock::now() - startTime;
77 std::cout <<
"Total Runtime " << runTime.count() <<
" sec" << std::endl;
81double f(
double x,
double y) {
82 double z = y+2*std::exp(-x*x/4);
83 double d = std::sqrt(x*x+y*y);
84 double a = std::atan2(std::abs(x), std::abs(z)+0.1);
85 return std::sin(d*d)*std::sin(9*a*d+0*
int(d+1));
int main(int argc, char *argv[])