Recent

Author Topic: Sutcliffe Fractal: Found a nice animated JavaScript version  (Read 1895 times)

Boleeman

  • Hero Member
  • *****
  • Posts: 769
Sutcliffe Fractal: Found a nice animated JavaScript version
« on: February 04, 2024, 02:13:18 am »
Finally completed the Sutcliffe Pentagon by TRon.

The Naming "Sutcliffe Pentagons" is a bit deceptive as it produces the fractal for different polygon types.

I put in another image to demonstrate nesting.

Actually TRon put a Paying it Forward messaage in the converted source so I will assume it's OK to share.

So here it is:

What I noticed is:
1.  When you change the TSpinedit for number of sides from 7 to 6 it is unresponsive, but going up to 8 sides and then back to 6 brings up the correct image.
2. Increasing the SubStructTarget values bring up exact images from previous values.
3. TRon mentions the root branch as possibly not being necessary but I do not get an image if it is not there.
 // render root branch
  CreateBranch(0, 0, Points, aNest, aStrutTarget, aSubStrutTarget, aStrutFactor);
  // ??? is the following call really necessary ???
  //  DrawBranch(Points, aNest);   
4. I used   centerY := (Self.Height - 77) div 2;  to center the image. The 77 is the height of Panel1.
    (was a bit lost on how to instead use Panel1.height in the other unit and ended up just using the value 77)
« Last Edit: January 18, 2025, 01:07:44 pm by Boleeman »

Curt Carpenter

  • Hero Member
  • *****
  • Posts: 584
Re: Sutcliffe Pentagon renders well Thanks to TRon
« Reply #1 on: February 04, 2024, 05:29:29 pm »
Interesting.  I was not familiar with the object, but found an interesting discussion of its origins here: 
https://www.codeproject.com/Articles/214536/Generative-Art-Case-Study-Sutcliffe-Pentagons

Boleeman

  • Hero Member
  • *****
  • Posts: 769
Re: Sutcliffe Pentagon renders well Thanks to TRon
« Reply #2 on: February 05, 2024, 01:32:01 am »
Curt, I had originally learnt about it at Codeproject as well and then I found a great Javascript version of it which TRon had graciously converted for this forum.

The code is based on https://github.com/tex2e/p5js-pentagon

In the Lazarus version I would like to have added opacity, perhaps using BGRAbmp.

« Last Edit: February 05, 2024, 01:40:05 am by Boleeman »

TRon

  • Hero Member
  • *****
  • Posts: 3923
Re: Sutcliffe Fractal Thanks to TRon
« Reply #3 on: February 10, 2024, 08:54:12 am »
Actually TRon put a Paying it Forward messaage in the converted source so I will assume it's OK to share.
If that was a question (indirectly  ;D ) directed to me then the answer is yes it is ok to share. That is exactly what PIF means:  use, abuse and share what you've learned/created so that others can (also) learn from it  :)

Quote
3. TRon mentions the root branch as possibly not being necessary but I do not get an image if it is not there.
Hmz, I would have to take a closer look at your current example then (bit busy atm so will do that later) because in my tests I did indeed not notice the difference. But also note that I have not the faintest idea about sutcliffe diagrams and their mathematical peculiarities (let alone know anything about the implementation that was offered at the javascript repo.. as it was (almost) a literal translation).
I do not have to remember anything anymore thanks to total-recall.

Boleeman

  • Hero Member
  • *****
  • Posts: 769
Re: Sutcliffe Fractal Thanks to TRon
« Reply #4 on: February 10, 2024, 12:13:57 pm »
Initially was unsure of the sharing status, so thanks for confirming (did not want to overstep the mark).

Still amazed at your conversion skills.
I have been practicing conversions with the Pentaflakes and Curling Pythagoras Tree programs from JavaScript.

With CSharp conversions and Python conversions, there must be a difference in World transform coordinates, as only some bits are working. Need to study up a bit more and work out why?

Thanks TRon for all your help.

lainz

  • Hero Member
  • *****
  • Posts: 4684
  • Web, Desktop & Android developer
    • https://lainz.github.io/
Re: Sutcliffe Fractal Thanks to TRon
« Reply #5 on: February 11, 2024, 02:51:22 am »
Try using bgrabitmap. It has CanvasBGRA that's the same as canvas but with antialias.

TRon

  • Hero Member
  • *****
  • Posts: 3923
Re: Sutcliffe Fractal Thanks to TRon
« Reply #6 on: February 11, 2024, 01:18:00 pm »
Thanks TRon for all your help.
Thank /you/ for taking the effort to experiment and share

I had to think a bit about the remark I made in the source-code. It is not about the creation of the branch (that is necessary) but the drawing of the root branch that seem redundant. For some reason the original code does draw the root branch directly (and thus seem to draw the root branch twice. That is, as far as my understanding of js goes). Drawing or not drawing the root branch directly after creation does not have a (visual) effect/difference (for as far as I was able to verify).

BTW: in case you wish to use BGRABitmap then you can simply adjust the helper to be a helper of class TBGRACanvas (or whatever the canvas is named in/for BGRABItmap. Lainz seem to mention CanvasBGRA). The only thing you would have to do yourself is add support for alphablending/antialiasing inside the actual sutcliffe helper code (if you would like to use live special blending effects or in case it is required to use special code for antialiasing that is).
« Last Edit: February 11, 2024, 01:31:44 pm by TRon »
I do not have to remember anything anymore thanks to total-recall.

Boleeman

  • Hero Member
  • *****
  • Posts: 769
Re: Sutcliffe Fractal Thanks to TRon
« Reply #7 on: January 18, 2025, 01:07:01 pm »
Just recently stumbled across a JavaScript the animates a Sutcliffe fractal by:

Changing its color (colour morphing)
Changing its size  (shape morphing)
Rotating

Run the index.html file in the dist folder after you decompress the files.

Kinda nice to watch, so I thought I would share it.


Might be nice to implement these animation features in the Lazarus Sutcliffe Fractal version.

 

TinyPortal © 2005-2018