Reuleaux pentagon

From JSXGraph Wiki
Revision as of 11:53, 2 October 2010 by A WASSERMANN (talk | contribs)

The underlying JavaScript code

JXG.Options.layer.polygon = 8;
JXG.Options.layer.sector = 8;

var brd = JXG.JSXGraph.initBoard('jxgbox',{boundingbox:[-5,5,5,-5]});
brd.suspendUpdate();
var A = brd.create('point',[-2,-2]);
var B = brd.create('point',[2,-2]);
var pol = brd.create('regularpolygon',[A,B,5], {withLines:false, fillColor:'#093083', highlightFillColor:'#093083'});

for (var i=0;i<5;i++) {
    brd.create('arc',[pol.vertices[i],pol.vertices[(i+2)%5],pol.vertices[(i+3)%5]],{strokeColor:'#093083'});
    brd.create('sector',[pol.vertices[i],pol.vertices[(i+2)%5],pol.vertices[(i+3)%5]],
          {fillColor:'#093083', highlightFillColor:'#093083', fillOpacity:1.0, highlightFillOpacity:1.0,
           strokeWidth:0});
}


var C = brd.create('point',[-2,-2]);
var D = brd.create('point',[function(){
                             var p = A.Dist(B); 
                             return C.X()+3*(1+Math.sqrt(5))/2/5*p;
                            },
                            function(){
                             return C.Y();
                            }
                           ]);
var pol3 = brd.create('regularpolygon',[C,D,3], {withLines:false, fillColor:'#e8501f', highlightFillColor:'#e8501f'});

for (i=0;i<3;i++) {
    brd.create('arc',[pol3.vertices[i],
                      pol3.vertices[(i+1)%3],
                      pol3.vertices[(i+2)%3]], 
             {strokeColor:'#e8501f'});
    brd.create('sector',[pol3.vertices[i],
                      pol3.vertices[(i+1)%3],
                      pol3.vertices[(i+2)%3]], 
             {fillColor:'#e8501f', highlightFillColor:'#e8501f',fillOpacity:1.0, highlightFillOpacity:1.0, 
              strokeWidth:0});
}
brd.unsuspendUpdate();