Turtle graphics
Encyclopedia
Turtle graphics is a term in computer graphics
Computer graphics
Computer graphics are graphics created using computers and, more generally, the representation and manipulation of image data by a computer with help from specialized software and hardware....

 for a method of programming vector graphics
Vector graphics
Vector graphics is the use of geometrical primitives such as points, lines, curves, and shapes or polygon, which are all based on mathematical expressions, to represent images in computer graphics...

 using a relative cursor
Cursor (computers)
In computing, a cursor is an indicator used to show the position on a computer monitor or other display device that will respond to input from a text input or pointing device. The flashing text cursor may be referred to as a caret in some cases...

 (the "turtle
Turtle
Turtles are reptiles of the order Testudines , characterised by a special bony or cartilaginous shell developed from their ribs that acts as a shield...

") upon a Cartesian plane
Cartesian coordinate system
A Cartesian coordinate system specifies each point uniquely in a plane by a pair of numerical coordinates, which are the signed distances from the point to two fixed perpendicular directed lines, measured in the same unit of length...

. Turtle graphics is a key feature of the Logo programming language
Logo (programming language)
Logo is a multi-paradigm computer programming language used in education. It is an adaptation and dialect of the Lisp language; some have called it Lisp without the parentheses. It was originally conceived and written as functional programming language, and drove a mechanical turtle as an output...

.

Overview

The turtle has three attributes:
  1. a position
  2. an orientation
  3. a pen, itself having attributes such as color, width, and up versus down.

The turtle moves with commands that are relative to its own position, such as "move forward 10 spaces" and "turn left 90 degrees". The pen carried by the turtle can also be controlled, by enabling it, setting its color, or setting its width. A student could understand (and predict and reason about) the turtle's motion by imagining what they would do if they were the turtle. Seymour Papert
Seymour Papert
Seymour Papert is an MIT mathematician, computer scientist, and educator. He is one of the pioneers of artificial intelligence, as well as an inventor of the Logo programming language....

 called this "body syntonic" reasoning.

From these building blocks one can build more complex shapes like squares, triangles, circles and other composite figures. Combined with control flow, procedures, and recursion, the idea of turtle graphics is also useful in a Lindenmayer system for generating fractal
Fractal
A fractal has been defined as "a rough or fragmented geometric shape that can be split into parts, each of which is a reduced-size copy of the whole," a property called self-similarity...

s.

Turtle geometry
Turtle Geometry
Turtle Geometry is a college level math text written by Hal Abelson and Andrea diSessa which aims to engage students in exploring mathematical properties visually via a simple programming language to maneuver the icon of a turtle trailing lines across a personal computer display.-See also:*Turtle...

 is also sometimes used in graphics environments as an alternative to a strictly coordinate-addressed graphics system.

History

Turtle graphics were added to the Logo programming language by Seymour Papert
Seymour Papert
Seymour Papert is an MIT mathematician, computer scientist, and educator. He is one of the pioneers of artificial intelligence, as well as an inventor of the Logo programming language....

 in the late 60s to support Papert's version of the turtle robot
Turtle (robot)
Turtles are a class of educational robots designed originally in the late 1940s and used in computer science and mechanical engineering training. These devices are traditionally built low to the ground with a roughly hemispheric shell and a power train capable of a very small turning radius...

, a simple robot controlled from the user's workstation that is designed to carry out the drawing functions assigned to it using a small retractable pen set into or attached to the robot's body. Turtle geometry works somewhat differently from (x,y) addressed Cartesian geometry, being primarily vector-based (i.e. relative direction and distance from a starting point) in comparison to coordinate-addressed systems such as PostScript
PostScript
PostScript is a dynamically typed concatenative programming language created by John Warnock and Charles Geschke in 1982. It is best known for its use as a page description language in the electronic and desktop publishing areas. Adobe PostScript 3 is also the worldwide printing and imaging...

. As a practical matter, the use of turtle geometry instead of a more traditional model mimics the actual movement logic of the turtle robot. The turtle is traditionally and most often represented pictorially either as a triangle or a turtle icon (though it can be represented by any icon).

Papert's daughter, Artemis, has been using turtle graphics to explore the relationship between art and algorithm.

Today, Turtle graphics implementations are available for all major desktop and mobile platforms.

Extension to three dimensions

The ideas behind turtle graphics can be extended to include three-dimensional space. This is achieved by using one of several different coordinate models. If the turtle operates in cylindrical coordinates, then it has a location and a heading within its plane, and its plane may be rotated around the vertical axis. This often manifests itself as the turtle having two different heading angles, one within the plane and the other determining the plane's angle. Usually changing the plane's angle does not move the turtle.

Other coordinate models may also be used. For a more complete discussion of three-dimensional turtle coordinate systems and some examples of each, see Cheloniidae Turtle Graphics
Cheloniidae Turtle Graphics
Cheloniidae Turtle Graphics is a simple turtle graphicsprogramming library for Java. It is released under the MIT license. Distinguishing characteristics include an extension intothree dimensions and the ability to create highly detailed and realistic...

.

See also

  • Turtle (robot)
    Turtle (robot)
    Turtles are a class of educational robots designed originally in the late 1940s and used in computer science and mechanical engineering training. These devices are traditionally built low to the ground with a roughly hemispheric shell and a power train capable of a very small turning radius...

  • Logo (programming language)
    Logo (programming language)
    Logo is a multi-paradigm computer programming language used in education. It is an adaptation and dialect of the Lisp language; some have called it Lisp without the parentheses. It was originally conceived and written as functional programming language, and drove a mechanical turtle as an output...

  • Python
    Python (programming language)
    Python is a general-purpose, high-level programming language whose design philosophy emphasizes code readability. Python claims to "[combine] remarkable power with very clear syntax", and its standard library is large and comprehensive...

     turtle module
  • PythonTurtle
    PythonTurtle
    PythonTurtle is an educational environment for learning the programming language Python. It is modeled after a similar application for learning the didactic Logo programming language that was popular as an educational tool in the 1990s, with the difference being that PythonTurtle teaches Python,...

     - Standalone application
  • KTurtle
    KTurtle
    KTurtle is an educational programming environment for turtle graphics. It is released under the open source GNU General Public License and is part of the KDE SC 4. KTurtle has a built-in programming language that is loosely based on the Logo programming language...

  • Cheloniidae Turtle Graphics
    Cheloniidae Turtle Graphics
    Cheloniidae Turtle Graphics is a simple turtle graphicsprogramming library for Java. It is released under the MIT license. Distinguishing characteristics include an extension intothree dimensions and the ability to create highly detailed and realistic...

  • StarLogo
    StarLogo
    StarLogo is an agent-based simulation language developed by Mitchel Resnick, Eric Klopfer, and others at MIT Media Lab and MIT Teacher Education Program in Massachusetts. It is an extension of the Logo programming language, a dialect of Lisp...

  • One Laptop per Child's XO-1
    OLPC XO-1
    The XO-1, previously known as the $100 Laptop, Children's Machine, and 2B1, is an inexpensive subnotebook computer intended to be distributed to children in developing countries around the world, to provide them with access to knowledge, and opportunities to "explore, experiment and express...

     contains a Turtle Art activity for playing with turtle graphics
  • L-system
    L-system
    An L-system or Lindenmayer system is a parallel rewriting system, namely a variant of a formal grammar, most famously used to model the growth processes of plant development, but also able to model the morphology of a variety of organisms...



External links

  • "Web Turtle", turtle graphics in a web page, by Bill Kendrick
    Bill Kendrick
    Bill Kendrick is an American software engineer best known for creating and maintaining Tux Paint, an open source bitmap graphics editor for children. He is also co-founder of the Linux Users' Group of Davis in Davis, California...

    , author of Tux Paint
    Tux Paint
    Tux Paint is a free and open source bitmap graphics editor geared towards young children. The project was started in 2002 by Bill Kendrick who continues to maintain and improve it, with help from numerous volunteers...

  • Art created with turtle graphics by Artemis Papert
  • "3D Flying Pipe-laying Turtle" by Tom Verhoeff from The Wolfram Demonstrations Project (retrieved on 2009-01-31)
  • "Turtle Graphics", Turtle Graphics written in MGrammar, by Jason Hogg
  • Turtle Art website maintained by Brian Silverman and Artemis Papert
  • Turtle Art activity included in the Sugar
    Sugar (GUI)
    Sugar is an open source desktop environment designed with the goal of being used by children for learning.Developed as part of the One Laptop per Child project, it is the default interface on OLPC XO-1 family of laptop computers....

    learning platform
  • JS Turtle Graphics a simple Javascript implementation of turtle graphics, by John Villar
  • JSTurtlegraphics V0.2 a simple browser-based implementation aimed at children (using the more common command names)
  • TurtleWax turtle graphics in JavaScript, by Dave Balmer
The source of this article is wikipedia, the free encyclopedia.  The text of this article is licensed under the GFDL.
 
x
OK