Islamic Tiles — Programs — LOGO last changed 3 June 2008 |
; rectangular indenting flag.
; columns and rows are given by the first 2 parameters.
; the distance between columns and rows are given by the next 2 parameters.
; the indent is controlled by the next parameter.
; the number of sides and radius of CNGON are given by the last 2 parameters.
to RIFLAG :cols :rows :cdist :rdist :in :cngonn :cngonside
if :rows < 1 [stop]
ROWER :cdist (first :cols) :cngonn :cngonside
IRSTEP :rdist :in
RIFLAG (ROTATE :cols) (:rows - 1) :cdist :rdist (ROTATE :in) :cngonn :cngonside
end
; indenting rowstep. moves the turtle from the end of one row to the beginning of the
; next row. the parameters give the distance between the beginning and end and a list
; to control indenting.
to IRSTEP :r :in
pu setx (first mypoint) + (item 1 :in)
bk :r pd
end
; draws a row of :n CNGONs with :cngonn sides of length :cngonside, separated by :c
to ROWER :c :n :cngonn :cngonside
; paint a row of :n cngons, separated by column distance :c
if :n < 1 [stop]
CNGON :cngonn :cngonside
CSTEP :c
ROWER :c (:n - 1) :cngonn :cngonside
end
; move the turtle over one column
; :cdist is between-column distance
to CSTEP :cdist
pu rt 90
fd :cdist
lt 90 pd
end
; CNGON creates a regular polygon, centered on the origin.
; the number of sides and the radius of the polygon are given by the obvious inputs.
to CNGON :sides :radius
pu fd :radius lt 90 + 180 / :sides pd
NGON :sides ((sin 180 / :sides) * :radius * 2)
pu rt 90 + 180 / :sides bk :radius pd
end