Turtle graphics

Turtle graphics

Turtle graphics is a term in computer graphics for a method of programming vector graphics using a relative cursor (the "turtle") upon a Cartesian plane. Turtle graphics is a key feature of the Logo programming language.

Overview

The turtle has three attributes:
# a position
# an orientation
# 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 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 fractals.

Turtle geometry 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 in the late 60s to support Papert's version of the turtle robot, 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. 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.

Example

The following actions generate the figure to the right, assuming a turtle initially pointed towards the top of the page and the pen is down.
* repeat four times:
** turn right 90 degrees
** move forward 100 steps
* then move forward 100 steps again

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 [http://xenon.truman.edu/~sjt309/ Terrapin turtle graphics] .

ee also

* Turtle (robot)
* Logo (programming language)
* Python [http://python.org/doc/current/lib/module-turtle.html turtle] module
* KTurtle
* Terrapin Turtle Graphics
* One Laptop per Child's XO-1 contains a "Turtle Art" activity for playing with turtle graphics

External links

* [http://www.sonic.net/~nbs/webturtle/ "Web Turtle", turtle graphics in a web page] , by Bill Kendrick, author of Tux Paint
* [http://www.artami.co.uk/digitalart.htm Art created with turtle graphics] by Artemis Papert
* [http://xenon.truman.edu/~sjt309/ Three-dimensional turtle graphics] by Spencer Tipping


Wikimedia Foundation. 2010.

Игры ⚽ Поможем сделать НИР

Look at other dictionaries:

  • turtle graphics — plural noun (computing) Drawing by means of a screen turtle • • • Main Entry: ↑turtle …   Useful english dictionary

  • turtle graphics — noun Vector graphics generated by a turtle that moves according to relative coordinates on a Cartesian plane, as in the Logo programming language …   Wiktionary

  • Cheloniidae Turtle Graphics — Developer(s) Spencer Tipping Stable release 3.1 / December 1, 2009 Operating system Linux, Unix, Microsoft Windows, Mac OS, other operating systems with JRE implementations …   Wikipedia

  • Terrapin Turtle Graphics — Infobox Software name = Terrapin Turtle Graphics developer = Spencer Tipping latest release version = 2.1 latest release date = May 17, 2008 operating system = Linux, Unix, Microsoft Windows, Mac OS, other operating systems with JRE… …   Wikipedia

  • Turtle Geometry — is a book written by Hal Abelson and Andrea diSessa (MIT Press). ee also*Turtle graphics …   Wikipedia

  • Turtle-Grafik —   [engl. turtle graphics, dt. »Schildkrötengrafik«], eine Element der Programmiersprache Logo …   Universal-Lexikon

  • Turtle (disambiguation) — A turtle is a reptile, most of whose body is shielded by a special bony or cartilaginous shell.Turtle(s) may also refer to:Entertainment* Turtle (comics), either of two supervillains who were primarily enemies of Flash * Turtle ( Dragon Ball ), a …   Wikipedia

  • Turtle (robot) — Turtles are a class of educational robots designed originally in the late 1940s (largely under the auspices of researcher William Grey Walter) and used in computer science and mechanical engineering training. These devices are traditionally built …   Wikipedia

  • Turtle Beach Systems — is a sound card and headphone manufacturer and direct competitor with Creative Labs branded Sound Blaster. In 1995, the company merged with Voyetra, a company that made custom software for sound cards, to form Voyetra Turtle Beach Inc which is… …   Wikipedia

  • turtle — ► NOUN 1) a marine or freshwater reptile with a bony or leathery shell and flippers or webbed toes. 2) Computing a directional cursor in a computer graphics system which can be instructed to move around a screen. ● turn turtle Cf. ↑turn turtle… …   English terms dictionary

Share the article and excerpts

Direct link
Do a right-click on the link above
and select “Copy Link”