Chris_M_Thomasson

Crude, Crappy Test... ;^)

Jun 29th, 2019
244
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.74 KB | None | 0 0
  1. Well, let me try to post it right here directly in the FaceBook:
  2. _________________
  3. void ct_ghee_create_strip(
  4.     ct::plot2d& plot,
  5.     ct_complex upper_left,
  6.     double width,
  7.     double height,
  8.     long n
  9. ) {
  10.     double wstep = width / n;
  11.  
  12.     ct_complex cur = upper_left;
  13.  
  14.     for (long i = 0; i < n; ++i)
  15.     {
  16.         double ir = i / (n - .0);
  17.  
  18.         double xwstep = abs(sin(CT_PI * ir * 3.0)) * wstep;
  19.  
  20.  
  21.         ct_complex woffset = { xwstep, 0 };
  22.         ct_complex hoffset = { 0, height };
  23.         ct_complex p0 = cur + woffset;
  24.         ct_complex lower_left = cur - hoffset;
  25.         ct_complex lower_right = lower_left + woffset;
  26.  
  27.         //plot.circle(cur, .01, CT_RGBF(1, 0, 0));
  28.         //plot.line(cur, p0, CT_RGBF(1, 1, 0));
  29.         //plot.line(cur, lower_left, CT_RGBF(1, 0, 1));
  30.  
  31.  
  32.         //plot.line(cur, lower_right, CT_RGBF(1, 1, 1));
  33.         //plot.line(p0, lower_left, CT_RGBF(1, 1, 1));
  34.  
  35.         ct_line_raw(plot, cur, lower_right, CT_RGBF(1, 1, 1), 512);
  36.         ct_line_raw(plot, p0, lower_left, CT_RGBF(1, 1, 0), 512);
  37.  
  38.         //plot.line(p0, lower_right, CT_RGBF(1, 0, 1));
  39.  
  40.         cur = p0;
  41.     }
  42. }
  43.  
  44.  
  45. void ct_ghee_test(
  46.     ct::plot2d& plot
  47. ) {
  48.     //ct_ghee_create_strip(plot, { -1, 1 }, 2, .5, 10);
  49.     //ct_ghee_create_strip(plot, { -1, 1 }, 2, .125, 10);
  50.     //ct_ghee_create_strip(plot, { -1, 1 - .125 }, 2, .125 / 2, 10);
  51.  
  52.     double astep = CT_PI / 100;
  53.  
  54.     ct_complex cur = { -1, 1 };
  55.  
  56.     for (long i = 0; i < 100; ++i)
  57.     {
  58.         double angle = astep * i;
  59.         double height = abs(sin(angle * 5.0)) * .125 / 4;
  60.         ct_complex hoffset = { 0, height };
  61.  
  62.         ct_ghee_create_strip(plot, cur, 4, height, 100);
  63.  
  64.         cur = cur - hoffset;
  65.     }
  66. }
  67. _________________
Advertisement
Add Comment
Please, Sign In to add comment