Sunflower fractal: Difference between revisions
Content added Content deleted
PatGarrett (talk | contribs) (→{{header|Microsoft Small Basic}}: Try to fix image) |
PatGarrett (talk | contribs) (→{{header|Microsoft Small Basic}}: Try to fix image) |
||
Line 17: | Line 17: | ||
EndFor </lang> |
EndFor </lang> |
||
{{out}} |
{{out}} |
||
[https:// |
[https://1drv.com/y4mKFimj9qH4oJ9rq2z_WXCRXcFQUkLdLHMVLUkg8_4aybAgAPVNrWPtkdlZkIPuvgeIgKXIq4qC3kHpe0BPAdLB2f6mX0EPfGkRYS9yvA3Qc__CQ-DgR1-CgNMHoFDDJcwQZsj0sXNv0a2tKrPiNwO7eDItq-pzCO0A8jSBxaiaCDps_fycuVv6h6wiVQMK98TJELXi-nIEMfwFsBZCT6TWg Sunflower fractal] |
||
=={{header|Ring}}== |
=={{header|Ring}}== |
Revision as of 17:02, 24 July 2018
Sunflower fractal is a draft programming task. It is not yet considered ready to be promoted as a complete task, for reasons that should be found in its talk page.
Draw Sunflower fractal
Microsoft Small Basic
<lang smallbasic>' Sunflower fractal - 24/07/2018
GraphicsWindow.Width=410 GraphicsWindow.Height=400 c=(Math.SquareRoot(5)+1)/2 numberofseeds=3000 For i=0 To numberofseeds r=Math.Power(i,c)/numberofseeds angle=2*Math.Pi*c*i x=r*Math.Sin(angle)+200 y=r*Math.Cos(angle)+200 GraphicsWindow.DrawEllipse(x, y, i/numberofseeds*10, i/numberofseeds*10) EndFor </lang>
- Output:
Ring
<lang ring>
- Project : Sunflower fractal
- Date : 2018/07/24
- Author : Gal Zsolt (~ CalmoSoft ~)
- Email : calmosoft@gmail.com
load "guilib.ring"
paint = null
new qapp
{ win1 = new qwidget() { setwindowtitle("Sunflower fractal") setgeometry(100,100,320,500) label1 = new qlabel(win1) { setgeometry(10,10,400,400) settext("") } new qpushbutton(win1) { setgeometry(100,400,100,30) settext("draw") setclickevent("draw()") } show() } exec() }
func draw
p1 = new qpicture() color = new qcolor() { setrgb(0,0,255,255) } pen = new qpen() { setcolor(color) setwidth(1) } paint = new qpainter() { begin(p1) setpen(pen)
c = (sqrt(5) + 1) / 2 numberofseeds = 3000 for i = 0 to numberofseeds r = pow(i, c ) / (numberofseeds) angle = 2 * 3.14 * c * i x = r * sin(angle) + 100 y = r * cos(angle) + 100 drawellipse(x, y, i / (numberofseeds / 10), i / (numberofseeds / 10)) next
endpaint() } label1 { setpicture(p1) show() }
</lang> Output: