Cheloniidae Turtle Graphics
Encyclopedia
Cheloniidae Turtle Graphics is a simple turtle graphics
Turtle graphics
Turtle graphics is a term in computer graphics for a method of programming vector graphics using a relative cursor upon a Cartesian plane...


programming library for Java
Java (programming language)
Java is a programming language originally developed by James Gosling at Sun Microsystems and released in 1995 as a core component of Sun Microsystems' Java platform. The language derives much of its syntax from C and C++ but has a simpler object model and fewer low-level facilities...

. 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.

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):
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

  • Polar coordinate system
    Polar coordinate system
    In mathematics, the polar coordinate system is a two-dimensional coordinate system in which each point on a plane is determined by a distance from a fixed point and an angle from a fixed direction....

  • Cylindrical coordinate system
    Cylindrical coordinate system
    A cylindrical coordinate system is a three-dimensional coordinate systemthat specifies point positions by the distance from a chosen reference axis, the direction from the axis relative to a chosen reference direction, and the distance from a chosen reference plane perpendicular to the axis...

  • Spherical coordinate system
    Spherical coordinate system
    In mathematics, a spherical coordinate system is a coordinate system for three-dimensional space where the position of a point is specified by three numbers: the radial distance of that point from a fixed origin, its inclination angle measured from a fixed zenith direction, and the azimuth angle of...

  • 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...

  • Turtle Graphics
    Turtle graphics
    Turtle graphics is a term in computer graphics for a method of programming vector graphics using a relative cursor upon a Cartesian plane...


External links

The source of this article is wikipedia, the free encyclopedia.  The text of this article is licensed under the GFDL.
 
x
OK