34#include "ramCanvas.hpp"
37typedef double PointType[2];
41 std::chrono::time_point<std::chrono::system_clock> startTime = std::chrono::system_clock::now();
42 PointType cpt = {0.0, 0.0};
43 mjr::ramCanvas3c8b::colorType aColor[] = { mjr::ramCanvas3c8b::colorType(255, 0, 0), mjr::ramCanvas3c8b::colorType(0, 255, 0), mjr::ramCanvas3c8b::colorType(0, 0, 255) };
44 PointType pts[] = {{0.0, 0.8}, {-0.8, -0.8}, {0.8, -0.8}};
47 mjr::ramCanvas3c8b theRamCanvas(2048, 2048, -1, 1, -1, 1);
48 for(
int n=0;n<10000000;n++) {
49 int ip = rand()%NumPts;
50 cpt[0] = (pts[ip][0] + cpt[0]) / 2.0;
51 cpt[1] = (pts[ip][1] + cpt[1]) / 2.0;
53 theRamCanvas.drawPoint(cpt[0], cpt[1], aColor[ip]);
55 theRamCanvas.writeTIFFfile(
"sierpinski_triangle.tiff");
57 std::chrono::duration<double> runTime = std::chrono::system_clock::now() - startTime;
58 std::cout <<
"Total Runtime " << runTime.count() <<
" sec" << std::endl;
int main(int argc, char *argv[])