Kig (software)
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. Import and exportKig can import files made by DrGeo and Cabri Geometry as well as its own file format, which is XML-encoded. Kig can export figures in LaTeX format and as SVG (vector graphics) files. ObjectsKig can handle any classical object of the dynamic geometry, but also:
Scripting languageInside the figureAnother object is available inside Kig, it is a Python language script. It can accept Kig objects as variables, and always return one object. For example, if there is already a numeric object inside the figure, for example 3, the following Python object can yield its square (9): def square(arg1):
return DoubleObject(arg1.value() ** 2)
The variables are always called If no one wants to implement the square of a complex number (represented by a point in the Argand diagram), the object which has to be selected at the creation of the script must necessarily be a point, and the script is def csquare(arg1):
x = arg1.coordinate().x
y = arg1.coordinate().y
z = x * x - y * y
y = 2 * x * y
x = z
return Point(Coordinate(x, y))
The abscissa of the point representing the square of the complex number is as can be seen by expanding , But a Python object inside a figure can only create one object and for more complex figures one has to build the figure with a script: Figure created by a scriptKig comes up with a little program (written in Python) called
For example, here is how a Sierpinski triangle can be made (as an IFS) with from random import *
kigdocument.hideobjects()
A = Point(0, 2)
A.show()
B = Point(-2, -1)
B.show()
C = Point(2, -1)
C.show()
M = Point(.1, .1)
for i in range(1, 1000):
d = randrange(3)
if d == 0:
s = Segment(A, M)
M = s.midpoint()
if d == 1:
s = Segment(B, M)
M = s.midpoint()
if d == 2:
s = Segment(C, M)
M = s.midpoint()
M.show()
External links
|