B4J Tutorial Discrete-Fourier-transform-visualization

It is a shortcut wrap for this Github project. Will convert it to B4J when I have some time to do so.

Attached:
1. The jar - copy it to your B4J additional libs folder
2. the B4J project - unzip it and then run it

How to use:
1. Click and hold down your mouse button and draw something (not visible) - let go of the mouse and it will draw your invisible drawing

draw.png

2. Press 1, 2, 3, 4 on your keyboard and see how it draws the pics below

1.png

2.png

3.png

4.png


All with circles.....very interesting (me thinks)
 

Attachments

  • jFourier.jar
    165.8 KB · Views: 51
  • 1.png
    1.png
    62.5 KB · Views: 73
  • 2.png
    2.png
    78 KB · Views: 72
  • b4jFourier.zip
    394.9 KB · Views: 52
Last edited:

Johan Schoeman

Expert
Licensed User
Longtime User
File from Assets are missing?

Files/calibrii.txt


edit: and others
Have updated the B4J project in Post #1.

Make sure that the /Object/Paths folder (and the file within this folder) is set to Read Only.
 

Johan Schoeman

Expert
Licensed User
Longtime User
Converted the project to 100% B4J and using a Canvas to draw on (only drawing from pre-defined sampled images in the Files Tab of the IDE).
Beautiful to see the result of a few days of head banging - change it to your liking. The hard work has been done. Just amazing what a bunch of chained circles of different diameter and different rotation speeds can do!

You need to download the jCanvasExt library by @klaus (have attached it to this posting) - it has a method to draw Ovals with on a B4J canvas. Copy the jar and xml to your B4J additional library folder. No other "external" libs required other than for jCanvasExt

There are a number of *.txt files added to the Files tab of the IDE. Change the name to the file you would like to see being drawn. Search the web for similar text files and add them to your project.

*.txt Files for DFT epicycle drawings:
    '***************************************************************
    'SELECT ONE OF THE *.txt FILES FROM THE FILES TAB OF THE IDE
    '***************************************************************
    Dim filename As String = "ipimif.txt"

Just for interest sake - the below is drawn by using 1636 epicycles.

1703577871507.png



This dragon is drawn making use of 3937 epicycles:

1703583886673.png
 

Attachments

  • jCanvasExt.jar
    5.1 KB · Views: 36
  • jCanvasExt.xml
    35.5 KB · Views: 43
  • b4jFourierEmbed.zip
    92 KB · Views: 39
Last edited:

Johan Schoeman

Expert
Licensed User
Longtime User
Have added a class called "Arrow" (for the vectors) to the attached B4J project and 2 x check boxes so that one can switch on/off the circles and the vectors while it is drawing. Click on the check boxes to enable/disable the Circles and Vectors - on the run.

Class Arrow draws very simple directional arrows on the standard B4J canvas to show the direction of the various vectors used to draw the "picture" (in this case a "Dragon".

Change the file to be drawn in line 67 of the attached B4J project. The available files are all listed in the Files Tab of the B4J IDE.

Enjoy! It is an amazing project as far as what I am concerned šŸ™ˆ

Circles displayed
1703851414409.png


Vectors displayed
1703851516796.png


Circles and Vectors displayed
1703851579343.png
 

Attachments

  • b4jFourierEmbed.zip
    375.8 KB · Views: 34
Last edited:
Top