Debian Codegraph @

examples/adg/ex3.html

raw
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>
14
15 <div style="width: 800px; margin-top: 10px;">
16 <form>
17 <input type="button" onclick="computeLocus1();" value="Calculate locus 1" />
18 <input type="button" onclick="computeLocus2();" value="Calculate locus 2" />
19 <input type="button" onclick="showTimes();" value="Show times" />
20 </form>
21 </div>
22 </div>
23 </center>
24 <div id="polynomials" style="display: block; width: 600px; height: 500px; margin-left: 10px; text-align: left; padding-left: -200px;"></div>
25 <script type="text/javascript">
26 /* <![CDATA[ */
27
28 board = JXG.JSXGraph.initBoard('jxgbox', {boundingbox:[-12, 12, 12, -12], axis: true, grid: false, keepaspectratio: true});
29
30 A = board.create('point', [0,0]);
31 B = A;
32
33 k1 = board.create('circle', [A, 8]);
34
35 D = board.create('glider', [1,1,k1]);
36
37 T1 = board.create('midpoint', [D, B], {color: 'green'});
38 T2 = board.create('midpoint', [T1, B]);
39 T3 = board.create('midpoint', [T2, B]);
40
41 locus1 = null;
42 time1 = 0;
43 locus2 = null;
44 time2 = 0;
45
46 function computeLocus1() {
47 locus1 = board.create('locus', [T2]);
48 time1 = locus1.ctime;
49 }
50
51 function computeLocus2() {
52 time2 = 0;
53 l1 = board.create('locus', [T1]);
54 time2 += l1.ctime;
55 g1 = board.create('glider', [1,1,l1]);
56 m1 = board.create('midpoint', [A, g1]);
57 l2 = board.create('locus', [m1]);
58 time2 += l2.ctime;
59 // g2 = board.create('glider', [1,1,l2]);
60 // m2 = board.create('midpoint', [A,g2]);
61 // l3 = board.create('locus', [m2]);
62 // time2 += l3.ctime;
63 }
64
65 function showTimes() {
66 var d = document.getElementById('polynomials');
67 d.innerHTML = '';
68 d.innerHTML += 'chained: ' + time2 + '<br />';
69 d.innerHTML += 'direct: ' + time1;
70 }
71 /* ]]> */
72 </script>
73 <br/>
74 </body>
75 </html>