The Full Wiki

More info on Cheloniidae Turtle Graphics

Cheloniidae Turtle Graphics: Wikis

Advertisements

Note: Many of our articles have direct quotes from sources you can cite, within the Wikipedia article! This article doesn't yet, but we're working on it! See more info or our list of citable articles.

Encyclopedia

From Wikipedia, the free encyclopedia

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
Type Educational software
License MIT
Website [1]

Cheloniidae Turtle Graphics is a simple turtle graphics programming library for Java. It is released under the MIT license. Distinguishing characteristics include an extension into three dimensions and the ability to create highly detailed and realistic drawings using colors, solids, antialiased rendering, and incidence angle shading.

Sphere example included with Cheloniidae 2.1

Contents

Architecture

Cheloniidae is broken into two major pieces: The turtle, which executes drawing commands, and the turtle drawing window, which displays the output. Materially, these are analogous to a piece of chalk and a chalkboard, respectively. To create visible output, a turtle drawing window and a turtle must each be created, the turtle must be added to the window (these steps are handled automatically if your class inherits from SingleTurtleScene), and then drawing commands must be issued to the turtle. This code, for example, will produce a square:

 import cheloniidae.*;
 import cheloniidae.frames.*;
 import static cheloniidae.frames.CoreCommands.*;
 public class Square extends SingleTurtleScene {
   public static void main (String[] args) {new Square ();}
   public TurtleCommand commands () {
     return repeat (4, move (100), turn (90));
   }
 }

Internally, a turtle is represented by an object that produces line segments that are rendered by the window. Other types of turtles may also be used, including those which operate in non-Euclidean space; at present, however, no non-Euclidean turtles are included with the standard Cheloniidae distribution.

Multiple turtles can be added as well, allowing for two separate drawings to be produced simultaneously (2.1 code):

Multiple turtle example included with Cheloniidae 2.1
 TurtleDrawingWindow w  = new TurtleDrawingWindow ();
 Turtle t1 = new Turtle ();
 Turtle t2 = new Turtle ();
 w.add (t1);
 w.add (t2);
 w.setVisible (true);
 t2.turn (-45);
 for (int i = 0; i < 4; i++) {
   t1.move (100);
   t1.turn (90);
   t2.move (100);
   t2.turn (90);
 }

Known Bugs

  • If the window is visible and the turtle is still running, closing the window does not terminate the program until the turtle is finished. If the program is being run from the terminal, the user must press Control-C to interrupt execution.

See also

External links

Advertisements

Advertisements






Got something to say? Make a comment.
Your name
Your email address
Message