Rolling Reuleaux triangle: Difference between revisions
From JSXGraph Wiki
A WASSERMANN (talk | contribs) No edit summary |
A WASSERMANN (talk | contribs) No edit summary |
||
(One intermediate revision by the same user not shown) | |||
Line 19: | Line 19: | ||
var line = brd.create('curve',[function(t){return t;}, function(t){return -2;}], | var line = brd.create('curve',[function(t){return t;}, function(t){return -2;}], | ||
{strokeWidth:6, strokeColor:'#d66d55', fillColor:'#d6bb55', highlightFillColor:'#d6bb55'}); | {strokeWidth:6, strokeColor:'#d66d55', fillColor:'#d6bb55', highlightFillColor:'#d6bb55'}); | ||
var reuleauxTriangle = brd.create('curve', JXG.Math. | var reuleauxTriangle = brd.create('curve', JXG.Math.Geometry.reuleauxPolygon(pol3.vertices, 3), | ||
{strokeWidth:6, strokeColor:'#d66d55', fillColor:'#ad5544', highlightFillColor:'#ad5544'}); | {strokeWidth:6, strokeColor:'#d66d55', fillColor:'#ad5544', highlightFillColor:'#ad5544'}); | ||
var S = brd.create('point', [ | var S = brd.create('point', [ | ||
Line 27: | Line 27: | ||
brd.unsuspendUpdate(); | brd.unsuspendUpdate(); | ||
var rol3 = | var rol3 = brd.createRoulette(line, reuleauxTriangle, -2, Math.PI/45, 1, 100, [A,B]); | ||
</jsxgraph> | </jsxgraph> | ||
Line 44: | Line 44: | ||
var line = brd.create('curve',[function(t){return t;}, function(t){return -2;}], | var line = brd.create('curve',[function(t){return t;}, function(t){return -2;}], | ||
{strokeWidth:6, strokeColor:'#d66d55', fillColor:'#d6bb55', highlightFillColor:'#d6bb55'}); | {strokeWidth:6, strokeColor:'#d66d55', fillColor:'#d6bb55', highlightFillColor:'#d6bb55'}); | ||
var reuleauxTriangle = brd.create('curve', JXG.Math. | var reuleauxTriangle = brd.create('curve', JXG.Math.Geometry.reuleauxPolygon(pol3.vertices, 3), | ||
{strokeWidth:6, strokeColor:'#d66d55', fillColor:'#ad5544', highlightFillColor:'#ad5544'}); | {strokeWidth:6, strokeColor:'#d66d55', fillColor:'#ad5544', highlightFillColor:'#ad5544'}); | ||
var S = brd.create('point', [ | var S = brd.create('point', [ | ||
Line 52: | Line 52: | ||
brd.unsuspendUpdate(); | brd.unsuspendUpdate(); | ||
var rol3 = | var rol3 = brd.createRoulette(line, reuleauxTriangle, -2, Math.PI/90, 1, 50, [A,B]); | ||
</source> | </source> | ||
Latest revision as of 15:53, 20 February 2013
The underlying JavaScript code
var brd = JXG.JSXGraph.initBoard('jxgbox',{boundingbox:[-2,7,20,-3], keepaspectratio:true});
brd.renderer.container.style.backgroundColor = '#3d1c24'; // background color board
brd.suspendUpdate();
// Triangle
var A = brd.create('point',[-2,-2]);
var B = brd.create('point',[0,0]);
var pol3 = brd.create('regularpolygon',[A,B,3], {withLines:false, fillColor:'none', highlightFillColor:'none', fillOpacity:0.0});
for (var i=0;i<3;i++) pol3.vertices[i].setProperty({color:'#3d1c24'});
var line = brd.create('curve',[function(t){return t;}, function(t){return -2;}],
{strokeWidth:6, strokeColor:'#d66d55', fillColor:'#d6bb55', highlightFillColor:'#d6bb55'});
var reuleauxTriangle = brd.create('curve', JXG.Math.Geometry.reuleauxPolygon(pol3.vertices, 3),
{strokeWidth:6, strokeColor:'#d66d55', fillColor:'#ad5544', highlightFillColor:'#ad5544'});
var S = brd.create('point', [
function(){return (pol3.vertices[0].X()+pol3.vertices[1].X()+pol3.vertices[2].X())/3; },
function(){return (pol3.vertices[0].Y()+pol3.vertices[1].Y()+pol3.vertices[2].Y())/3; }],
{strokeColor:'#703545', fillColor:'#703545', highlightFillColor:'#703545', name:'S', trace:true});
brd.unsuspendUpdate();
var rol3 = brd.createRoulette(line, reuleauxTriangle, -2, Math.PI/90, 1, 50, [A,B]);