Deutsch   English   Français   Italiano  
<va40qf$3ov1e$1@dont-email.me>

View for Bookmarking (what is this?)
Look up another Usenet article

Path: ...!weretis.net!feeder8.news.weretis.net!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com>
Newsgroups: sci.math
Subject: Alien Code...
Date: Tue, 20 Aug 2024 23:17:50 -0700
Organization: A noiseless patient Spider
Lines: 84
Message-ID: <va40qf$3ov1e$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Wed, 21 Aug 2024 08:17:51 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="a81bdbcc5663df071c60bf99d403b45a";
	logging-data="3963950"; mail-complaints-to="abuse@eternal-september.org";	posting-account="U2FsdGVkX1/N+CCFEf/MM3K7vm/Lr7b6gC7KngxfTGI="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:QWakhtsmOHaGlyj2jCeuP/25oOk=
Content-Language: en-US
Bytes: 2952

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);
             }
         }
     }
}
__________________