Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Well, let me try to post it right here directly in the FaceBook:
- _________________
- void ct_ghee_create_strip(
- ct::plot2d& plot,
- ct_complex upper_left,
- double width,
- double height,
- long n
- ) {
- double wstep = width / n;
- ct_complex cur = upper_left;
- for (long i = 0; i < n; ++i)
- {
- double ir = i / (n - .0);
- double xwstep = abs(sin(CT_PI * ir * 3.0)) * wstep;
- ct_complex woffset = { xwstep, 0 };
- ct_complex hoffset = { 0, height };
- ct_complex p0 = cur + woffset;
- ct_complex lower_left = cur - hoffset;
- ct_complex lower_right = lower_left + woffset;
- //plot.circle(cur, .01, CT_RGBF(1, 0, 0));
- //plot.line(cur, p0, CT_RGBF(1, 1, 0));
- //plot.line(cur, lower_left, CT_RGBF(1, 0, 1));
- //plot.line(cur, lower_right, CT_RGBF(1, 1, 1));
- //plot.line(p0, lower_left, CT_RGBF(1, 1, 1));
- ct_line_raw(plot, cur, lower_right, CT_RGBF(1, 1, 1), 512);
- ct_line_raw(plot, p0, lower_left, CT_RGBF(1, 1, 0), 512);
- //plot.line(p0, lower_right, CT_RGBF(1, 0, 1));
- cur = p0;
- }
- }
- void ct_ghee_test(
- ct::plot2d& plot
- ) {
- //ct_ghee_create_strip(plot, { -1, 1 }, 2, .5, 10);
- //ct_ghee_create_strip(plot, { -1, 1 }, 2, .125, 10);
- //ct_ghee_create_strip(plot, { -1, 1 - .125 }, 2, .125 / 2, 10);
- double astep = CT_PI / 100;
- ct_complex cur = { -1, 1 };
- for (long i = 0; i < 100; ++i)
- {
- double angle = astep * i;
- double height = abs(sin(angle * 5.0)) * .125 / 4;
- ct_complex hoffset = { 0, height };
- ct_ghee_create_strip(plot, cur, 4, height, 100);
- cur = cur - hoffset;
- }
- }
- _________________
Advertisement
Add Comment
Please, Sign In to add comment