Interactive JessieScript

From JSXGraph Wiki
Revision as of 13:37, 22 March 2010 by A WASSERMANN (talk | contribs)



Possible elements:

Construction Description
A(1,1) Point with name 'A' at the position (1,1)
ZY(0.5|1) Point with name 'ZY' at the position (0.5,1)
]AB[ straight line through the points A and B
[AB[ ray through the points A and B, stopping at A
]AB] ray through the points A and B, stopping at B
[AB] segment through the points A and B
g=[AB] segment through the points A and B, named by 'g'
k(A,1) circle with midpoint A and radius 1
k(A,B) circle with midpoint A through the point B on the circle line
k(A,[BC]) circle with midpoint A and radius defined by the length of the (not necessarily existing) segement [BC]
k_1=k(A,1) circle with midpoint A and radius 1, named by 'k_1'

The different elements have to be separated by semicolon.

The function returns an object with all the created elements so that afterwards properties can be set. The access works by

Element Description
constr.points[i] take the i-th point of the construction 'constr'
constr.lines[i] take the i-th line (or rays or segement) of the construction 'constr'
constr.circles[i] take the i-th circle of the construction 'constr'
constr.A take the element with name 'A' of the construction 'constr'

The JavaScript code

var board, construction = [];
board = JXG.JSXGraph.initBoard('box', {grid:true, boundingbox:[-1,6,11,-3], keepaspectratio:true, axis:true});

function construct() {
    var t = document.getElementById('input').value;
    construction.push(board.construct(t));
}