Difference between revisions of "Trochoid"

From JSXGraph Wiki
Jump to: navigation, search
Line 5: Line 5:
 
<div id="jsxgbox" class="jxgbox" style="width:500px; height:500px;"></div>
 
<div id="jsxgbox" class="jxgbox" style="width:500px; height:500px;"></div>
 
<script language="JavaScript">
 
<script language="JavaScript">
  board = JXG.JSXGraph.initBoard('jsxgbox', {originX: 250, originY: 250, unitX: 50, unitY: 50});
+
  board = JXG.JSXGraph.initBoard('jsxgbox', {originX: 250, originY: 250, unitX: 25, unitY: 25});
 
  board.createElement('axis', [[0,0],[1,0]]);
 
  board.createElement('axis', [[0,0],[1,0]]);
 
  board.createElement('axis', [[0,0],[0,1]]);
 
  board.createElement('axis', [[0,0],[0,1]]);
Line 12: Line 12:
 
  var x = function(phi) { return a.Value()*phi-b.Value()*Math.sin(phi); }
 
  var x = function(phi) { return a.Value()*phi-b.Value()*Math.sin(phi); }
 
  var y = function(phi) { return a.Value()-b.Value()*Math.cos(phi); }
 
  var y = function(phi) { return a.Value()-b.Value()*Math.cos(phi); }
  c1 = board.createElement('curve', [x,y,'phi',0,Math.PI*4],{strokeWidth:3});
+
  c1 = board.createElement('curve', [x,y,'phi',-Math.PI*4,Math.PI*4],{strokeWidth:3});
 
</script>  
 
</script>  
 
</html>
 
</html>

Revision as of 17:55, 5 February 2009