Asked by:
Challenge of the Month  April 2020
General discussion

This idea is from Tryhest. I moved his idea here as an independent thread.
Flower Challenge
Draw a turtle image like a flower. You can use LitDev Extension as following sample.
hi nonki!
here are some ideas for april challenges of month:
draw a turtle image like one of following:
to fill an area can be used:
 ldshapes.addpolygon
 graphicswindow.filltriangle
 LDShapes.RasteriseTurtleLines
 LDGraphicsWindow.FloodFill
 Split by Nonki TakahashiModerator Saturday, April 4, 2020 10:05 PM another topic
 Changed type Nonki TakahashiModerator Saturday, April 4, 2020 10:06 PM not question
 Edited by Nonki TakahashiModerator Saturday, April 4, 2020 10:10 PM added a description
All replies

sample code to create turtle shapes:
args=0 Sub t_Move ox=t_X oy=t_Y mm=LDMath.Convert2Cartesian(ox oy args[1] t_Angle90) t_x=mm[1] t_y=mm[2] pi=pi+1 pp[pi][1]=t_X pp[pi][2]=t_y EndSub t_x=200 t_y=200 For a0=0 To 360 Step 30 t_Angle=a0 15 LDCall.Function("t_Move" 50) t_Angle=a0+15 LDCall.Function("t_Move" 50) t_Angle=a0+18015 LDCall.Function("t_Move" 50) t_Angle=a0+180+15 LDCall.Function("t_Move" 50) LDShapes.AddPolygon(pp) pp="" EndFor
it creates this nice star:


A simple work: DSD647.
I don't know why LDGraphicsWindow.FloodFill cannot work...
Turtle.Speed=10 Turtle.Angle=60 GraphicsWindow.BrushColor="Yellow" GraphicsWindow.FillEllipse(307,241,35,35) GraphicsWindow.PenColor="Pink" For i = 1 To 5 Turtle.Move(50) For a = 1 To 100 Turtle.Move(0.5) Turtle.Turn(2) EndFor Turtle.Move(72) Turtle.Angle=60+72*i EndFor Turtle.Hide()
Seid Bereit!
Best Regards.



Add the following two lines at the end of your program, and move your third and fourth line after those two.
LDShapes.RasteriseTurtleLines() LDGraphicsWindow.FloodFill(315,225,"Pink")
Jan [ WhTurner ] The Netherlands
 Edited by WhTurner33Editor Sunday, April 5, 2020 3:12 PM added drawing



 Edited by Nonki TakahashiModerator Monday, April 6, 2020 2:37 AM wording


the turtle code is always a fascinating one as it can do miracles in a few code lines!
also u can obtain nice images with golden rule angle of 137,50 deg.
Hi Tryhest, I tried. The program ID is RPB2970.
Nonki Takahashi
 Edited by Nonki TakahashiModerator Monday, April 6, 2020 1:16 PM program updated





Cherry blossoms:
Turtle.Speed=10 Turtle.Angle=60 GraphicsWindow.PenColor="Pink" For i = 1 To 5 Turtle.Move(50) For a = 1 To 100 Turtle.Move(1) Turtle.Turn(2) EndFor Turtle.Move(50) Turtle.Angle=60+72*i EndFor Turtle.Hide() LDShapes.RasteriseTurtleLines() LDGraphicsWindow.FloodFill(315,225,"Pink") GraphicsWindow.BrushColor="DeepPink" GraphicsWindow.FillEllipse(320,210,65,65
Todo: draw the gaps on the edges of the petals.
Seid Bereit!
Best Regards.



After my turtle version of the third drawing ( KRR126) wich runs in more than 4 minutes, and the Shapes version of Tryhest (LQT869) wich runs in about 20 seconds, I converted the program to draw with GW.DrawLine. The program is published as QFW939 and draws the figure in about 3 seconds.
Jan [ WhTurner ] The Netherlands

'flower draw using turtle 'created by aabproducoes 'Antonio Augusto Barbaro 'ID to import HRW310 GraphicsWindow.PenWidth=0.3 GraphicsWindow.Title="Flower Draw Using Turtle 0.1" space= 5 'space between the lines points= 13 'points to draw the flower lenght= 50 'max lenght to draw the lines div= 150 'angles to add and subract of the central angle dist= 100 'flower radius scndst= 10 'distance between the turle points pwstart= 0.3 'pen width start pwsum= 0.19 'value added to pwstart every loop cx= GraphicsWindow.Width/2 ' center X cy= GraphicsWindow.Height/2 'center Y GraphicsWindow.Top= Desktop.Height/2cy 'centralize Y GraphicsWindow.Left= Desktop.Width/2cx 'centralize X Turtle.Show() Turtle.PenUp() Turtle.Speed=10 For n=1 To points ang= n*Math.Pi/(points/2)Math.Pi/2 angre= (n*(360/points)) px = cx+dist*Math.Cos(ang) py = cy+dist*Math.Sin(ang) GraphicsWindow.FillEllipse(px3,py3,6,6 ) For c=space To lenght Step space If color[c]="" Then color[c]= GraphicsWindow.GetRandomColor() EndIf GraphicsWindow.PenWidth= pwstart GraphicsWindow.PenColor= color[c] For z= angrediv To angre+div Step scndst GraphicsWindow.PenWidth= GraphicsWindow.PenWidth+pwsum ang= (z )*Math.Pi/180Math.Pi/2 lx[1]= px+c*Math.Cos(ang) ly[1]= py+c*Math.Sin(ang) Turtle.MoveTo(lx[1], ly[1]) If z= angrediv+10 Then Turtle.PenDown() EndIf If z>=angre+div Then Turtle.PenUp() EndIf EndFor EndFor EndFor Turtle.Hide()


