Rolling circle on circle: Difference between revisions

From JSXGraph Wiki
No edit summary
No edit summary
 
(10 intermediate revisions by the same user not shown)
Line 1: Line 1:
<jsxgraph width="0" height="0" box="nix"></jsxgraph>
<html>
<html>
<script type="text/javascript" src="/~alfred/jsxgraph/trunk/src/Roulette.js"></script>
<form>
<form>
<input type="button" value="start" onclick="rol.start()">
<input type="button" value="start" onclick="rol.start()">
Line 17: Line 15:
// Circle
// Circle
var P = brd.create('point',[4,0],{name:'P', trace:false});
var P = brd.create('point',[4,0],{name:'P', trace:false});
var C = brd.create('point',[1,0],{name:'C'});
var C = brd.create('point',[2,0],{name:'C'});
var circle = brd.create('curve',[
var circle = brd.create('curve',[
                     function(t){var d = P.Dist(C);
                     function(t){var d = P.Dist(C),
                                    beta = JXG.Math.Geometry.rad([C.X()+1,C.Y()],C,P);
                                t += beta;
                                 return C.X()+d*Math.cos(t);
                                 return C.X()+d*Math.cos(t);
                     },
                     },
                     function(t){var d = P.Dist(C);
                     function(t){var d = P.Dist(C),
                                    beta = JXG.Math.Geometry.rad([C.X()+1,C.Y()],C,P);
                                t += beta;
                                 return C.Y()+d*Math.sin(t);
                                 return C.Y()+d*Math.sin(t);
                     },
                     },
Line 32: Line 34:
brd.create('segment',[C,B],{color:'black'});  
brd.create('segment',[C,B],{color:'black'});  
brd.unsuspendUpdate();
brd.unsuspendUpdate();
var rol = JXG.Math.Numerics.createRoulette(bigCircle, circle, 0, Math.PI/90, 50, [C,P,B]);  
var rol = brd.createRoulette(bigCircle, circle, 0, Math.PI/45, -1, 150, [C,P,B]);  


</jsxgraph>
</jsxgraph>

Latest revision as of 17:19, 23 November 2010

The underlying JavaScript code