A regular star geometric shape generator

						var board = JXG.JSXGraph.initBoard('box1', {
boundingbox: [-10, 10, 10, -10],showNavigation:false, showcopyright: false, axis: false,
});
var p1 = board.create('point', [-1, 2.0],{name:'O',size:1,label:{offset:[-20,0]}});
var p2 = board.create('point', [6.5, 2.0],{name:'',face:'',});
var c1 = board.create('circle', [p1, p2],{visible:false});
var input = board.create('input', [-8,-8, '5', 'n = '], {cssStyle:'width:100px'});

var button1 = board.create('button', [2, -8, 'generate n-sided regular polygon', function() {
updateshape();
 }], {});
var l = [];
var updateshape=function(){
var s=[];       
var n = input.Value();
 
if (/\d*/.test(n)&&n<101){
	 if(l.length > 0){
		 for(var i=0;in){
 var l2 = board.create('segment', [s[i],s[i+2-n]]);
}else
var l2 = board.create('segment', [s[i],s[i+2]]);
l.push(l2);
}


}
};

updateshape();
 
					

The image appears in the following posts

Triangle posted 1 year ago

Scroll to Top