Difference between revisions of "Rolling Reuleaux pentagon"

From JSXGraph Wiki
Jump to navigationJump to search
 
(2 intermediate revisions by the same user not shown)
Line 1: Line 1:
<jsxgraph width="0" height="0" box="nix"></jsxgraph>
 
 
<html>
 
<html>
 
<form>
 
<form>
Line 26: Line 25:
 
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 reuleauxPentagon = brd.create('curve', JXG.Math.Numerics.reuleauxPolygon(pol5.vertices, 5),  
+
var reuleauxPentagon = brd.create('curve', JXG.Math.Geometry.reuleauxPolygon(pol5.vertices, 5),  
 
       {strokeWidth:6, strokeColor:'#d66d55', fillColor:'#ad5544', highlightFillColor:'#ad5544'});
 
       {strokeWidth:6, strokeColor:'#d66d55', fillColor:'#ad5544', highlightFillColor:'#ad5544'});
var reuleauxTriangle = brd.create('curve', JXG.Math.Numerics.reuleauxPolygon(pol3.vertices, 3),  
+
var reuleauxTriangle = brd.create('curve', JXG.Math.Geometry.reuleauxPolygon(pol3.vertices, 3),  
 
       {strokeWidth:6, strokeColor:'#d66d55', fillColor:'#703545', highlightFillColor:'#703545'});
 
       {strokeWidth:6, strokeColor:'#d66d55', fillColor:'#703545', highlightFillColor:'#703545'});
 
brd.unsuspendUpdate();
 
brd.unsuspendUpdate();
  
var rol5 = JXG.Math.Numerics.createRoulette(line, reuleauxPentagon, -2, Math.PI/45, 1, 100, [A,B,C,D]);  
+
var rol5 = brd.createRoulette(line, reuleauxPentagon, -2, Math.PI/45, 1, 100, [A,B,C,D]);  
var rol3 = JXG.Math.Numerics.createRoulette(reuleauxPentagon, reuleauxTriangle, 6*Math.PI/5, Math.PI/45, -1, 40, [C,D]);  
+
var rol3 = brd.createRoulette(reuleauxPentagon, reuleauxTriangle, 6*Math.PI/5, Math.PI/45, -1, 40, [C,D]);  
 
</jsxgraph>
 
</jsxgraph>
  
Line 56: Line 55:
 
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 reuleauxPentagon = brd.create('curve', JXG.Math.Numerics.reuleauxPolygon(pol5.vertices, 5),  
+
var reuleauxPentagon = brd.create('curve', JXG.Math.Geometry.reuleauxPolygon(pol5.vertices, 5),  
 
       {strokeWidth:6, strokeColor:'#d66d55', fillColor:'#ad5544', highlightFillColor:'#ad5544'});
 
       {strokeWidth:6, strokeColor:'#d66d55', fillColor:'#ad5544', highlightFillColor:'#ad5544'});
var reuleauxTriangle = brd.create('curve', JXG.Math.Numerics.reuleauxPolygon(pol3.vertices, 3),  
+
var reuleauxTriangle = brd.create('curve', JXG.Math.Geometry.reuleauxPolygon(pol3.vertices, 3),  
 
       {strokeWidth:6, strokeColor:'#d66d55', fillColor:'#703545', highlightFillColor:'#703545'});
 
       {strokeWidth:6, strokeColor:'#d66d55', fillColor:'#703545', highlightFillColor:'#703545'});
 
brd.unsuspendUpdate();
 
brd.unsuspendUpdate();
  
var rol5 = JXG.Math.Numerics.createRoulette(line, reuleauxPentagon, -2, Math.PI/45, 1, 100, [A,B,C,D]);  
+
var rol5 = brd.createRoulette(line, reuleauxPentagon, -2, Math.PI/45, 1, 100, [A,B,C,D]);  
var rol3 = JXG.Math.Numerics.createRoulette(reuleauxPentagon, reuleauxTriangle, 6*Math.PI/5, Math.PI/45, -1, 40, [C,D]);  
+
var rol3 = brd.createRoulette(reuleauxPentagon, reuleauxTriangle, 6*Math.PI/5, Math.PI/45, -1, 40, [C,D]);  
 
</source>
 
</source>
  

Latest revision as of 16: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();
// Pentagon
var A = brd.create('point',[-2,-2]);
var B = brd.create('point',[0,0]);
var pol5 = brd.create('regularpolygon',[A,B,5], {withLines:false, fillColor:'none', highlightFillColor:'none', fillOpacity:0.0});
for (var i=0;i<5;i++) pol5.vertices[i].setProperty({color:'#3d1c24'});

// Triangle
var C = brd.create('point',[-2,-2]);
var D = brd.create('point',[C.X()+3/5*(1+Math.sqrt(5))*0.5*A.Dist(B), C.Y()]);
var pol3 = brd.create('regularpolygon',[C,D,3], {withLines:false, fillColor:'none', highlightFillColor:'none', fillOpacity:0.0});
for (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 reuleauxPentagon = brd.create('curve', JXG.Math.Geometry.reuleauxPolygon(pol5.vertices, 5), 
       {strokeWidth:6, strokeColor:'#d66d55', fillColor:'#ad5544', highlightFillColor:'#ad5544'});
var reuleauxTriangle = brd.create('curve', JXG.Math.Geometry.reuleauxPolygon(pol3.vertices, 3), 
       {strokeWidth:6, strokeColor:'#d66d55', fillColor:'#703545', highlightFillColor:'#703545'});
brd.unsuspendUpdate();

var rol5 = brd.createRoulette(line, reuleauxPentagon, -2, Math.PI/45, 1, 100, [A,B,C,D]); 
var rol3 = brd.createRoulette(reuleauxPentagon, reuleauxTriangle, 6*Math.PI/5, Math.PI/45, -1, 40, [C,D]);