In this last page, we'll see an example of interactive geometric figure for
xeukleides
. It shows that any triangle inscribed in a semicircle
has a right angle. With such a figure, it'll be possible to move the vertex
corresponding to the right angle on the semicircle by pressing the left or right
arrow keys. First, we define point A, point B and circle C of diameter AB, with
the following commands:
A = point(0, 0) ; B = point(6, 0) C = circle(A, B)
Points A and B are here defined using coordinates. When nothing is specified,
the figure is drawn in a frame such that the lower left point has coordinates
(-2;-2) and the upper right (8;6). After this, we define an interactive variable
t
:
t interactive(60, -2, 0, 180, "A", right)
This means that the initial value of t
is 60, the lower bound 0,
the upper bound 180. In viewing mode, every time the right (left) arrow key will
be pressed, -2 will be added (subtracted) to this variable. Instead of
right
, it is also possible to use keyword up
, in order
to bind the variable to the up and down arrow keys. Last, "A"
indicates which state corresponds to the variable. When viewing mode is started,
the program is in state A. There are 26 available states, from A to Z, hence
one can define 52 interactive variables for the same figure. To switch from a
state to another, one just has to hit the corresponding key. We now define a
point M on circle C with:
M = point(C, t:)
The second parameter is followed by a colon to indicate that it's an angular
parameter. Variable t
corresponds to the argument (in degrees) of
point M in respect of the center of C. Then, we draw the upper half of circle C
and triangle ABM, which has a right angle at vertex M.
color(lightgray) draw(C, 0:, 180:) color(black) draw(A, B, M)
Last, we draw the usual right angle mark:
mark(A, M, B, right)
If you try viewing this figure, you'll see at start something close to this:
It is possible to capture the actual value of variable t
by
pressing the F1
key. In this case, the initial value of
t
in the source code is replaced by the actual value and the
program switches to editing mode. All source codes written for
xeukleides
can be used with eukleides
(the interactive
variables are simply set to their initial values).
Go to: | Tutorial index | Previous page | Concept index | Command index |