Thread Rating:
  • 1 Vote(s) - 4 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Turtle graphics
#11
(02-15-2024, 08:18 AM)Tomaaz Wrote: ...
For smaller programs you could skip that part completely. 
...

Thank you for your response. I decided to make a small experiment, 
- The first experiment : I used sprawdz () which has katzolwia> 360 and katzolwia<0
- The second experiment :  I skipped sprawdz () 

The results are
- The first experiment produced some "shifted green lines"
- The second experiment produced a clean blue line

   

Code:
set window "Turtle Proof",640,360

reset() 'set angle to 0
set color 0,0,0;cls 'clear screen
iteration = 100

' First Experiment
' Use sprawdz () which has katzolwia> 360 and katzolwia<0
set color 0,255,0 'green
goxy(300,120)
for i = 1 to iteration
    forward(50)
    turnleft(45)
next

' Second Experiment
' Skip sprawdz () which has katzolwia> 360 and katzolwia<0
set color 0,0,255 'blue
goxy(300,220)
for i = 1 to iteration
    forward(50)
    turnleft3(45)
next

'pause
pln "Press ENTER to quit"
temp = rln()
Reply
#12
Something similar is happening with the Koch Curve example. When you set recursion to 6 or more calls, all you get is a single pixel. I'm 99% sure it wasn't happening with Yabasic or EGSL It must be something related to number precision in NaaLaa.

I should have been more clear about what I meant by "smaller programs". It doesn't matter how many line of code there is. All that matter is number of turns.
Reply
#13
(02-15-2024, 12:17 PM)Tomaaz Wrote: Something similar is happening with the Koch Curve example. When you set recursion to 6 or more calls, all you get is a single pixel. I'm 99% sure it wasn't happening with Yabasic or EGSL It must be something related to number precision in NaaLaa.

I should have been more clear about what I meant by "smaller programs". It doesn't matter how many line of code there is. All that matter is number of turns.

Nah, all numbers in n7 are doubles (64 bit floating point values). Remove the 'int' calls in turtle.n7 and you can run more iterations.
Reply
#14
Thanx, Marcus! Smile
Reply
#15
Wonderful  Big Grin
Thank you Tomaaz, your Turtle library is very useful to produce amazing turtle graphics / arts.
Thank you also to Marcus for giving us an insight regarding numbers in n7.

Herewith another turtle experiment :
   

First experiment : turtle library contained int()           
     produced "shifted green lines"

Second experiment : turtle library without int()  
     produced clean blue lines

Code:
'-------------------------------------------------------------
' Modified turtle library
'  First Experiment : function forward (dlugosc) with int()
'  Second Experiment :function forward3(dlugosc) without int()
'-------------------------------------------------------------

include "turtle_modified.n7"

set window "Turtle Experiment",640,360
reset() 'set angle to 0
set color 0,0,0;cls 'clear screen
iteration = 100

'FIRST experiment
set color 0,255,0 'green
goxy(300,120)
for i = 1 to iteration
    forward(50)
    turnleft(45)
next

'SECOND experiment
set color 0,0,255 'blue
goxy(350,120)
for i = 1 to iteration
    forward3(50)
    turnleft(45)
next

'pause
pln "Press ENTER to quit"
temp = rln()
Reply


Forum Jump:


Users browsing this thread: 4 Guest(s)