B4J Tutorial MathArt

Sure you will figure it out. Four rotating/pivoting arms of different length and rotating at different speeds (some CW and some CCW) to make all kinds of interesting drawings. Change the speed / direction and length of the arms in the code. The path being traced is that of the tip of the last arm.

1738495043704.png
 

Attachments

  • b4jMathArt.zip
    2.9 KB · Views: 47

BlueVision

Well-Known Member
Licensed User
Longtime User
Pretty! And there you have me again Johan. My first attempts with my ATARI130XE in graphics mode 8 looked something like this. I spent a day programming the formula and then a precise geometric marvel appeared on the screen. You could watch open-mouthed in amazement as the graphics were painted, the BASIC interpreter built into the MOS 6502 was quite busy.
 

emexes

Expert
Licensed User
Lol I was wondering what the heck you were up to. Closest I got was that you were investigating collisions between flying objects. Instead you took me back to 1975 summer holiday at Merricks Beach where we spent an inordinate amount of time doing Spirgraphs. Good job, and thank you.
 

Johan Schoeman

Expert
Licensed User
Longtime User
An update so that you can change values in the UI....sure you will figure it out. Change the values in the boxes and click on DRAW.

It is drawing the arms on one canvas and the trace on a 2nd canvas.


Busy drawing....
1.png


Drawing completed
2.png


Some other samples:
3.png


4.png


5.png
 

Attachments

  • b4jMathArt.zip
    5.4 KB · Views: 23

Johan Schoeman

Expert
Licensed User
Longtime User
Two changes:
1. Have done away with the List that held the coordinates as the drawing is done on 2 Canvases - one for the movement of the arms and the other for the trace of the end of Arm #4 (the Blue trace in the image below). Therefore don't need to keep tack of the coordinates in a list but only need to track previous and current position.
2. Have added some equally spaced dust (Alpha of White) that is caused by the movement of Arm #4 - sure you will figure out how the dust is generated (set the TimerInterval on the UI (last entry box from the top) to 200 and see how Arm #4 strewn the trailing dust).

9.png
 

Attachments

  • b4jMathArt.zip
    5.5 KB · Views: 23

Johan Schoeman

Expert
Licensed User
Longtime User
Top