Interactive JessieScript: Difference between revisions

From JSXGraph Wiki
No edit summary
No edit summary
(8 intermediate revisions by 3 users not shown)
Line 1: Line 1:
<jsxgraph width="600" height="450" box="box">
<jsxgraph width="600" height="450" box="box">
var board, construction = [];
var board, construction = [];
board = JXG.JSXGraph.initBoard('box', {grid:true, boundingbox:[-1,6,11,-3], keepaspectratio:true, axis:true});
board = JXG.JSXGraph.initBoard('box', {grid:false, boundingbox:[-1,6,11,-3], keepaspectratio:true, axis:true});


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() {
    JXG.JSXGraph.freeBoard(board);
    board = JXG.JSXGraph.initBoard('box', {grid:true, boundingbox:[-1,6,11,-3], keepaspectratio:true, axis:true});
}
}
</jsxgraph>
</jsxgraph>


Line 17: Line 22:
<br>
<br>
<input type="button" value="set" onClick="construct()">
<input type="button" value="set" onClick="construct()">
<input type="button" value="clear all" onClick="clearAll()">
</form>
</form>
</html>
</html>


===Possible elements:===
===Available commands===
{| cellpadding="8" cellspacing="0" border="1"
See our [http://jsxgraph.uni-bayreuth.de/wp/documentation/ documentation page] for a list of commands.
! Construction !! Description
|-
| A(1,1)    || Point with name 'A' at the position (1,1)
|-
| ZY(0.5<nowiki>|</nowiki>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 JavaScript code===
==The JavaScript code==
<source lang="javascript">
<source lang="javascript">
var board, construction = [];
var board, construction = [];
Line 55: Line 36:
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() {
    JXG.JSXGraph.freeBoard(board);
    board = JXG.JSXGraph.initBoard('box', {grid:true, boundingbox:[-1,6,11,-3], keepaspectratio:true, axis:true});
}
}
</source>
</source>
[[Category:Geometry]]
[[Category:Examples]]

Revision as of 07:48, 8 June 2011



Available commands

See our documentation page for a list of commands.

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();
}

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