Difference between revisions of "Bearing"
From JSXGraph Wiki
Jump to navigationJump to searchA WASSERMANN (talk | contribs) |
A WASSERMANN (talk | contribs) |
||
Line 1: | Line 1: | ||
+ | <html> | ||
+ | <form> | ||
+ | <input type="text" id="degrees"> | ||
+ | </form> | ||
+ | </html> | ||
<jsxgraph width="600" height="500"> | <jsxgraph width="600" height="500"> | ||
var brd = JXG.JSXGraph.initBoard('jxgbox',{axis:true,boundingbox:[-2,1.5,2,-1.5],keepaspectratio:true}); | var brd = JXG.JSXGraph.initBoard('jxgbox',{axis:true,boundingbox:[-2,1.5,2,-1.5],keepaspectratio:true}); | ||
var c = brd.create('circle',[[0,0],1]); | var c = brd.create('circle',[[0,0],1]); | ||
var p = brd.create('glider',[-1,0.5,c],{name:'drag me'}); | var p = brd.create('glider',[-1,0.5,c],{name:'drag me'}); | ||
− | + | brd.addHook(function(){ | |
− | + | document.getElementById('degrees').value = (Math.atan2(p.X(),ppY())*180/Math.PI).toFixed(1); | |
− | + | }); | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
</jsxgraph> | </jsxgraph> |
Revision as of 18:08, 16 June 2010