(Adapted from Program to mill a flowsnake.ngc by K. Lerman) (info: gosper -- recursion demo -- line is x1,y1 to x2,y2) o sub # = #1 (=2000) # = #2 (=.010 depth of cut) # = #3 (=10) # = #4 (=0.5 safety height) # = #5 (=-0.866 line x1) # = #6 (=-0.5 line y1) # = #7 (= 0.866 line x2) # = #8 (=-0.5 line y2) # = #9 (=3 recursion lvl) # = #10 (=1) # = #11 (=0) # = #12 (=-3) # = #13 (=-3) o if [# EQ 0] # = 1.0 (debug, scale was 0, setting #) o endif o if [# LT 0] # = 0 (debug, level set to #) o endif o if [# GT 4] # = 4 (debug, level reduced to #) o endif o call [#][#][#][#][#][#] # = #<_move:x> # = #<_move:y> # = #<_move:len> # = #<_move:phi> o call [#][#][#][#][#][#] # = #<_move:x> # = #<_move:y> # = #<_move:len> # = #<_move:phi> # = # s# M3 (spindle on) o call [#] g0 z # g0 x # y # f # g1 z [0 - #] # = [# - #] # = [# - #] # = [SQRT[#*# + #*#]] # = ATAN [#]/[#] (degrees) (compute p3 for equilateral triangle) # = [# + # * COS[# + 60]] # = [# + # * SIN[# + 60]] (threee sides of equilateral triangle) o call [#][#] [#] [#] [#] [#] o call [#][#] [#] [#][#][#] o call [#][#][#][#] [#] [#] g0 z # o endsub