| 1 |
<html> |
| 2 |
<head> |
| 3 |
<title>Watt | JSXGraph Example</title> |
| 4 |
<link rel="stylesheet" type="text/css" href="../../distrib/jsxgraph.css" /> |
| 5 |
<script type="text/javascript" src="../../distrib/jsxgraphcore.js"></script> |
| 6 |
</head> |
| 7 |
<body> |
| 8 |
<div id="debug" style="display: none"></div> |
| 9 |
<center> |
| 10 |
<div style="width: 1000px;"> |
| 11 |
<div style="width:600px; height: 510px;"> |
| 12 |
<div id="jxgbox" class="jxgbox" style="width:600px; height:500px; text-align: left; float: left;"></div> |
| 13 |
<div id="polynomials" style="display: none; width: 600px; height: 500px; margin-left: 10px; text-align: left; padding-left: -200px;"></div> |
| 14 |
</div> |
| 15 |
|
| 16 |
<div style="width: 800px; margin-top: 10px;"> |
| 17 |
<form> |
| 18 |
<input type="button" onclick="computeLocus();" value="Calculate locus" /> |
| 19 |
</form> |
| 20 |
</div> |
| 21 |
</div> |
| 22 |
</center> |
| 23 |
<script type="text/javascript"> |
| 24 |
/* <![CDATA[ */ |
| 25 |
|
| 26 |
board = JXG.JSXGraph.initBoard('jxgbox', {boundingbox:[-12, 12, 12, -12], axis: true, grid: false, keepaspectratio: true}); |
| 27 |
|
| 28 |
A = board.create('point', [2,0]); |
| 29 |
|
| 30 |
k1 = board.create('circle', [A, 5]); |
| 31 |
|
| 32 |
c = board.create('functiongraph', [function (x) { return x*x*x;}]); |
| 33 |
|
| 34 |
c.generatePolynomial = function(p) { |
| 35 |
return [['(',p.symbolic.x,')^3 - ',p.symbolic.y].join('')]; |
| 36 |
}; |
| 37 |
|
| 38 |
D = board.create('glider', [0,0, c], {name: 'D'}); |
| 39 |
|
| 40 |
k2 = board.create('circle', [D, 4]); |
| 41 |
|
| 42 |
I = board.create('intersection', [k1, k2, 0], {color: 'blue'}); |
| 43 |
|
| 44 |
m = board.create('midpoint', [I, D], {color: 'green'}); |
| 45 |
|
| 46 |
|
| 47 |
function computeLocus() { |
| 48 |
board.create('locus', [m], {strokeColor: 'black', strokeWidth: '3px'}); |
| 49 |
} |
| 50 |
/* ]]> */ |
| 51 |
</script> |
| 52 |
<br/> |
| 53 |
</body> |
| 54 |
</html> |