Flag of Europe

eu_minta

Cyprus, the Czech Republic, Estonia, Hungary, Latvia, Lithuania, Malta, Poland, Slovakia, and Slovenia joined the European Union on 1 May 2004. The picture of the week is related to the 10th anniversary (and the upcoming Europe Day), also because LibreLogo is a development of the Hungarian E-Governmental Free Software Competence Centre, too, a project that has been supported by the European Union.

The flag of the European Union was part of the Wikipedia, but its official variants, the blue (1), and black monochrome (2), moreover the white-bordered versions of the three printing variants (3, 4, 5) were created recently by LibreLogo.

White-bordered flags are for reproduction on a coloured background. This LibreLogo program draws the blue-yellow flag with the requested border size (1/25th of the height of the flag):

; go to a vertex and store its coordinate
TO vertex vertices n
    FORWARD n
    where = POSITION
    vertices += [where]
    BACK n
END

TO star n
    golden_ratio = (1 + SQRT 5)/2
    vertices = []
    HEADING 0
    REPEAT 5 [
        vertex vertices n
        RIGHT 360/10
        vertex vertices n - n / golden_ratio
        RIGHT 360/10
    ]
    ; join vertices (from the 2nd vertex)
    FOR i IN vertices [ POSITION i PENDOWN ]
    FILL PENUP
END

PICTURE “Flag_of_Europe_with_border.svg” [
    HIDETURTLE
    FILLCOLOR “WHITE”
    PENCOLOR “INVISIBLE”
    RECTANGLE [15cm+2*10cm/25, 10cm+2*10cm/25]
    FILLCOLOR 0x003399
    RECTANGLE [15cm, 10cm]
    FILLCOLOR 0xffcc00
    REPEAT 12 [
        PENUP 
        HEADING 360/12 * (REPCOUNT - 1)
        FORWARD 10cm*2/6
        star 10cm/18
        HOME
    ]
]

The following picture shows the route of the turtle:
eu_flag_path

Drawing a star consists of two steps here. Firstly, the turtle goes to the vertices (always from the center of the star), storing their coordinates in a list. The second step is a cycle on the list of coordinates, drawing and filling the outline of the star. Convex (outer) vertices of the star are situated on the circumference of an invisible circle whose radius is equal to 1/18th of the height of the flag. This radius (r) is the input parameter of the procedure „star”. Concave (inner) vertices of the star have a similar circle with smaller radius. This radius (r₂) has been calculated using the golden ratio, because the ratio of the difference of the two radii and the smaller radius is the same as the ratio of their sum (the larger radius) to the larger of the two quantities (the difference of the two radii): (rr₂)/r₂ = r/(rr₂) = (1 + √5)/2, the golden ratio (≈ 1.618).
star

Leave a Reply

Your email address will not be published. Required fields are marked *