Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- namespace ct_log_spiral
- {
- void iterate_point(
- ct::plot::cairo::plot_2d& plot,
- glm::vec3 oc,
- unsigned long n,
- unsigned long x,
- unsigned long y
- ) {
- ct_complex c = { oc.x, oc.y };
- ct_complex z = c;
- double dis_max = 9999999.0;
- // start i at one
- for (unsigned long i = 1; i < n; ++i)
- {
- //ct_complex zp = z * z + c;
- ct_complex zp = (std::pow(z, 1.3) - (1.0 / (std::log(z) + 0.11))) + 0.42457;
- double slow = 1.2 + (1 / i);
- zp /= slow;
- double dis = std::abs(zp);
- dis_max = std::min(dis_max, dis);
- if (dis > 4.f)
- {
- double icolor = i / (n - 1.f);
- ct::plot::cairo::pixel color = CT_RGBF(icolor * 44., icolor * 15., icolor * 45);
- plot.set_pixel(x, y, color);
- return;
- }
- z = zp;
- }
- ct::plot::cairo::pixel color = CT_RGBF(dis_max * 11.f, 0, 1);
- plot.set_pixel(x, y, color);
- }
- void iterate_plane(
- ct::plot::cairo::plot_2d& plot
- ) {
- std::cout << "ct_log_spiral::iterate_plane\n\n";
- for (unsigned long y = 0; y < plot.m_height; ++y)
- {
- for (unsigned long x = 0; x < plot.m_width; ++x)
- {
- glm::vec3 vc = { plot.m_plane.project_to(x, y), 0.f };
- iterate_point(plot, vc, 123, x, y);
- }
- std::cout << "y = " << y << "\r";
- }
- std::cout << "complete!!!!!!" << "\n";
- }
- void manifest(ct::plot::cairo::plot_2d& plot)
- {
- std::cout << "ct_log_spiral::manifest\n\n";
- iterate_plane(plot);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment