Deutsch English Français Italiano |
<va40tc$3ov42$1@dont-email.me> View for Bookmarking (what is this?) Look up another Usenet article |
Path: ...!news.mixmin.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,comp.lang.c++ Subject: Re: Alien Code... Date: Tue, 20 Aug 2024 23:19:23 -0700 Organization: A noiseless patient Spider Lines: 90 Message-ID: <va40tc$3ov42$1@dont-email.me> References: <va40qf$3ov1e$1@dont-email.me> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Injection-Date: Wed, 21 Aug 2024 08:19:24 +0200 (CEST) Injection-Info: dont-email.me; posting-host="a81bdbcc5663df071c60bf99d403b45a"; logging-data="3964034"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18hZY5XGN63MrG7GRpFBDdqVtA0PEAqJz0=" User-Agent: Mozilla Thunderbird Cancel-Lock: sha1:okqWXNeMQ8nUp+c5dAX4Q4oJQcE= In-Reply-To: <va40qf$3ov1e$1@dont-email.me> Content-Language: en-US Bytes: 3757 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); > } > } > } > } > __________________