! Examples of basic shapes. ! Author: Francois Tonneau ! As usual, we start by defining the width and height of the drawing area: size 10 7.5 ! We define the line width for drawing to be 0.03 cm: set lwidth 0.03 ! GLE accepts variables of two types: floating point (i.e., numeric) and string. ! Here we define two numeric variables: 'dist' will be the horizontal distance ! between two shapes; 'adj' will be a small adjustment needed to position some ! of the shapes correctly. dist = 2 adj = 0.5 set color brown ! For our top row we draw four shapes with standard GLE commands. 'amove' is ! an absolute move, whereas 'rmove' is a move relative to current position. The ! 'just' (or 'justify') parameter to 'box' is assigned value 'cc' to center the ! object on the current position. Possible values for 'just' are: ! tl tc tr ! cl cc cr ! bl bc br ! where t = top, c = center, b = bottom, l = left, r = right. amove 2 6 box 1 1 just cc rmove dist 0 box 1 1 just cc round 0.25 rmove dist 0 circle 0.5 rmove dist 0 ellipse 0.55 0.45 ! The bottom three rows will rely on shape commands that are not part of the ! standard GLE language, but are defined in a library called 'shape.gle'. (It ! should be available on your system if GLE was installed correctly.) We write ! 'include shape.gle' to be able to use this library: include shape.gle ! The drawing commands in shape.gle rely on absolute moves, so to draw each of ! the following shapes at its correct place we must use the current position ! as origin. This is done by using 'begin origin ... end origin' blocks: amove 1.5 4 begin origin triangle 1 1 end origin rmove dist+adj adj begin origin hexagon 1.1 1.1 end origin rmove dist 0 begin origin rhomb 1.1 1.1 end origin rmove dist 0 begin origin disk end origin ! We draw another row of shapes: amove 2 3 begin origin plus 1 1 end origin rmove dist 0 begin origin cross 0.8 0.8 end origin rmove dist 0 begin origin big_arrow_ud end origin rmove dist 0 begin origin big_arrow_lr 1.2 0.8 end origin ! And another row: amove 2 1.5 begin origin big_arrow_up end origin rmove dist 0 begin origin big_arrow_down end origin rmove dist 0 begin origin big_arrow_left end origin rmove dist 0 begin origin big_arrow_right end origin ! Done. In this script we have used variables, the 'include' command, absolute ! moves, relative moves, and 'begin origin ... end origin' blocks.