Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
25
Task/Fractal-tree/QB64/fractal-tree.qb64
Normal file
25
Task/Fractal-tree/QB64/fractal-tree.qb64
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
_Title "Fractal Tree"
|
||||
Const sw% = 640
|
||||
Const sh% = 480
|
||||
|
||||
Screen _NewImage(sw, sh, 8)
|
||||
Cls , 15: Color 2
|
||||
|
||||
Call tree(sw \ 2, sh - 10, _Pi * 1.5, _Pi / 180 * 29, 112, 15)
|
||||
|
||||
Sleep
|
||||
System
|
||||
|
||||
Sub tree (x As Integer, y As Integer, initAngle As Double, theta As Double, length As Double, depth As Integer)
|
||||
Dim As Integer iL, newX, newY, iX, iY, iD
|
||||
iL = length: iX = x: iY = y: iD = depth
|
||||
newX = Cos(initAngle) * length + iX
|
||||
newY = Sin(initAngle) * length + iY
|
||||
Line (iX, iY)-(newX, newY)
|
||||
iL = length * .78
|
||||
iD = iD - 1
|
||||
If iD > 0 Then
|
||||
Call tree(newX, newY, initAngle - theta, theta, iL, iD)
|
||||
Call tree(newX, newY, initAngle + theta, theta, iL, iD)
|
||||
End If
|
||||
End Sub
|
||||
Loading…
Add table
Add a link
Reference in a new issue