<iframe src="http://jsxgraph.org/share/iframe/rolling-circle-on-line" style="border: 1px solid black; overflow: hidden; width: 550px; aspect-ratio: 55 / 65;" name="JSXGraph example: Rolling circle on line" allowfullscreen ></iframe>
<input type="button" value="start" onclick="rol.start()"> <input type="button" value="stop" onclick="rol.stop()"> <input type="button" value="one step" onclick="rol.rolling()"> <div id="board-0-wrapper" class="jxgbox-wrapper " style="width: 100%; "> <div id="board-0" class="jxgbox" style="aspect-ratio: 1 / 1; width: 100%;" data-ar="1 / 1"></div> </div> <script type = "text/javascript"> /* This example is licensed under a Creative Commons Attribution ShareAlike 4.0 International License. https://creativecommons.org/licenses/by-sa/4.0/ Please note you have to mention The Center of Mobile Learning with Digital Technology in the credits. */ const BOARDID = 'board-0'; var board = JXG.JSXGraph.initBoard(BOARDID, { boundingbox: [-1, 5, 20, -1], keepaspectratio: true }); board.suspendUpdate(); // Line var line = board.create('curve', [function(t) { return t; }, function(t) { return 1; }], { strokeWidth: 6 }); // Circle var P = board.create('point', [0, 1], { name: 'P', trace: true }); var C = board.create('point', [0, 2], { name: 'C' }); var circle = board.create('curve', [ 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); }, 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); }, 0, 2 * Math.PI], { strokeWidth: 6, strokeColor: 'green' }); // Point on circle var B = board.create('glider', [0, 2, circle], { name: 'B', color: 'blue', trace: false }); board.create('segment', [C, B], { color: 'black' }); board.unsuspendUpdate(); var rol = board.createRoulette(line, circle, 0, Math.PI / 20, 1, 100, [C, P, B]); </script>
/* This example is licensed under a Creative Commons Attribution ShareAlike 4.0 International License. https://creativecommons.org/licenses/by-sa/4.0/ Please note you have to mention The Center of Mobile Learning with Digital Technology in the credits. */ const BOARDID = 'your_div_id'; // Insert your id here! var board = JXG.JSXGraph.initBoard(BOARDID, { boundingbox: [-1, 5, 20, -1], keepaspectratio: true }); board.suspendUpdate(); // Line var line = board.create('curve', [function(t) { return t; }, function(t) { return 1; }], { strokeWidth: 6 }); // Circle var P = board.create('point', [0, 1], { name: 'P', trace: true }); var C = board.create('point', [0, 2], { name: 'C' }); var circle = board.create('curve', [ 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); }, 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); }, 0, 2 * Math.PI], { strokeWidth: 6, strokeColor: 'green' }); // Point on circle var B = board.create('glider', [0, 2, circle], { name: 'B', color: 'blue', trace: false }); board.create('segment', [C, B], { color: 'black' }); board.unsuspendUpdate(); var rol = board.createRoulette(line, circle, 0, Math.PI / 20, 1, 100, [C, P, B]);
<input type="button" value="start" onclick="rol.start()"> <input type="button" value="stop" onclick="rol.stop()"> <input type="button" value="one step" onclick="rol.rolling()">
// Define the id of your board in BOARDID var board = JXG.JSXGraph.initBoard(BOARDID, { boundingbox: [-1, 5, 20, -1], keepaspectratio: true }); board.suspendUpdate(); // Line var line = board.create('curve', [function(t) { return t; }, function(t) { return 1; }], { strokeWidth: 6 }); // Circle var P = board.create('point', [0, 1], { name: 'P', trace: true }); var C = board.create('point', [0, 2], { name: 'C' }); var circle = board.create('curve', [ 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); }, 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); }, 0, 2 * Math.PI], { strokeWidth: 6, strokeColor: 'green' }); // Point on circle var B = board.create('glider', [0, 2, circle], { name: 'B', color: 'blue', trace: false }); board.create('segment', [C, B], { color: 'black' }); board.unsuspendUpdate(); var rol = board.createRoulette(line, circle, 0, Math.PI / 20, 1, 100, [C, P, B]);
This example is licensed under a Creative Commons Attribution ShareAlike 4.0 International License. Please note you have to mention The Center of Mobile Learning with Digital Technology in the credits.