Trigonometric functions: Difference between revisions

From JSXGraph Wiki
No edit summary
No edit summary
Line 11: Line 11:
var p4 = brd.createElement('point',[0.0,function(){return p2.Y();}],{visible:false,name:'',withLabel:false});
var p4 = brd.createElement('point',[0.0,function(){return p2.Y();}],{visible:false,name:'',withLabel:false});


brd.createElement('line',[p0,p2],{straightFirst:false,straightLast:false,strokeColor:'black'});
brd.createElement('line',[p0,p2],{straightFirst:false,straightLast:false,strokeColor:'black'});   // Hypotenuse
brd.createElement('line',[p2,p3],{straightFirst:false,straightLast:false,strokeColor:'red'});
brd.createElement('line',[p2,p3],{straightFirst:false,straightLast:false,strokeColor:'red'});     // sin
brd.createElement('line',[p2,p4],{straightFirst:false,straightLast:false,strokeColor:'red'});
brd.createElement('line',[p2,p4],{straightFirst:false,straightLast:false,strokeColor:'red'});     // cos


var t = brd.createElement('tangent',[p2],{visible:false});
var t = brd.createElement('tangent',[p2],{visible:false});
var p5 = brd.createElement('point',[brd.intersectionFunc(t,ax,0)],{visible:false,name:'',withLabel:false});
var p5 = brd.createElement('point',[brd.intersectionFunc(t,ax,0)],{visible:false,name:'',withLabel:false});
var p6 = brd.createElement('point',[brd.intersectionFunc(t,ay,0)],{visible:false,name:'',withLabel:false});
var p6 = brd.createElement('point',[brd.intersectionFunc(t,ay,0)],{visible:false,name:'',withLabel:false});
brd.createElement('line',[p5,p6],{straightFirst:false,straightLast:false});
brd.createElement('line',[p5,p6],{straightFirst:false,straightLast:false});                       // tan + cot


brd.createElement('line',[p0,p6],{straightFirst:false,straightLast:false,strokeColor:'green'});
brd.createElement('line',[p0,p6],{straightFirst:false,straightLast:false,strokeColor:'green'});   // csc
brd.createElement('line',[p0,p5],{straightFirst:false,straightLast:false,strokeColor:'green'});
brd.createElement('line',[p0,p5],{straightFirst:false,straightLast:false,strokeColor:'green'});   // sec


brd.createElement('text',[
brd.createElement('text',[
         function(){return (p0.X()+p2.x())*0.5;},
         function(){return (p0.X()+p2.X())*0.5;},
         function(){return (p0.X()+p2.x())*0.5;},
         function(){return (p0.Y()+p2.Y())*0.5;},
         '1'],{});
         '1'],{});
brd.createElement('text',[
        function(){return (p0.X()+p4.X())*0.5;},
        function(){return (p0.Y()+p4.Y())*0.5;},
        'cos'],{});





Revision as of 16:13, 11 June 2009