DrGeo

Dr. Geo
Original author(s) Hilaire Fernandes
Initial release December 31, 1996 (1996-12-31)
Stable release
16.10 / September 10, 2016 (2016-09-10)
Repository code.launchpad.net/drgeo
Development status Active
Written in Pharo, Smalltalk
Operating system Linux, Mac OS X, Windows, Android, Sugar
Type Interactive geometry software
License GPL
Website drgeo.eu

GNU Dr. Geo is interactive geometry software that allows its users to design & manipulate interactive geometric sketches. It is free software (source code, translations, icons and installer are released under GNU GPL license), created by Hilaire Fernandes. It runs over a Morphic graphic system (which means that it runs on Linux, Mac OS, Windows, Android). Current version of Dr. Geo is also called Dr. Geo II. Historically Dr. Geo was developed in C++ and Dr. Geo II is a complete rewrite using Pharo that happened in 2005. This article refers to the most recent version.

Objects

Dr. Geo manipulates different kinds of objects such as points, lines, circles, block of code.

Points

Dr. Geo has several kinds of points: a free point, which can be moved with the mouse (but may be attached to a curve) and a point given by its coordinates.

Points can also be created as the intersection of 2 curves or as the midpoint of a segment.

Lines

Dr. Geo is equipped with the classic line, ray, segment and vector.

Other curvilinear objects include circles (defined by 2 points, a center and segment or a radius), arcs (defined by three points or center and angle), polygons (regular or not, defined by end points), and loci.

Transformations

Besides the parallel and perpendicular line through a point, Dr. Geo can apply to a point or a line one of these transformations:

  1. reflexion
  2. symmetry
  3. translation
  4. rotation
  5. homothety

Macro-construction

Dr. Geo comes with macro-construction: a way to teach Dr. Geo new constructions. It allows to add new objects to Dr. Geo: new transformations like circle inversion, tedious constructions involving a lot of intermediate objects or constructions involving script (also named macro-script).

When some objects, called final depend on other objects, called initial, it is possible to create a complex construction deducing the final objects from the user-given initial objects. This is a macro-construction, a graph of interdependent objects.

Programming

Access to user programming is at the essence of Dr. Geo: from the software, the user can directly read, study, modify and redistribute modified version of Dr. Geo. Additionally, scripting embedded in sketch is proposed.

Dr. Geo source code is Smalltalk. It is also the language used for user programming: to extend Dr. Geo with arbitrary computing operations (Smalltalk script) and to define a geometric sketch entirely with programming instructions (Smalltalk sketch).

Dr. Geo is shipped with its source code and the developer tools. Therefore its code can be edited and recompiled from Dr. Geo while it is functioning. This design, inherited from Pharo Smalltalk, makes easy to test new ideas and new designs.

Smalltalk script

Live script editing

A script is a first class object defined along Dr. Geo code. It comes with zero, one or several arguments, from types selected when defining the script. When an instance of a script is plugged in a canvas, the user first selects its arguments in the canvas with mouse clicks, then the position in the canvas of the script output. The script is updated at each canvas computation. Scripts can be used in cascade, with one as the argument of another one.[1]

Curve and tangent
Curve and its tangent computed with Smalltalk script

Script are designed to be used in two different ways:

  1. To output an object (i.e. a numeric value) and to show its result in the canvas. This result can be used when building subsequent objects (geometric or script).
  2. To access objects in the canvas: model (MathItem) or view (Costume) for arbitrary uses and modifications. For example to modify the colour of an object given the result to a computation.

From the script, the arguments model are reached with the methods #arg1, #arg2, etc. The arguments view are reached with the methods #costume1, #costume2, etc.

The computation of the script is done in its #compute method. For example, to calculate the square of a number, the script

compute
"returns the square of a number"
^ self arg1 valueItem squared

creates a numeric object, whose value is the square of the argument number object. Whenever the first number is changed, the script returned value changes too.

Smalltalk sketch

Dr. Geo Smalltalk sketches – (DSS) – are sketches entirely defined in the Smalltalk language. This is not about constructing a sketch with the Dr. Geo graphical interface, but about describing a sketch with the Smalltalk language. A programming interface with an easy and light syntax is provided.[2]

Here is how Dr. Geo can create a Sierpinski triangle recursively:

| triangle c |
triangle := [].
c := DrGeoCanvas new.
triangle := [:s1 :s2 :s3 :n |
    c segment: s1 to: s2;
        segment: s2 to: s3;
        segment: s3 to: s1.
    n > 0 ifTrue:
        [triangle
            value: s1
            value: (c middleOf: s1 and: s2) hide
            value: (c middleOf: s1 and: s3) hide
            value: n - 1.
        triangle
            value: (c middleOf: s1 and: s2) hide
            value: s2
            value: (c middleOf: s2 and: s3) hide
            value: n - 1.
        triangle
            value: (c middleOf: s1 and: s3) hide
            value: (c middleOf: s2 and: s3) hide
            value: s3
            value: n - 1]].

triangle
    value: (c point: 0 @ 3)
    value: (c point: 4 @ -3)
    value: (c point: -4 @ -3)
    value: 3.

Awards

See also

References

External links

This article is issued from Wikipedia - version of the 9/10/2016. The text is available under the Creative Commons Attribution/Share Alike but additional terms may apply for the media files.