B4J Tutorial Newton Fractals - all in B4J

USE THE B4J PROJECT IN POST #19 BELOW.

I have converted this Github project to a B4J project (a number of B4J classes in the B4J project to match the classes in the Github project). The project is just about 99% B4J but using a bit of JavaObject for "java.awt.Point" and "java.awt.Color". No other external libraries required.

When the B4J project starts the default formula is z^6 -1. It takes a while to draw the fractal so just be patient until the fractal is displayed. You can also edit the formula in the text fields and then click on button "Generate". You can create some very nice looking fractals (code is in the B4J project so amend it to your liking - probably mostly in class NewtonFractal depending on what you want to accomplish).

There is however something strange (timing wise) that I cannot put my finger on and maybe someone can shed some light on it:
1. When I run the B4J project for the first time it takes a "long" time to create the image (eg z^6 -1)
2. Once the image has been rendered I edit/change the formula (eg to z^8 + 15z^4 - 16z^0 --->>> as per image below) without quitting the B4J project and click on Generate again - the image is rendered much FASTER than on the initial run of the B4J project
3. If I then edit the formula to be the same as the startup formula (z^6 -1) without quitting the B4J project the image is also rendered much FASTER" than when the B4J project runs for the first time.

Why this initial "SLOW" rendering?




1690622052723.png


1690624522123.png


1690624805611.png


1690625952419.png


1690627905594.png


1690629669591.png


1690630398803.png


1690631313821.png


1690631564767.png


1690632467582.png


1690632722301.png


1690632974568.png
 

Attachments

  • b4aNewtonFractalViewer.zip
    7.7 KB · Views: 120
Last edited:

Johan Schoeman

Expert
Licensed User
Longtime User
This is where I will leave Newton Fractals for now.
You need the Jar posted in Post #25 of this thread
Sample B4J project is attached - it runs quite fast as it only graphs Z^n -1

Enjoy!

1690911103168.png
 

Attachments

  • b4jFractalLibraryNew.zip
    5.3 KB · Views: 48
Top