Interactive JessieScript: Difference between revisions
From JSXGraph Wiki
A WASSERMANN (talk | contribs) No edit summary  | 
				A WASSERMANN (talk | contribs) No edit summary  | 
				||
| Line 5: | Line 5: | ||
function construct() {  | function construct() {  | ||
     var t = document.getElementById('input').value;  |      var t = document.getElementById('input').value;  | ||
    board.suspendUpdate();  | |||
     construction.push(board.construct(t));  |      construction.push(board.construct(t));  | ||
    board.unsuspendUpdate();  | |||
}  | }  | ||
function clearAll() {  | function clearAll() {  | ||
     JXG.JSXGraph.freeBoard(board);  |      JXG.JSXGraph.freeBoard(board);  | ||
     board = JXG.JSXGraph.initBoard('  |      board = JXG.JSXGraph.initBoard('box', {boundingbox:[-5,8,8,-5], axis:true});  | ||
}  | }  | ||
| Line 60: | Line 62: | ||
function construct() {  | function construct() {  | ||
     var t = document.getElementById('input').value;  |      var t = document.getElementById('input').value;  | ||
    board.suspendUpdate();  | |||
     construction.push(board.construct(t));  |      construction.push(board.construct(t));  | ||
    board.unsuspendUpdate();  | |||
}  | }  | ||
</source>  | </source>  | ||
Revision as of 18:58, 23 March 2010
Possible elements:
| Construction | Description | 
|---|---|
| A(1,1) | Point with name 'A' at position (1,1) | 
| ZY(0.5|1) | Point with name 'ZY' at position (0.5,1) | 
| ]AB[ | straight line through points A and B | 
| [AB[ | ray through points A and B, stopping at A | 
| ]AB] | ray through points A and B, stopping at B | 
| [AB] | segment through points A and B | 
| g=[AB] | segment through 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 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 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;
    board.suspendUpdate();
    construction.push(board.construct(t));
    board.unsuspendUpdate();
}