Re: Alien Code...

Liste des GroupesRevenir à s math 
Sujet : Re: Alien Code...
De : chris.m.thomasson.1 (at) *nospam* gmail.com (Chris M. Thomasson)
Groupes : sci.math comp.lang.c++
Date : 21. Aug 2024, 07:19:23
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <va40tc$3ov42$1@dont-email.me>
References : 1
User-Agent : Mozilla Thunderbird
On 8/20/2024 11:17 PM, Chris M. Thomasson wrote:
I forgot to include comp.lang.c++. DAMN!!!

Here is some older code of mine that I call "Alien Code". It's pretty interesting. Here is an animation of it:
 https://youtu.be/4VrMT18Rr84
 Here is a fresh render along with some of my example code:
 https://i.ibb.co/bWqrLhj/ct-p2.png
 _________________
namespace ct_alien_code
{
     void
     iterate_0(
         ct::plot::cairo::plot_2d& scene,
         unsigned long ri,
         unsigned long rn,
         glm::vec2 origin,
         unsigned long n
     ) {
         if (ri > rn) return;
          float angle_start = 1.f / (n - 1.f) * CT_PI2;
          glm::vec2 pt = { 1, 0 };
          glm::vec2 ptx = {
             (glm::cos(angle_start) + glm::floor(glm::sin(angle_start)) * 2.f + 1.f) * .5f,
             glm::sin(angle_start) * .5f
         };
          glm::vec2 dif = ptx - pt;
          float dis = abs(dif.x * dif.x + dif.y * dif.y);
          for (unsigned long i = 0; i < n; ++i)
         {
             float ir = i / (n - 1.f);
             float angle = CT_PI2 * ir;
              glm::vec2 np = {
                 (glm::cos(angle) + glm::floor(glm::sin(angle)) * 2.f + 1.f) * .5f,
                 (glm::sin(angle)) * .5f
             };
              np += origin;
              glm::vec2 dif_np = np - ptx;
              float ddd = glm::abs(dif_np.x * dif_np.x + dif_np.y * dif_np.y);
              if (ddd <= dis && i > 1)
             {
                 glm::vec2 offset = { 1, -1 };
                  scene.line(ptx, np, CT_RGBF(1, 0, 0));
                 scene.line(-ptx, -np, CT_RGBF(1, 1, 0));
             }
              {
                 iterate_0(scene, ri + 1, rn, np, n);
             }
              ptx = np;
         }
     }
      void
     manifest(
         ct::plot::cairo::plot_2d& scene
     ) {
         std::cout << "ct_alien_code::manifest()\n\n";
          {
             {
                 iterate_0(scene, 0, 1, { 0, 0 }, 100);
             }
         }
     }
}
__________________

Date Sujet#  Auteur
21 Aug 24 * Alien Code...2Chris M. Thomasson
21 Aug 24 `- Re: Alien Code...1Chris M. Thomasson

Haut de la page

Les messages affichés proviennent d'usenet.

NewsPortal