Have converted this Github project to B4J. Sure you will figure it out:
1. Select from the ComboBox to draw Square/Triangle
2. Move the Slider to increase/decrease the number of Epicycles to draw the "wave" with
3. Click on the CheckBox(es) to enable/disable the vectors and circles.
In Class Cycle of the B4J project there are two more Java code waves that you can add (have commented them out) - leaving it up to you as it is reasonably easy to add them
This is a square wave that was drawn with 81 Epicycles (the more Epicycles you select, the closer the approximation to the square wave - move the slider up/down to see the change in the live drawing.)
You will need jCanvasExt (jar and xml - both attached to this posting) by @klaus . Download them and copy them to your B4J additional library folder.
Triangle Wave using 100 epicycles
1. Select from the ComboBox to draw Square/Triangle
2. Move the Slider to increase/decrease the number of Epicycles to draw the "wave" with
3. Click on the CheckBox(es) to enable/disable the vectors and circles.
In Class Cycle of the B4J project there are two more Java code waves that you can add (have commented them out) - leaving it up to you as it is reasonably easy to add them
This is a square wave that was drawn with 81 Epicycles (the more Epicycles you select, the closer the approximation to the square wave - move the slider up/down to see the change in the live drawing.)
You will need jCanvasExt (jar and xml - both attached to this posting) by @klaus . Download them and copy them to your B4J additional library folder.
Triangle Wave using 100 epicycles