LibreOffice Berlin 2012 Conference Presentation Template

66
1 LibreOffice Berlin 2012 Conference • LibreLogo – turtle vector graphics for everybody LibreLogo Turtle Vector Graphics for Everybody László Németh «[email protected]» 2012-10-17

Transcript of LibreOffice Berlin 2012 Conference Presentation Template

Page 1: LibreOffice Berlin 2012 Conference Presentation Template

1LibreOffice Berlin 2012 Conference • LibreLogo – turtle vector graphics for everybody

LibreLogoTurtle Vector Graphics for Everybody

László Németh «[email protected]»2012-10-17

Page 2: LibreOffice Berlin 2012 Conference Presentation Template

2LibreOffice Berlin 2012 Conference • LibreLogo – turtle vector graphics for everybody

Why turtle graphics?

“Turtles”: drawing robots

Page 3: LibreOffice Berlin 2012 Conference Presentation Template

3LibreOffice Berlin 2012 Conference • LibreLogo – turtle vector graphics for everybody

Why not ladybird graphics?

A learning robot (from 1957, Hungary) directed by phototaxis

Page 4: LibreOffice Berlin 2012 Conference Presentation Template

4LibreOffice Berlin 2012 Conference • LibreLogo – turtle vector graphics for everybody

“In 1972, BBN engineer

Paul Wexelblat designed and built the first wireless

floor turtle, ‘Irving.’ … Before we settled on

bumpers as the appropriate device for

touch sensors, we considered the use of antennas. (If we had

done that, we might have called Irving a beetle

instead of a turtle!)”

Wallace Feurzeug

Page 5: LibreOffice Berlin 2012 Conference Presentation Template

5LibreOffice Berlin 2012 Conference • LibreLogo – turtle vector graphics for everybody

Seymour Papert

“The Turtle is seen as a metaphor, an ‘object-to-think-with’”

Page 6: LibreOffice Berlin 2012 Conference Presentation Template

6LibreOffice Berlin 2012 Conference • LibreLogo – turtle vector graphics for everybody

…in experiments on children

Page 7: LibreOffice Berlin 2012 Conference Presentation Template

7LibreOffice Berlin 2012 Conference • LibreLogo – turtle vector graphics for everybody

…to make the educational system better.

The

firs

t tu

rtle

(w

ith a

tai

l for

sta

bilit

y an

d un

derc

arria

ge v

iew

abili

ty).

Page 8: LibreOffice Berlin 2012 Conference Presentation Template

8LibreOffice Berlin 2012 Conference • LibreLogo – turtle vector graphics for everybody

Grey Walter’s first robots, which he used to call Machina speculatrix and named Elmer and Elsie, were constructed between 1948 and 1949 and were often described as tortoises due to their shape and slow rate of movement - and because they “taught us” about the secrets of organization and life. (Wikipedia)

Grey Walter’s “tortoises”

Page 9: LibreOffice Berlin 2012 Conference Presentation Template

9LibreOffice Berlin 2012 Conference • LibreLogo – turtle vector graphics for everybody

a tail for the stability

1968, BBN, Logo class for 7th grades by Seymour Papert (former collegaue and protégé of Jean Piaget) and Cynthia Solomon1970, MIT AI Lab, “Yellow turtle”, Logo class for 5th gradeshttp://logothings.wikispaces.com

Logo

Page 10: LibreOffice Berlin 2012 Conference Presentation Template

“Kids should see technology as an enriching,

creative thing.” Seymour Papert, 1970

Page 11: LibreOffice Berlin 2012 Conference Presentation Template

11LibreOffice Berlin 2012 Conference • LibreLogo – turtle vector graphics for everybody

Like mobile applications…

Page 12: LibreOffice Berlin 2012 Conference Presentation Template

12LibreOffice Berlin 2012 Conference • LibreLogo – turtle vector graphics for everybody

�And what about the kids?

Will every 5th grades be interested in Android programming?

� ��

����

� ��

��

���

��

Page 13: LibreOffice Berlin 2012 Conference Presentation Template

13LibreOffice Berlin 2012 Conference • LibreLogo – turtle vector graphics for everybody

And what about office suites?

Can word processing be fun in schools?

��

����

��

���

Page 14: LibreOffice Berlin 2012 Conference Presentation Template

14LibreOffice Berlin 2012 Conference • LibreLogo – turtle vector graphics for everybody

Revival of command line?

Python console, eg. in the Blender 3D modeling creation suite Windows PowerShellSpring Roo for Java EE developmentUnity Dash on UbuntuFirefox Command Line for developersFormula Bar in LibreOffice Writer (press F2)

Page 15: LibreOffice Berlin 2012 Conference Presentation Template

15LibreOffice Berlin 2012 Conference • LibreLogo – turtle vector graphics for everybody

Theory of Logo and turtle graphics

ConstructionismObject-to-think-withdirect feedback (syntax error, bad turtle positions)

Page 16: LibreOffice Berlin 2012 Conference Presentation Template

16LibreOffice Berlin 2012 Conference • LibreLogo – turtle vector graphics for everybody

Practice of Logo and turtle graphics

Simple syntax for childrenNative and understandable wordsOnly letters, without parenthesization

Fun with drawing robots

Page 17: LibreOffice Berlin 2012 Conference Presentation Template

17LibreOffice Berlin 2012 Conference • LibreLogo – turtle vector graphics for everybody

Logo in Hungarian schools

Logo programmingteaching of computingteacher education

Closed source (Comenius Logo, Imagine Logo)Platform-dependent (Windows)Native (“előre” = “forward”)

Page 18: LibreOffice Berlin 2012 Conference Presentation Template

18LibreOffice Berlin 2012 Conference • LibreLogo – turtle vector graphics for everybody

LibreLogo – an answer for the problems

Free/open sourcePortable (also HTML 5 was tested before)LibreOffice extension

http://extensions.libreoffice.org/extension-center/librelogo/

Page 19: LibreOffice Berlin 2012 Conference Presentation Template

19LibreOffice Berlin 2012 Conference • LibreLogo – turtle vector graphics for everybody

What is LibreLogo?

A programming environment for children and graphic designBack compatible with older educational Logo environmentswith full localization (set the language of the document)Vector graphics for printing qualityDrawing objects: combine programming and image editing

Page 20: LibreOffice Berlin 2012 Conference Presentation Template

Logo toolbar in Writer(View » Toolbars » Logo)

Logo toolbar in Writer(View » Toolbars » Logo)

turtle moving arrows(forward 10, back 10,

left 15, right 15)put the turtle to thecenter of the page,focus and scroll the

page to the turtle

turtle moving arrows(forward 10, back 10,

left 15, right 15)put the turtle to thecenter of the page,focus and scroll the

page to the turtle

Page 21: LibreOffice Berlin 2012 Conference Presentation Template

turtleturtle

command line(run by enter)

command line(run by enter)

clear drawingsclear drawings

stopstop

canvas (first page of thetext document) and

possible program area(or insert a page break

to start a new pageto the Logo program)

canvas (first page of thetext document) and

possible program area(or insert a page break

to start a new pageto the Logo program)

run the Logo program(text in the document)

run the Logo program(text in the document)

homehome

Page 22: LibreOffice Berlin 2012 Conference Presentation Template

repeat 500 [ circle 10 + repcount/10 fd 5 + repcount/10 lt 10 ]

Page 23: LibreOffice Berlin 2012 Conference Presentation Template

23LibreOffice Berlin 2012 Conference • LibreLogo – turtle vector graphics for everybody

Advantages of LibreOffice

Free and portableVector graphicsInteractive shapes or shape groupsDirect use of the Logo drawing objects (print, or paste into documents only via clipboard)Printing quality: PDF or (via Draw) SVG exportAnti-aliasingZoomAutomatic scroll (turtle tracing)Alpha transparencyStandard file format (OpenDocument)Unicode support, TrueType/Graphite font technology

Page 24: LibreOffice Berlin 2012 Conference Presentation Template

24LibreOffice Berlin 2012 Conference • LibreLogo – turtle vector graphics for everybody

Vector graphics

One of the first shapes created by the prototype:

repeat 36 [forward 5 left 90forward 5 right 90forward 5 right 90forward 5 left 100

]

fill

Page 25: LibreOffice Berlin 2012 Conference Presentation Template

25LibreOffice Berlin 2012 Conference • LibreLogo – turtle vector graphics for everybody

Complex shapes

Shapes with intersecting sides have got complex filling

repeat 88 [forward 200left 89

]

fill

fd 200 lt 89

(Or without loop, press enters on the following command line:

and in the end, “fill” it.)

Page 26: LibreOffice Berlin 2012 Conference Presentation Template

26LibreOffice Berlin 2012 Conference • LibreLogo – turtle vector graphics for everybody

Teaching of computing: word processing

Simple IDE: error message and the cursor jumps to the faulty line.

Logo program editor: Writer.Logo program editor: Writer.

Page 27: LibreOffice Berlin 2012 Conference Presentation Template

27LibreOffice Berlin 2012 Conference • LibreLogo – turtle vector graphics for everybody

Teaching of computing: image handling

LibreLogo drawings: shapes or objects.Select, move, resize (hold Shift to keepratio), add text (double click), modifytheir features by the Drawing ObjectsProperties Bar (enabled by selection).

LibreLogo drawings: shapes or objects.Select, move, resize (hold Shift to keepratio), add text (double click), modifytheir features by the Drawing ObjectsProperties Bar (enabled by selection).

Page 28: LibreOffice Berlin 2012 Conference Presentation Template

28LibreOffice Berlin 2012 Conference • LibreLogo – turtle vector graphics for everybody

Teaching of computing: image handling

default settings of the shapes wrap in backgroundwrap in background

anchor to pageanchor to page

Page 29: LibreOffice Berlin 2012 Conference Presentation Template

29LibreOffice Berlin 2012 Conference • LibreLogo – turtle vector graphics for everybody

Teaching of computing: Python programming

LibreLogo programs converted to Python and running in PyUNO environment by the embedded Python of LibreOfficeLibreLogo supports Python

for+in cycle (localized versions)string operationsregular expressions

and advanced Python data structuresliststuplesdictionariessets

open Python source of LibreLogo

Page 30: LibreOffice Berlin 2012 Conference Presentation Template

30LibreOffice Berlin 2012 Conference • LibreLogo – turtle vector graphics for everybody

Turtle in LibreLogo

Arrow-like shapeMoveable and rotatable like the standard drawing objectsIts line width, style and colors show the turtle settings

Page 31: LibreOffice Berlin 2012 Conference Presentation Template

31LibreOffice Berlin 2012 Conference • LibreLogo – turtle vector graphics for everybody

Go forward by the given typographical points

forward 10

Page 32: LibreOffice Berlin 2012 Conference Presentation Template

32LibreOffice Berlin 2012 Conference • LibreLogo – turtle vector graphics for everybody

Turn left (counterclockwise) the given degrees

forward 10left 90

Page 33: LibreOffice Berlin 2012 Conference Presentation Template

33LibreOffice Berlin 2012 Conference • LibreLogo – turtle vector graphics for everybody

forward 10left 90forward 10

Page 34: LibreOffice Berlin 2012 Conference Presentation Template

34LibreOffice Berlin 2012 Conference • LibreLogo – turtle vector graphics for everybody

Expressions as function parameters

forward 10left 90forward 10left 90+45

Page 35: LibreOffice Berlin 2012 Conference Presentation Template

35LibreOffice Berlin 2012 Conference • LibreLogo – turtle vector graphics for everybody

Expression with a square root function (sqrt)

forward 10left 90forward 10left 90+45forward sqrt 2*10*10

Page 36: LibreOffice Berlin 2012 Conference Presentation Template

36LibreOffice Berlin 2012 Conference • LibreLogo – turtle vector graphics for everybody

Hide the turtle (until the command showturtle)

forward 10left 90forward 10left 90+45forward sqrt 2*10*10hideturtle

Page 37: LibreOffice Berlin 2012 Conference Presentation Template

37LibreOffice Berlin 2012 Conference • LibreLogo – turtle vector graphics for everybody

Loop – repeat n times [ commands ]

repeat 8 [forward 10left 90forward 10left 90+45forward sqrt 2*10*10hideturtle

]

Page 38: LibreOffice Berlin 2012 Conference Presentation Template

38LibreOffice Berlin 2012 Conference • LibreLogo – turtle vector graphics for everybody

Repcount – default loop variable from 1 to n

repeat 100 [fd repcountlt 90

]

Page 39: LibreOffice Berlin 2012 Conference Presentation Template

39LibreOffice Berlin 2012 Conference • LibreLogo – turtle vector graphics for everybody

Comments and abbreviations

; some commands have; abbreviated forms

repeat 8 [fd 10 lt 90fd 10 lt 90+45fd sqrt 2*10*10

]

Page 40: LibreOffice Berlin 2012 Conference Presentation Template

40LibreOffice Berlin 2012 Conference • LibreLogo – turtle vector graphics for everybody

New words (procedures)

to wheel sizerepeat 8 [

fd size lt 90fd size lt 90+45fd sqrt 2*size**2

]end

repeat 10 [wheel 10 + random 10fd 40 lt 36

]

Page 41: LibreOffice Berlin 2012 Conference Presentation Template

41LibreOffice Berlin 2012 Conference • LibreLogo – turtle vector graphics for everybody

Drawing circle (polygon with 360 sides)

repeat 360 [fd 1lt 1

]

Page 42: LibreOffice Berlin 2012 Conference Presentation Template

42LibreOffice Berlin 2012 Conference • LibreLogo – turtle vector graphics for everybody

With recursion

to polygonfd 1lt 1polygon

end

polygon

Page 43: LibreOffice Berlin 2012 Conference Presentation Template

43LibreOffice Berlin 2012 Conference • LibreLogo – turtle vector graphics for everybody

Conditions (eg. branch length of a recursive tree)

to tree lenif len < 2 [ stop ]fd len lt 50tree len/2rt 100 tree len/2lt 50 bk len

end

tree 100

Page 44: LibreOffice Berlin 2012 Conference Presentation Template

44LibreOffice Berlin 2012 Conference • LibreLogo – turtle vector graphics for everybody

Dragon curve

to x nif n = 0 [ stop ]x n-1 rt 90y n-1 fd 4

end

to y nif n = 0 [ stop ]fd 4 x n-1lt 90 y n-1

end

fd 4 x 12

Page 45: LibreOffice Berlin 2012 Conference Presentation Template

45LibreOffice Berlin 2012 Conference • LibreLogo – turtle vector graphics for everybody

LibreLogo 0.2 may need explicit parenthesization

to x nif n = 0 [ stop ]x n-1 rt 90y (n-1) fd 4

end

to y nif n = 0 [ stop ]fd 4 x n-1lt 90 y n-1

end

fd 4 x 12

Page 46: LibreOffice Berlin 2012 Conference Presentation Template

46LibreOffice Berlin 2012 Conference • LibreLogo – turtle vector graphics for everybody

Fill and close the actual shape (not flood fill)

fd 25 lt 90 fd 25 fill

penup fd 5 pendown

fd 50 lt 90 fd 100lt 90 fd 80 lt 90fd 70 close

Page 47: LibreOffice Berlin 2012 Conference Presentation Template

47LibreOffice Berlin 2012 Conference • LibreLogo – turtle vector graphics for everybody

Penup (pu) doesn’t start new line shapes

repeat 4 [pu fd 100 pd fd 100rt 90 fd 100

]

Page 48: LibreOffice Berlin 2012 Conference Presentation Template

48LibreOffice Berlin 2012 Conference • LibreLogo – turtle vector graphics for everybody

Penup (pu) doesn’t start new line shapes

repeat 4 [pu fd 100 pd fd 100rt 90 fd 100

]

fill

Page 49: LibreOffice Berlin 2012 Conference Presentation Template

49LibreOffice Berlin 2012 Conference • LibreLogo – turtle vector graphics for everybody

Use “picture” (pic) for new line shapes

repeat 4 [picpu fd 100 pd fd 100rt 90 fd 100

]

fill

Page 50: LibreOffice Berlin 2012 Conference Presentation Template

50LibreOffice Berlin 2012 Conference • LibreLogo – turtle vector graphics for everybody

Frame (a complex shape)

to box xrepeat 4 [ fd x rt 90 ]end

; two disjoint squaresbox 300pu fd 30 rt 90 fd 30lt 90 pdbox 240fill

Page 51: LibreOffice Berlin 2012 Conference Presentation Template

51LibreOffice Berlin 2012 Conference • LibreLogo – turtle vector graphics for everybody

Logo and LibreLogo

Logo Differences LibreLogo

turnright 90= rt 90

optional clock positions►(suitable for the lower grades)

turnright 90° = rt 90 =turnright 3h

forward 1= fd 90

DTP point, inch, cm, mm►◄pixel

forward 1pt = fd 1 =fd 1in/72 = fd 2.54cm/72

fill (flood-fill, need position)

vector graphics►◄raster graphics

fill (close and fill actual shape)

"word[string]

text notationwriting standard►

◄formal (LISP)

“string” (orthography, Writer), 'string' (Python), "word, "word"

lists [](eg. 1-line instruction list)

Python in Logo turtle shell►◄functional programming language

blocks [ ] (need space or line break) and lists [], eg.repeat 5 [ ellipse [5, 10] ]

Page 52: LibreOffice Berlin 2012 Conference Presentation Template

52LibreOffice Berlin 2012 Conference • LibreLogo – turtle vector graphics for everybody

Color names

“black” “silver”“gray”“grey”

“white” “maroon”

“red” “purple”“fuchsia”“magenta” “green” “lime”

“olive” “yellow” “navy” “blue” “teal”

“aqua”“cyan”

“pink” “tomato” “orange” “gold”

“violet” “skyblue” “chocolate” “brown” “invisible”

Page 53: LibreOffice Berlin 2012 Conference Presentation Template

53LibreOffice Berlin 2012 Conference • LibreLogo – turtle vector graphics for everybody

Pensize (ps), pencolor (pc), fillcolor (fc), text

pensize 30fillcolor “purple”pencolor “fuchsia”square 360fillcolor “lime”pencolor “green”circle 300fontsize 80

; text of the actual; shapetext “LOGO”

LOGO

Page 54: LibreOffice Berlin 2012 Conference Presentation Template

54LibreOffice Berlin 2012 Conference • LibreLogo – turtle vector graphics for everybody

Label

fontsize 50penuprepeat 10 [

forward 170label “logo”back 170lt 360/10

]

logologo

logo

logo

logologo

logo

logologo

logo

Page 55: LibreOffice Berlin 2012 Conference Presentation Template

55LibreOffice Berlin 2012 Conference • LibreLogo – turtle vector graphics for everybody

Random Unicode 6.0 emoticons

penupfontfamily “Symbola”repeat 10 [

pos anyfontcolor anyfontsize 50 +

random 50label random “�😁�

�😄��😇😈😉���😍�😏��😒😓😔��😗😘�😚😛����😡😢😣�😥�😧�😩😪😫��😮😯😰����😵😶😷😸😹��😼😽���”]

😩 😍

😹

😗😼

�😢

Page 56: LibreOffice Berlin 2012 Conference Presentation Template

56LibreOffice Berlin 2012 Conference • LibreLogo – turtle vector graphics for everybody

Loop – for + in (lists, character strings)

to bear pu circle 100 lt 45 fd 70 circle 50 bk 70 rt 90 fd 70 circle 50 bk 70 rt 45 bk 20 ; eyes repeat 2 [ fc “white” circle 25 fc “black” circle 10 fd 40 ] bk 60 rt 90 fd 25 circle 30 bk 25 lt 180end

for k in [“gold”, “orange”, ~ “tomato”, “purple”, ~ “skyblue”] [ fc k bear fd 100 lt 360/5]

Page 57: LibreOffice Berlin 2012 Conference Presentation Template

57LibreOffice Berlin 2012 Conference • LibreLogo – turtle vector graphics for everybody

Shape groups by picture [ … ]

pic [ circle 10fd 40 circle 10

]

Page 58: LibreOffice Berlin 2012 Conference Presentation Template

58LibreOffice Berlin 2012 Conference • LibreLogo – turtle vector graphics for everybody

Shape groups by picture [ … ] + Draw effects

pic [ bear ]

Page 59: LibreOffice Berlin 2012 Conference Presentation Template

59LibreOffice Berlin 2012 Conference • LibreLogo – turtle vector graphics for everybody

Shape groups by picture [ … ]

to triangle size colorrepeat 3 [ fd size lt 120 ]fc color fill

end

to box size frepeat 2 [ fd size*10 rt 90fd size*f rt 90 ]

end

to pencil size colorbox size 1 fc color fillbox size 2/3 box size 1/3close rt 150triangle size “chocolate”fd size*0.75triangle size/4 colorback size*0.75 lt 150

]end

pic [ pencil 100 “red” ]

Page 60: LibreOffice Berlin 2012 Conference Presentation Template

60LibreOffice Berlin 2012 Conference • LibreLogo – turtle vector graphics for everybody

Desktop publishing

Unicode chess figuresautomatic ormanual positioning

87654321 a b c d e f g h

♖♜♘♞♗♝♕♛♔♚♗♝♘♞♖♜♙♟♙♟♙♟♙♟♙♟♙♟♙♟♙♟

♟♙♟♙♟♙♟♙♟♙♟♙♟♙♟♙♜♖♞♘♝♗♛♕♚♔♝♗♞♘♜♖

Page 61: LibreOffice Berlin 2012 Conference Presentation Template

61LibreOffice Berlin 2012 Conference • LibreLogo – turtle vector graphics for everybody

Complex shape groups for graphical design

Grouping of Unicode characters and square shapes for white background of figures and comfortable manual positioning

♟♙ ♟♙→ ♟♙ →

Page 62: LibreOffice Berlin 2012 Conference Presentation Template

62LibreOffice Berlin 2012 Conference • LibreLogo – turtle vector graphics for everybody

Graphic design

L i b r e

ff

ic

e❤Cone

re

n c e ❤ B

er

in2

0 1 2❤

5

Page 63: LibreOffice Berlin 2012 Conference Presentation Template

63LibreOffice Berlin 2012 Conference • LibreLogo – turtle vector graphics for everybody

Goals

Teaching of computingProgramming

free, portable and modern Logo alternative withPython (data structures, open source of LibreLogo)

Word processorsText editing, image handling

Migration to free software (LibreOffice)LibreOffice

Simple programming interface for graphic designLibreOffice development

Test bed for graphical features and PyUNOAttract more future developers

Page 64: LibreOffice Berlin 2012 Conference Presentation Template

64LibreOffice Berlin 2012 Conference • LibreLogo – turtle vector graphics for everybody

Plans

Integration with LibreOfficeMore supported native languagesAutomatic translation between the native language programsReference programsKeep it simple (~1 thousand lines in Python)

Page 65: LibreOffice Berlin 2012 Conference Presentation Template

65LibreOffice Berlin 2012 Conference • LibreLogo – turtle vector graphics for everybody

Documentation

Introduction: http://numbertext.org/logo/librelogo_en.pdfCommands: http://numbertext.org/logo/commands_en.txt

Page 66: LibreOffice Berlin 2012 Conference Presentation Template

Thank you for your attention!

Find out more at http://www.numbertext.org/logo