DrGeo

Last updated
GNU Dr. Geo
Original author(s) Hilaire Fernandes
Initial releaseDecember 31, 1996;27 years ago (1996-12-31)
Stable release
24.06 / June 11, 2024;1 day ago (2024-06-11)
Repository
Written in Cuis_Smalltalk, Smalltalk
Operating system Linux, Mac OS X, Windows, Sugar
Type Interactive geometry software
License GPL
Website www.gnu.org/s/dr-geo

GNU Dr. Geo is an interactive geometry software that allows its users to design & manipulate interactive geometric sketches, including dynamic models of Physics. [1] It is free software (source code, translations, icons and installer are released under GNU GPL license), created by Hilaire Fernandes, it is part of the GNU project. It runs over a Morphic graphic system (which means that it runs on Linux, Mac OS, Windows, Android). Dr. Geo was initially developed in C++ with Scheme scripting, [2] [3] then in various versions of Smalltalk with Squeak, Etoys_(programming_language) [4] for One Laptop per Child [5] Pharo then Cuis-Smalltalk.

Contents

Objects

Dr. Geo manipulates different kinds of objects such as points, lines, circles, vector, values, geometric transformations, scripts. [6]

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. [7] 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. [8] This design, inherited from Smalltalk, makes easy to test new ideas and new designs.

Smalltalk script

Curve and its tangent computed with Smalltalk scripts Dynamic Curve and tangent .png
Curve and its tangent computed with Smalltalk scripts

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. [9] 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 their view (Costume) for arbitrary uses and modifications. For example to modify the color of an object given the result to a computation.
Live script editing ScriptEditor.png
Live script editing

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

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

compute"returns the square of a number"^selfarg1valueItemsquared

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

Smalltalk sketch

Smalltalk sketch editor SmalltalkSketchEditor.png
Smalltalk sketch editor

Dr. Geo Smalltalk sketches 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. [10]

Smalltalk itself is a high level language, carefully crafted iteratively for about 10 years at Palo Alto Research Center. When a sketch is described with Smalltalk code, all the features of the language are used: object oriented programming, variable, collection, iterator, randomness to get a slightly different sketch at each execution.

A Smalltalk sketch is edited and tested with the Smalltalk sketch editor. Such sketch can be debugged and executed step-by-step. Its code is saved, as any source code, to an external text file encoded with UTF-8, to support native language.


Sierpinski triangle

Here is how to program a Sierpinski triangle recursively. Its red external summit is mobile.

Computed interactive Sierpinski triangle DrGeo-Sierpinski.png
Computed interactive Sierpinski triangle
| triangle c |c:=DrGeoSketchnew.triangle:= [:s1:s2:s3:n|csegment:s1to:s2;segment:s2to:s3;segment:s3to:s1.n>0ifTrue: [         trianglevalue:s1value: (cmiddleOf:s1and:s2) hidevalue: (cmiddleOf:s1and:s3) hidevalue:n-1.trianglevalue: (cmiddleOf:s1and:s2) hidevalue:s2value: (cmiddleOf:s2and:s3) hidevalue:n-1.trianglevalue: (cmiddleOf:s1and:s3) hidevalue: (cmiddleOf:s2and:s3) hidevalue:s3value:n-1]].trianglevalue:0@3value:4@-3value:-4@-3value:3. (cpoint:0@3) show

Fibonacci spiral

A Fibonacci spiral programmed [11] with geometric transformations (rotation, translation and homothety). The points a and b of the resulting interactive sketch are mobile.

Computed interactive Fibonacci spiral DrGeo-Fibonacci.png
Computed interactive Fibonacci spiral
|canvas shape alfa fibo a b m s|canvas:=DrGeoSketchnew.alfa:= (canvasfreeValue:-90degreesToRadians) hide.shape:= [:c:o:f|| e p |e:= (canvasrotate:ocenter:cangle:alfa) hide.  (canvasarcCenter:cfrom:oto:e) large.p:=canvastranslate:evector: (canvasvector:cto:o) hide.  (canvaspolygon: { c.o.phide.e }) name:f.e].fibo:= [ ].fibo:= [ :f:o:c:k|| e f1 f2 f3 c2|"f1: term Fn-1, f2: term Fn, o & c: origin and center of spiral arme: extremity of the spiral arm"f1:=ffirst.f2:=fsecond.f3:=f1+f2.e:=shapevalue:cvalue:ovalue:f3.c2:= (canvasscale:ccenter:efactor:f3/f2) hide.k>0ifTrue: [ fibovalue: {f2.f3} value:evalue:c2value:k-1 ]].a:=canvaspoint:1@0.b:=canvaspoint:-1@0.m:= (canvasmiddleOf:aand:b) hide.s:=shapevalue:mvalue:avalue:1.shapevalue:mvalue:svalue:1.fibovalue: {1.2} value:bvalue:avalue:10

Newton-Raphson algorithm

Smalltalk sktech can be used to design interactive sketch illustrating a numerical analysis method. Here the Newton-Raphson algorithm in a 5 steps iteration.

Computed interactive Newton-Raphson algorithm DrGeo-Newton.png
Computed interactive Newton-Raphson algorithm
| sketch f df xn ptA ptB|sketch:=DrGeoSketchnewaxesOn.xn:=2.f:= [ :x|xcos+x ]."Derivate number"df:= [ :x| (fvalue:x+1e-8) - (fvalue:x) *1e8].sketchplot:ffrom:-20to:20.ptA:= (sketchpoint:xn@0) large;name:'Drag me'.5timesRepeat: [   ptB:=sketchpoint: [ :pt|ptpointx@ (fvalue:ptpointx)]    parent:ptA.ptBhide.  (sketchsegment:ptAto:ptB) dottedforwardArrow.ptA:=sketchpoint: [:pt|| x |x:=ptpointx.x- ( (fvalue:x) / (dfvalue:x) )  @0 ] parent:ptB.ptAhide.  (sketchsegment:ptBto:ptA) dottedforwardArrow].

Locale languages

Smalltalk sketch can be coded in native languages, currently in French and Spanish. More native languages can be added.

Awards

See also

Related Research Articles

<span class="mw-page-title-main">Smalltalk</span> Object-oriented programming language released first in 1972

Smalltalk is a purely object oriented programming language (OOP) that was originally created in the 1970s for educational use, specifically for constructionist learning, but later found use in business. It was created at Xerox PARC by Learning Research Group (LRG) scientists, including Alan Kay, Dan Ingalls, Adele Goldberg, Ted Kaehler, Diana Merry, and Scott Wallace.

In programming languages, a closure, also lexical closure or function closure, is a technique for implementing lexically scoped name binding in a language with first-class functions. Operationally, a closure is a record storing a function together with an environment. The environment is a mapping associating each free variable of the function with the value or reference to which the name was bound when the closure was created. Unlike a plain function, a closure allows the function to access those captured variables through the closure's copies of their values or references, even when the function is invoked outside their scope.

Bytecode is a form of instruction set designed for efficient execution by a software interpreter. Unlike human-readable source code, bytecodes are compact numeric codes, constants, and references that encode the result of compiler parsing and performing semantic analysis of things like type, scope, and nesting depths of program objects.

<span class="mw-page-title-main">Ellipsoid</span> Quadric surface that looks like a deformed sphere

An ellipsoid is a surface that can be obtained from a sphere by deforming it by means of directional scalings, or more generally, of an affine transformation.

In the fields of databases and transaction processing, a schedule of a system is an abstract model to describe the order of executions in a set of transactions running in the system. Often it is a list of operations (actions) ordered by time, performed by a set of transactions that are executed together in the system. If the order in time between certain operations is not determined by the system, then a partial order is used. Examples of such operations are requesting a read operation, reading, writing, aborting, committing, requesting a lock, locking, etc. Often, only a subset of the transaction operation types are included in a schedule.

<span class="mw-page-title-main">Conditional (computer programming)</span> Control flow statement that executes code according to some condition(s)

In computer science, conditionals are programming language commands for handling decisions. Specifically, conditionals perform different computations or actions depending on whether a programmer-defined Boolean condition evaluates to true or false. In terms of control flow, the decision is always achieved by selectively altering the control flow based on some condition . Although dynamic dispatch is not usually classified as a conditional construct, it is another way to select between alternatives at runtime. Conditional statements are the checkpoints in the programme that determines behaviour according to situation.

In object-oriented programming, a metaclass is a class whose instances are classes themselves. Unlike ordinary classes, which define the behaviors of objects, metaclasses specify the behaviors of classes and their instances. Not all object-oriented programming languages support the concept of metaclasses. For those that do, the extent of control metaclasses have over class behaviors varies. Metaclasses are often implemented by treating classes as first-class citizens, making a metaclass an object that creates and manages these classes. Each programming language adheres to its own metaobject protocol, which are the rules that determine interactions among objects, classes, and metaclasses. Metaclasses are utilized to automate code generation and to enhance framework development.

In computer science, dynamic dispatch is the process of selecting which implementation of a polymorphic operation to call at run time. It is commonly employed in, and considered a prime characteristic of, object-oriented programming (OOP) languages and systems.

In compiler theory, dependence analysis produces execution-order constraints between statements/instructions. Broadly speaking, a statement S2 depends on S1 if S1 must be executed before S2. Broadly, there are two classes of dependencies--control dependencies and data dependencies.

In cryptography, a message authentication code based on universal hashing, or UMAC, is a type of message authentication code (MAC) calculated choosing a hash function from a class of hash functions according to some secret (random) process and applying it to the message. The resulting digest or fingerprint is then encrypted to hide the identity of the hash function used. As with any MAC, it may be used to simultaneously verify both the data integrity and the authenticity of a message. In contrast to traditional MACs, which are serializable, UMAC can be executed in parallel. Thus as machines continue to offer more parallel processing capabilities, the speed of implementing UMAC will increase.

Haxe is a high-level cross-platform programming language and compiler that can produce applications and source code for many different computing platforms from one code-base. It is free and open-source software, released under an MIT License. The compiler, written in OCaml, is released under the GNU General Public License (GPL) version 2.

This is an overview of Fortran 95 language features. Included are the additional features of TR-15581:Enhanced Data Type Facilities, which have been universally implemented. Old features that have been superseded by new ones are not described – few of those historic features are used in modern programs although most have been retained in the language to maintain backward compatibility. The current standard is Fortran 2023; many of its new features are still being implemented in compilers.

In computer programming, an anonymous function is a function definition that is not bound to an identifier. Anonymous functions are often arguments being passed to higher-order functions or used for constructing the result of a higher-order function that needs to return a function. If the function is only used once, or a limited number of times, an anonymous function may be syntactically lighter than using a named function. Anonymous functions are ubiquitous in functional programming languages and other languages with first-class functions, where they fulfil the same role for the function type as literals do for other data types.

Loop-level parallelism is a form of parallelism in software programming that is concerned with extracting parallel tasks from loops. The opportunity for loop-level parallelism often arises in computing programs where data is stored in random access data structures. Where a sequential program will iterate over the data structure and operate on indices one at a time, a program exploiting loop-level parallelism will use multiple threads or processes which operate on some or all of the indices at the same time. Such parallelism provides a speedup to overall execution time of the program, typically in line with Amdahl's law.

<span class="mw-page-title-main">CaRMetal</span> Interactive geometry program

CaRMetal is an interactive geometry program which inherited the C.a.R. engine. The software has been created by Eric Hakenholz, in Java. CaRMetal is free, under GNU GPL license. It keeps an amount of functionality of C.a.R. but uses a different graphical interface which purportedly eliminates some intermediate dialogs and provides direct access to numerous effects. Constructions are done using a main palette, which contains some useful construction shortcuts in addition to the standard compass and ruler tools. These include perpendicular bisector, circle through three points, circumcircular arc through three points, and conic section through five points. Also interesting are the loci, functions, parametric curves, and implicit plots. Element thickness, color, label, and other attributes can be set using a separate panel.

The Banach–Tarski paradox is a theorem in set-theoretic geometry, which states the following: Given a solid ball in three-dimensional space, there exists a decomposition of the ball into a finite number of disjoint subsets, which can then be put back together in a different way to yield two identical copies of the original ball. Indeed, the reassembly process involves only moving the pieces around and rotating them without changing their shape. However, the pieces themselves are not "solids" in the usual sense, but infinite scatterings of points. The reconstruction can work with as few as five pieces.

<span class="mw-page-title-main">Kig (software)</span>

KIG is free and open-source interactive geometry software, which is part of the KDE Education Project. It has some facilities for scripting in Python, as well as the creating macros from existing constructions.

Wichmann–Hill is a pseudorandom number generator proposed in 1982 by Brian Wichmann and David Hill. It consists of three linear congruential generators with different prime moduli, each of which is used to produce a uniformly distributed number between 0 and 1. These are summed, modulo 1, to produce the result.

References

  1. C.K. Hung (2016). "Drawing the Parabolic Trajectory of an Object under Gravity" (PDF). Retrieved 14 January 2024.
  2. A. Centomo (2003). "Dr. Geo e la Geometria Tolemaica" (in Italian). Retrieved 13 January 2024.
  3. A. Centomo, F. Campora (2002). "Geometria e programmazione con Dr. Geo" (in Italian). Retrieved 14 January 2024.
  4. V. Freudenberg, Y. Ohshima, S. Wallace (2009). Etoys for One Laptop Per Child. C5.2009. pp. 57–67.{{cite conference}}: CS1 maint: multiple names: authors list (link)
  5. G. Melo, A. Machado, A. Miranda (2014). "The Impact of a One Laptop per Child Program on Learning: Evidence from Uruguay" (PDF). Retrieved 14 January 2024.{{cite web}}: CS1 maint: multiple names: authors list (link)
  6. C. Whittum (2016). "Get started with Dr. Geo for geometry". opensource.com. Retrieved 14 January 2024.
  7. J.R. Fernández García; C. Schnober (June 2006). "Interactive geometry with Dr. Geo MATH HELPER" (PDF). Linux Magazine. Retrieved 14 January 2024..
  8. A. Busser (2011). "Dr. Geo, un docteur qui peut s'opérer tout seul" [Dr. Geo, a doctor that can make a surgery by himself] (in French). revue.sesamath.net. Retrieved 13 January 2024.
  9. Video tutorial on Smalltalk script
  10. Video demonstration on programmed sketch
  11. H. Fernandes (March 2016). "Fibonacci spiral" . Retrieved 6 January 2024.