Watt curve: Difference between revisions

From JSXGraph Wiki
mNo edit summary
No edit summary
Line 31: Line 31:
==References==
==References==


* [http://en.wikipedia.org/wiki/Watt_curve]
* [http://en.wikipedia.org/wiki/Watt_curve http://en.wikipedia.org/wiki/Watt_curve]


==The underlying JavaScript code==
==The underlying JavaScript code==

Revision as of 07:39, 16 March 2009

With JSXGraph elements can be traced to visualize construced loci.

References

The underlying JavaScript code

board = JXG.JSXGraph.initBoard('jxgbox', {originX: 50, originY: 400, unitX: 25, unitY: 25, axis: false, grid: false});
xax = board.createElement('axis', [[0,0],[1,0]]);
yax = board.createElement('axis', [[0,0],[0,1]]);
p1 = board.createElement('point', [7, 8], {style:2,name:"",fixed:true});
p2 = board.createElement('point', [15, 8], {style:2,name:"",fixed:true});
c1 = board.createElement('circle', [p1, 4.5]);
c2 = board.createElement('circle', [p2, 4.5]);
g1 = board.createElement('glider', [0, 0, c1], {style:5,name:"Drag me"});
c3 = board.createElement('circle', [g1, 8]);
g2 = board.createElement('point', [board.intersectionFunc(c2,c3,0)], {style:5, name: ""});
g3 = board.createElement('point', [board.intersectionFunc(c2,c3,1)], {style:5, name: ""});
m1 = board.createElement('midpoint', [g1,g2], {style:8,name:"",trace:true});
m2 = board.createElement('midpoint', [g1,g3], {style:8,name:"",trace:true,strokeColor:'green'});

function clearTrace() {
    m1.clearTrace();
    m2.clearTrace();
}