|
Post by (X) on Dec 31, 2023 17:29:39 GMT 1
Look at how few lines it takes to make something so natural looking like a fern branch.
// // Nach farn.pas, mc 4/93, Helmut Paulo // FullW 1 TitleW 1, "FernBench (32) " ForeColor = RGB(0, 255, 0) BackColor = RGB(0, 64, 0) Print "Click any mouse key to start."
// Wait for mouse button press. Do Sleep Loop Until MouseK
// Set fern draw variable values... Global f1# = 0.4, f2# = 0.85, w1# = 35, w2# = 5
// Note the start time... Local t# = Timer
// Call the fern drawing procedure... Dim x# = 100, y# = 130, l# = 160, r# = 100 P_DrawFern x, y, l, r
// Report the time it took... Compare time delta with other computers. Me.Caption = Me.Caption & Timer - t#
// Wait for exit... Do Sleep Loop Until Me Is Nothing
Proc P_DrawFern( x#, y#, l#, r#) // A recursively called procedure that iteratively draws a fern pattern... Draw "ma" x, y, "tt" r, "fd", l Dim x1# = Draw(0), y1# = Draw(1) // Stops recurive calls when (l <= 0.5)... If (l > 0.5) P_DrawFern x1, y1, l * f1, r + w1 P_DrawFern x1, y1, l * f1, r - w1 P_DrawFern x1, y1, l * f2, r + w2 EndIf EndProc
|
|
|
Post by Roger Cabo on Dec 31, 2023 19:51:15 GMT 1
|
|
|
Post by (X) on Dec 31, 2023 21:49:45 GMT 1
|
|
|
Post by scalion on Jan 7, 2024 22:53:03 GMT 1
Fun with biological creating ! (variation with bezier curve)
|
|
|
Post by (X) on Jan 7, 2024 23:50:00 GMT 1
Now you're "cooking with gas"!
|
|
|
Post by Roger Cabo on Jan 8, 2024 18:02:46 GMT 1
Why the heck it does draw the background ? And I'm not able to get it on the complete screen..
Looks a bit like fern to broccoli because of my attempts Tree3.G32 (7.5 KB)
|
|
|
Post by scalion on Jan 8, 2024 21:42:04 GMT 1
Why the heck it does draw the background ? And I'm not able to get it on the complete screen..
Looks a bit like fern to broccoli because of my attempts View Attachment
Just insert DoEvents before the first D2BeginDraw to prevents the win_1 redraw.
They look like oak leaves.
I modified your code with it and I just inserted a small counter (BDIndex) to call D2BeginDraw 1 time out of 500 to take advantage of the speed of Direct2D.
|
|