Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > sci.math > #552088 > unrolled thread

Sierpinski triangle transformation

Started bysobriquet <dohduhdah@yahoo.com>
First post2022-01-24 18:37 -0800
Last post2022-01-25 20:25 -0800
Articles 5 — 2 participants

Back to article view | Back to sci.math


Contents

  Sierpinski triangle transformation sobriquet <dohduhdah@yahoo.com> - 2022-01-24 18:37 -0800
    Re: Sierpinski triangle transformation "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2022-01-25 13:54 -0800
      Re: Sierpinski triangle transformation sobriquet <dohduhdah@yahoo.com> - 2022-01-25 16:13 -0800
        Re: Sierpinski triangle transformation sobriquet <dohduhdah@yahoo.com> - 2022-01-25 17:08 -0800
          Re: Sierpinski triangle transformation "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2022-01-25 20:25 -0800

#552088 — Sierpinski triangle transformation

Fromsobriquet <dohduhdah@yahoo.com>
Date2022-01-24 18:37 -0800
SubjectSierpinski triangle transformation
Message-ID<8f958b4f-d43b-499f-9f27-86267ac3adf5n@googlegroups.com>
https://i.imgur.com/aKrh4us.png

https://www.desmos.com/calculator/nypvgblehm

[toc] | [next] | [standalone]


#552162

From"Chris M. Thomasson" <chris.m.thomasson.1@gmail.com>
Date2022-01-25 13:54 -0800
Message-ID<ssprit$bso$1@dont-email.me>
In reply to#552088
On 1/24/2022 6:37 PM, sobriquet wrote:
> 
> https://i.imgur.com/aKrh4us.png
> 
> https://www.desmos.com/calculator/nypvgblehm

Nice work! Elegant. Fwiw, when you get some really free time to kill, 
check out this older formula I came up with that generates an 
interesting escape time Sierpinski like fractal:

https://www.facebook.com/photo/?fbid=123930362099304&set=gm.799404557112051

The escape time formula:

z = (pow(z, 3.0) + (-((1.0 / 3.0) * 1.7))) / z

I am not exactly sure how to code it up in Desmos.

[toc] | [prev] | [next] | [standalone]


#552172

Fromsobriquet <dohduhdah@yahoo.com>
Date2022-01-25 16:13 -0800
Message-ID<28bd5d38-cd2e-4547-aeb8-2bdc6e306537n@googlegroups.com>
In reply to#552162
On Tuesday, January 25, 2022 at 10:54:47 PM UTC+1, Chris M. Thomasson wrote:
> On 1/24/2022 6:37 PM, sobriquet wrote: 
> > 
> > https://i.imgur.com/aKrh4us.png 
> > 
> > https://www.desmos.com/calculator/nypvgblehm 
> 
> Nice work! Elegant. 

I like the way that you can figure out aspects in isolation, like how to transform
a triangle and then plug that principle into a different context like a fractal.

https://www.desmos.com/calculator/gxbwygf9yf

But at the moment, it's rather slow, since the parameter traces out the entire
outline of the fractal.
I think I might be able to speed it up if I use the mod function so it only has to compute
one part and then it can copy that in a 120 degree rotation a couple of times.

> Fwiw, when you get some really free time to kill, 
> check out this older formula I came up with that generates an 
> interesting escape time Sierpinski like fractal: 
> 
> https://www.facebook.com/photo/?fbid=123930362099304&set=gm.799404557112051 
> 
> The escape time formula: 
> 
> z = (pow(z, 3.0) + (-((1.0 / 3.0) * 1.7))) / z 
> 
> I am not exactly sure how to code it up in Desmos.

Desmos doesn't have complex numbers built-in. So you'd have to code the relevant
operations yourself.
Like multiplication of two complex numbers (a+bi) * (c+di) = ((ac-bd) + (ad+bc)i).

https://www.desmos.com/calculator/ce99zi4fzq

I'm also working a bit on the Koch curve, and I was thinking that perhaps it can be combined
with the Sierpinski triangle into a kind of hybrid of the two or perhaps morphing between them.

https://www.desmos.com/calculator/gfkaliyaf3

[toc] | [prev] | [next] | [standalone]


#552177

Fromsobriquet <dohduhdah@yahoo.com>
Date2022-01-25 17:08 -0800
Message-ID<f7fd721c-f75b-4f33-90cf-bfa3dd64cb3an@googlegroups.com>
In reply to#552172
On Wednesday, January 26, 2022 at 1:13:31 AM UTC+1, sobriquet wrote:
> On Tuesday, January 25, 2022 at 10:54:47 PM UTC+1, Chris M. Thomasson wrote: 
> > On 1/24/2022 6:37 PM, sobriquet wrote: 
> > > 
> > > https://i.imgur.com/aKrh4us.png 
> > > 
> > > https://www.desmos.com/calculator/nypvgblehm 
> > 
> > Nice work! Elegant.
> I like the way that you can figure out aspects in isolation, like how to transform 
> a triangle and then plug that principle into a different context like a fractal. 
> 
> https://www.desmos.com/calculator/gxbwygf9yf 
> 
> But at the moment, it's rather slow, since the parameter traces out the entire 
> outline of the fractal. 
> I think I might be able to speed it up if I use the mod function so it only has to compute 
> one part and then it can copy that in a 120 degree rotation a couple of times.
> > Fwiw, when you get some really free time to kill, 
> > check out this older formula I came up with that generates an 
> > interesting escape time Sierpinski like fractal: 
> > 
> > https://www.facebook.com/photo/?fbid=123930362099304&set=gm.799404557112051 
> > 
> > The escape time formula: 
> > 
> > z = (pow(z, 3.0) + (-((1.0 / 3.0) * 1.7))) / z 
> > 
> > I am not exactly sure how to code it up in Desmos.
> Desmos doesn't have complex numbers built-in. So you'd have to code the relevant 
> operations yourself. 
> Like multiplication of two complex numbers (a+bi) * (c+di) = ((ac-bd) + (ad+bc)i). 
> 
> https://www.desmos.com/calculator/ce99zi4fzq 
> 
> I'm also working a bit on the Koch curve, and I was thinking that perhaps it can be combined 
> with the Sierpinski triangle into a kind of hybrid of the two or perhaps morphing between them. 
> 
> https://www.desmos.com/calculator/gfkaliyaf3

Desmos and Blender lack recursion. Which is a bit of a drawback when generating
fractals, as they usually are coded most elegantly relying on recursion, though you can
work your way around it.

https://www.youtube.com/watch?v=KZRbsLz_YVE

[toc] | [prev] | [next] | [standalone]


#552186

From"Chris M. Thomasson" <chris.m.thomasson.1@gmail.com>
Date2022-01-25 20:25 -0800
Message-ID<ssqift$cvt$1@dont-email.me>
In reply to#552177
On 1/25/2022 5:08 PM, sobriquet wrote:
> On Wednesday, January 26, 2022 at 1:13:31 AM UTC+1, sobriquet wrote:
>> On Tuesday, January 25, 2022 at 10:54:47 PM UTC+1, Chris M. Thomasson wrote:
>>> On 1/24/2022 6:37 PM, sobriquet wrote:
>>>>
>>>> https://i.imgur.com/aKrh4us.png
>>>>
>>>> https://www.desmos.com/calculator/nypvgblehm
>>>
>>> Nice work! Elegant.
>> I like the way that you can figure out aspects in isolation, like how to transform
>> a triangle and then plug that principle into a different context like a fractal.
>>
>> https://www.desmos.com/calculator/gxbwygf9yf
>>
>> But at the moment, it's rather slow, since the parameter traces out the entire
>> outline of the fractal.
>> I think I might be able to speed it up if I use the mod function so it only has to compute
>> one part and then it can copy that in a 120 degree rotation a couple of times.
>>> Fwiw, when you get some really free time to kill,
>>> check out this older formula I came up with that generates an
>>> interesting escape time Sierpinski like fractal:
>>>
>>> https://www.facebook.com/photo/?fbid=123930362099304&set=gm.799404557112051
>>>
>>> The escape time formula:
>>>
>>> z = (pow(z, 3.0) + (-((1.0 / 3.0) * 1.7))) / z
>>>
>>> I am not exactly sure how to code it up in Desmos.
>> Desmos doesn't have complex numbers built-in. So you'd have to code the relevant
>> operations yourself.
>> Like multiplication of two complex numbers (a+bi) * (c+di) = ((ac-bd) + (ad+bc)i).
>>
>> https://www.desmos.com/calculator/ce99zi4fzq
>>
>> I'm also working a bit on the Koch curve, and I was thinking that perhaps it can be combined
>> with the Sierpinski triangle into a kind of hybrid of the two or perhaps morphing between them.
>>
>> https://www.desmos.com/calculator/gfkaliyaf3
> 
> Desmos and Blender lack recursion. Which is a bit of a drawback when generating
> fractals, as they usually are coded most elegantly relying on recursion, though you can
> work your way around it.
> 
> https://www.youtube.com/watch?v=KZRbsLz_YVE
^^^^^^^^^^^^^^^^^^^^^

Check this out:
_________________
namespace ct_desmos_fun
{
     void koch_line(
         ct::plot::cairo::plot_2d& plot,
         unsigned long ri,
         unsigned long rn,
         glm::vec2 p0,
         glm::vec2 p1,
         float scale
     ) {
         if (ri >= rn) return;

         float mid_scale = .5f;

         glm::vec2 dif = p1 - p0;
         glm::vec2 perp = { -dif.y, dif.x };

         glm::vec2 mid = p0 + dif * mid_scale;

         glm::vec2 kp0 = p0;
         glm::vec2 kp1 = kp0 + dif * scale;
         glm::vec2 kp2 = mid + perp * scale;
         glm::vec2 kp3 = p1 - dif * scale;
         glm::vec2 kp4 = p1;

         if (ri == rn - 1)
         {
             plot.line(kp0, kp1, CT_RGBF(1, 0, 0), 5);
             plot.line(kp1, kp2, CT_RGBF(0, 1, 0), 5);
             plot.line(kp2, kp3, CT_RGBF(0, 0, 1), 5);
             plot.line(kp3, kp4, CT_RGBF(1, 1, 0), 5);
         }

         koch_line(plot, ri + 1, rn, kp0, kp1, scale);
         koch_line(plot, ri + 1, rn, kp1, kp2, scale);
         koch_line(plot, ri + 1, rn, kp2, kp3, scale);
         koch_line(plot, ri + 1, rn, kp3, kp4, scale);
     }


     void manifest(ct::plot::cairo::plot_2d& plot)
     {
         std::cout << "ct_desmos_fun::manifest()\n\n";

         // Koch Ring
         {
             glm::vec2 origin = { 0, 0 };
             float radius = 1.f;

             unsigned long n = 6;

             float angle_normal = CT_PI2 / n;

             for (unsigned long i = 0; i < n; ++i)
             {
                 float angle_0 = angle_normal * i;
                 float angle_1 = angle_0 + angle_normal;

                 glm::vec2 kp0_normal = { glm::cos(angle_0), 
glm::sin(angle_0) };
                 glm::vec2 kp1_normal = { glm::cos(angle_1), 
glm::sin(angle_1) };

                 glm::vec2 kp0 = origin + kp0_normal * radius;
                 glm::vec2 kp1 = origin + kp1_normal * radius;

                 koch_line(plot, 0, 2, kp0, kp1, 1.f / 3.f);
                 koch_line(plot, 0, 2, kp1, kp0, 1.f / 3.f);
             }
         }
     }
}
_________________


Image:

https://i.ibb.co/6YVNbCx/ct-koch.png

[toc] | [prev] | [standalone]


Back to top | Article view | sci.math


csiph-web