14,49d13 < if (snum == 2) { snum=3; } < < var elem=null; < var context=null; < var cwidth=0; < var cheight=0; < var factor=1.0; < var cf = "12px Verdana"; < var path=null; < < < function getFactor(wis, lis) { < var proposedfactor=eval(Math.max(cwidth, cheight) / Math.max(wis, lis)); < if (eval(Math.min(cwidth, cheight) / Math.min(wis, lis)) < proposedfactor) { < proposedfactor=eval(-1 * eval(Math.min(cwidth, cheight) / Math.min(wis, lis))); < } < if (proposedfactor > 0.0) { < if (eval(25 + eval(Math.abs(proposedfactor) * Math.round(eval('' + document.getElementById('l').value)))) > cwidth || eval(25 + eval(Math.abs(proposedfactor) * Math.round(eval('' + document.getElementById('w').value)))) > cheight) { < while (eval(25 + eval(Math.abs(proposedfactor) * Math.round(eval('' + document.getElementById('w').value)))) > cwidth || eval(25 + eval(Math.abs(proposedfactor) * Math.round(eval('' + document.getElementById('l').value)))) > cheight) { < proposedfactor*=0.8; < } < proposedfactor=-proposedfactor; < } < // alert('normal'); < } else { < if (eval(25 + eval(Math.abs(proposedfactor) * Math.round(eval('' + document.getElementById('w').value)))) > cwidth || eval(25 + eval(Math.abs(proposedfactor) * Math.round(eval('' + document.getElementById('l').value)))) > cheight) { < proposedfactor=-proposedfactor; < while (eval(25 + eval(Math.abs(proposedfactor) * Math.round(eval('' + document.getElementById('l').value)))) > cwidth || eval(25 + eval(Math.abs(proposedfactor) * Math.round(eval('' + document.getElementById('w').value)))) > cheight) { < proposedfactor*=0.8; < } < } < < // alert('abnormal'); < } < return proposedfactor; < } 83,84c47,48 < areais = eval(0.5 * (document.getElementById('a').value + document.getElementById('tb').value) * document.getElementById('th').value); < extrabits = " (long = " + document.getElementById('a').value + " and short = " + document.getElementById('tb').value + " and height = " + document.getElementById('th').value + ")"; --- > areais = eval(0.5 * (document.getElementById('a').value + document.getElementById('b').value) * document.getElementById('th').value); > extrabits = " (long = " + document.getElementById('y').value + " and short = " + document.getElementById('x').value + ")"; 116,118d79 < if (snum == 2) { snum=3; } < if (context) { context.clearRect(0,0,elem.width,elem.height); } < 120d80 < //alert(ideas[snum]); 127d86 < var px=0, py=0, pxx=0; 131,135d89 < elem=document.getElementById('ourcanvas'); < context=elem.getContext('2d'); < cwidth=eval(-70 + eval(('' + elem.width).replace('px',''))); < cheight=eval(-90 + eval(('' + elem.height).replace('px',''))); < //alert('' + cwidth + ',' + cheight); 146,156c100 < factor=getFactor(eval(2 * eval('' + document.getElementById('r').value)), eval(2 * eval('' + document.getElementById('r').value))); < context.font = cf; < context.beginPath(); < context.arc(Math.round(eval(25 + eval(cwidth / 2))), Math.round(eval(25 + eval(cheight / 2))), eval(rnum * Math.abs(factor)), 0, eval(2 * Math.PI)); < context.strokeStyle = '#000000'; < context.stroke(); < context.fillStyle = '#00FF00'; < context.fill(); < context.fillStyle = "#000000"; < context.fillText("" + document.getElementById('r').value + " -------->", Math.round(eval(25 + eval(cwidth / 2))), Math.round(eval(25 + eval(cheight / 2))), eval(rnum * Math.abs(factor))); < } else if (whichone == "sector") { --- > } else if (whichone == "sector") { 162,182d105 < < < factor=getFactor(eval(2 * eval('' + document.getElementById('sr').value)), eval(2 * eval('' + document.getElementById('sr').value))); < context.font = cf; < context.strokeStyle = '#FF0000'; < context.beginPath(); < < context.moveTo(Math.round(eval(25 + eval(cwidth / 2))), Math.round(eval(25 + eval(cheight / 2)))); < context.lineTo(Math.round(eval(25 + eval(cwidth / 2))) + eval(rnum * Math.abs(factor)), Math.round(eval(25 + eval(cheight / 2)))); < < context.arc(Math.round(eval(25 + eval(cwidth / 2))), Math.round(eval(25 + eval(cheight / 2))), eval(rnum * Math.abs(factor)), 0, eval(eval(eval(document.getElementById('arc').value) / 180) * Math.PI)); < context.lineTo(Math.round(eval(25 + eval(cwidth / 2))), Math.round(eval(25 + eval(cheight / 2)))); < //context.stroke(); < //context.stroke(); < context.fillStyle = '#40FF20'; < context.fill(); < context.fillStyle = "#000000"; < context.fillText("" + document.getElementById('sr').value + " -------->", Math.round(eval(25 + eval(cwidth / 2))), Math.round(eval(25 + eval(cheight / 2))), eval(rnum * Math.abs(factor))); < < < 189,201d111 < factor=getFactor(document.getElementById('w').value, document.getElementById('l').value); < context.font = cf; < context.fillStyle = "#FF0000"; < if (factor > 0.0) { < context.fillRect(25, 25, eval(25 + eval(Math.abs(factor) * Math.round(eval('' + document.getElementById('l').value)))), eval(25 + eval(Math.abs(factor) * Math.round(eval('' + document.getElementById('w').value))))); < context.fillStyle = "#000000"; < context.fillText("" + document.getElementById('l').value + " -------->", 40, 40); < } else { < context.fillRect(25, 25, eval(25 + eval(Math.abs(factor) * Math.round(eval('' + document.getElementById('w').value)))), eval(25 + eval(Math.abs(factor) * Math.round(eval('' + document.getElementById('l').value))))); < context.fillStyle = "#000000"; < context.fillText("" + document.getElementById('w').value + " -------->", 40, 40); < } < //context.stroke(); 208,242d117 < < factor=getFactor(document.getElementById('b').value, document.getElementById('h').value); < context.font = cf; < context.fillStyle = "#AAAAAA"; < if (factor > 0.0) { // eval(25 + eval(Math.abs(factor) * < factor/=6; < //context.fillRect(25, 25, eval(25 + eval(Math.abs(factor) * Math.round(eval('' + document.getElementById('h').value)))), eval(25 + eval(Math.abs(factor) * Math.round(eval('' + document.getElementById('b').value))))); < py=eval(eval(Math.abs(factor) * eval('' + document.getElementById('h').value)) / 1); < px=eval(eval(Math.abs(factor) * eval('' + document.getElementById('b').value)) / 1); < path=new Path2D(); < path.moveTo(eval((cwidth/2)+25) + px,(cheight/2)+25); < path.lineTo((cwidth/2)+25,eval((cheight/2)+25)); < path.lineTo((cwidth/2)+25,eval((cheight/2)+25) - py); < path.lineTo(eval((cwidth/2)+25) + px,(cheight/2)+25); < context.fill(path); < context.fillStyle = "#000000"; < context.fillText("<--- " + document.getElementById('b').value + " --->", Math.round(eval(25 + eval(cwidth / 2))), Math.round(eval(45 + eval(cheight / 2))), eval(rnum * Math.abs(factor))); < } else { < //context.fillRect(25, 25, eval(25 + eval(Math.abs(factor) * Math.round(eval('' + document.getElementById('b').value)))), eval(25 + eval(Math.abs(factor) * Math.round(eval('' + document.getElementById('h').value))))); < factor/=6; < py=eval(eval(Math.abs(factor) * eval('' + document.getElementById('h').value)) / 1); < px=eval(eval(Math.abs(factor) * eval('' + document.getElementById('b').value)) / 1); < path=new Path2D(); < path.moveTo(eval((cwidth/2)+25) + px,(cheight/2)+25); < path.lineTo((cwidth/2)+25,eval((cheight/2)+25)); < path.lineTo((cwidth/2)+25,eval((cheight/2)+25) - py); < path.lineTo(eval((cwidth/2)+25) + px,(cheight/2)+25); < context.fill(path); < context.fillStyle = "#000000"; < context.fillText("<--- " + document.getElementById('b').value + " --->", Math.round(eval(25 + eval(cwidth / 2))), Math.round(eval(45 + eval(cheight / 2))), eval(rnum * Math.abs(factor))); < } < //context.stroke(); < < < 249,290d123 < < factor=getFactor(document.getElementById('pb').value, document.getElementById('ph').value); < context.font = cf; < context.fillStyle = "#999999"; < if (factor > 0.0) { // eval(25 + eval(Math.abs(factor) * < factor/=3; < //context.fillRect(25, 25, eval(25 + eval(Math.abs(factor) * Math.round(eval('' + document.getElementById('ph').value)))), eval(25 + eval(Math.abs(factor) * Math.round(eval('' + document.getElementById('pb').value))))); < py=eval(eval(Math.abs(factor) * eval('' + document.getElementById('ph').value)) / 2); < px=eval(eval(Math.abs(factor) * eval('' + document.getElementById('pb').value)) / 2); < pxx=px; //eval(eval(Math.abs(factor) * eval('' + document.getElementById('a').value)) / 2); < path=new Path2D(); < path.moveTo(eval((cwidth/2)+25 - px),eval((cheight/2)+25) + py); < path.lineTo(eval((cwidth/2)+25 + px),eval((cheight/2)+25) + py); < < path.lineTo(eval((cwidth/2)+25 + 40 + pxx),eval((cheight/2)+25) - py); < path.lineTo(eval((cwidth/2)+25 + 40 - pxx),eval((cheight/2)+25) - py); < path.lineTo(eval((cwidth/2)+25 - px),eval((cheight/2)+25) + py); < context.fill(path); < context.fillStyle = "#000000"; < context.fillText("<--- " + document.getElementById('pb').value + " --->", Math.round(eval(25 + eval(cwidth / 2))), Math.round(eval(45 + eval(cheight / 2)))); //, eval(rnum * Math.abs(factor))); < } else { < //context.fillRect(25, 25, eval(25 + eval(Math.abs(factor) * Math.round(eval('' + document.getElementById('pb').value)))), eval(25 + eval(Math.abs(factor) * Math.round(eval('' + document.getElementById('ph').value))))); < factor/=3; < py=eval(eval(Math.abs(factor) * eval('' + document.getElementById('ph').value)) / 2); < px=eval(eval(Math.abs(factor) * eval('' + document.getElementById('pb').value)) / 2); < pxx=px; //eval(eval(Math.abs(factor) * eval('' + document.getElementById('a').value)) / 2); < path=new Path2D(); < path.moveTo(eval((cwidth/2)+25 - px),eval((cheight/2)+25) + py); < path.lineTo(eval((cwidth/2)+25 + px),eval((cheight/2)+25) + py); < < path.lineTo(eval((cwidth/2)+25 + 40 + pxx),eval((cheight/2)+25) - py); < path.lineTo(eval((cwidth/2)+25 + 40 - pxx),eval((cheight/2)+25) - py); < path.lineTo(eval((cwidth/2)+25 - px),eval((cheight/2)+25) + py); < context.fill(path); < context.fillStyle = "#000000"; < context.fillText("<--- " + document.getElementById('pb').value + " --->", Math.round(eval(25 + eval(cwidth / 2))), Math.round(eval(45 + eval(cheight / 2)))); //, eval(rnum * Math.abs(factor))); < } < //context.stroke(); < < < < 297,329d129 < factor=getFactor(document.getElementById('x').value, document.getElementById('y').value); < context.font = cf; < context.fillStyle = "#DDDDDD"; < if (factor > 0.0) { // eval(25 + eval(Math.abs(factor) * < factor/=3; < //context.fillRect(25, 25, eval(25 + eval(Math.abs(factor) * Math.round(eval('' + document.getElementById('y').value)))), eval(25 + eval(Math.abs(factor) * Math.round(eval('' + document.getElementById('x').value))))); < py=eval(eval(Math.abs(factor) * eval('' + document.getElementById('y').value)) / 2); < px=eval(eval(Math.abs(factor) * eval('' + document.getElementById('x').value)) / 2); < path=new Path2D(); < path.moveTo((cwidth/2)+25,eval((cheight/2)+25) + py); < path.lineTo(eval((cwidth/2)+25) + px,(cheight/2)+25); < path.lineTo((cwidth/2)+25,eval((cheight/2)+25) - py); < path.lineTo(eval((cwidth/2)+25) - px,(cheight/2)+25); < path.lineTo((cwidth/2)+25,eval((cheight/2)+25) + py); < context.fill(path); < context.fillStyle = "#000000"; < context.fillText("<--- " + document.getElementById('x').value + " --->", Math.round(eval(25 - px/2 + eval(cwidth / 2))), Math.round(eval(25 + eval(cheight / 2))), eval(rnum * Math.abs(factor))); < } else { < //context.fillRect(25, 25, eval(25 + eval(Math.abs(factor) * Math.round(eval('' + document.getElementById('x').value)))), eval(25 + eval(Math.abs(factor) * Math.round(eval('' + document.getElementById('y').value))))); < factor/=3; < py=eval(eval(Math.abs(factor) * eval('' + document.getElementById('y').value)) / 2); < px=eval(eval(Math.abs(factor) * eval('' + document.getElementById('x').value)) / 2); < path=new Path2D(); < path.moveTo((cwidth/2)+25,eval((cheight/2)+25) + px); < path.lineTo(eval((cwidth/2)+25) + py,(cheight/2)+25); < path.lineTo((cwidth/2)+25,eval((cheight/2)+25) - px); < path.lineTo(eval((cwidth/2)+25) - py,(cheight/2)+25); < path.lineTo((cwidth/2)+25,eval((cheight/2)+25) + px); < context.fill(path); < context.fillStyle = "#000000"; < context.fillText("<--- " + document.getElementById('y').value + " --->", Math.round(eval(25 - py/2 + eval(cwidth / 2))), Math.round(eval(25 + eval(cheight / 2))), eval(rnum * Math.abs(factor))); < } < //context.stroke(); 338,385d137 < factor=getFactor(document.getElementById('a').value, document.getElementById('th').value); < context.font = cf; < context.fillStyle = "#BBBBBB"; < if (factor > 0.0) { // eval(25 + eval(Math.abs(factor) * < factor/=3; < //context.fillRect(25, 25, eval(25 + eval(Math.abs(factor) * Math.round(eval('' + document.getElementById('th').value)))), eval(25 + eval(Math.abs(factor) * Math.round(eval('' + document.getElementById('tb').value))))); < py=eval(eval(Math.abs(factor) * eval('' + document.getElementById('th').value)) / 2); < px=eval(eval(Math.abs(factor) * eval('' + document.getElementById('tb').value)) / 2); < pxx=eval(eval(Math.abs(factor) * eval('' + document.getElementById('a').value)) / 2); < path=new Path2D(); < path.moveTo(eval((cwidth/2)+25 - px),eval((cheight/2)+25) + py); < path.lineTo(eval((cwidth/2)+25 + px),eval((cheight/2)+25) + py); < < path.lineTo(eval((cwidth/2)+25 + pxx),eval((cheight/2)+25) - py); < path.lineTo(eval((cwidth/2)+25 - pxx),eval((cheight/2)+25) - py); < path.lineTo(eval((cwidth/2)+25 - px),eval((cheight/2)+25) + py); < context.fill(path); < context.fillStyle = "#000000"; < context.fillText("<--- " + document.getElementById('tb').value + " --->", Math.round(eval(25 - px/2 + eval(cwidth / 2))), Math.round(eval(45 + eval(cheight / 2)))); //, eval(rnum * Math.abs(factor))); < context.fillText("<--- " + document.getElementById('a').value + " --->", Math.round(eval(25 - px/2 + eval(cwidth / 2))), Math.round(eval(15 + eval(cheight / 2)))); //, eval(eval(125 + rnum) * Math.abs(factor))); < } else { < //context.fillRect(25, 25, eval(25 + eval(Math.abs(factor) * Math.round(eval('' + document.getElementById('tb').value)))), eval(25 + eval(Math.abs(factor) * Math.round(eval('' + document.getElementById('th').value))))); < factor/=3; < py=eval(eval(Math.abs(factor) * eval('' + document.getElementById('th').value)) / 2); < px=eval(eval(Math.abs(factor) * eval('' + document.getElementById('tb').value)) / 2); < pxx=eval(eval(Math.abs(factor) * eval('' + document.getElementById('a').value)) / 2); < path=new Path2D(); < if (1 == 1) { < path.moveTo(eval((cwidth/2)+25 - px),eval((cheight/2)+25) + py); < path.lineTo(eval((cwidth/2)+25 + px),eval((cheight/2)+25) + py); < < path.lineTo(eval((cwidth/2)+25 + pxx),eval((cheight/2)+25) - py); < path.lineTo(eval((cwidth/2)+25 - pxx),eval((cheight/2)+25) - py); < path.lineTo(eval((cwidth/2)+25 - px),eval((cheight/2)+25) + py); < } else { < path.moveTo(eval((cwidth/2)+25 - py),eval((cheight/2)+25) + px); < path.lineTo(eval((cwidth/2)+25 + py),eval((cheight/2)+25) + px); < < path.lineTo(eval((cwidth/2)+25 + pxx),eval((cheight/2)+25) - px); < path.lineTo(eval((cwidth/2)+25 - pxx),eval((cheight/2)+25) - px); < path.lineTo(eval((cwidth/2)+25 - py),eval((cheight/2)+25) + px); < } < context.fill(path); < context.fillStyle = "#000000"; < context.fillText("<--- " + document.getElementById('tb').value + " --->", Math.round(eval(25 - py/2 + eval(cwidth / 2))), Math.round(eval(45 + eval(cheight / 2)))); //, eval(rnum * Math.abs(factor))); < context.fillText("<--- " + document.getElementById('a').value + " --->", Math.round(eval(25 - px/2 + eval(cwidth / 2))), Math.round(eval(15 + eval(cheight / 2)))); //, eval(eval(125 + rnum) * Math.abs(factor))); < } < //context.stroke(); 389c141 < //rnum = Math.floor(Math.random() * (rnum - 4)) + 1; --- > rnum = Math.floor(Math.random() * (rnum - 4)) + 1; 392,424d143 < factor=getFactor(document.getElementById('rx').value, document.getElementById('ry').value); < context.font = cf; < context.fillStyle = "#DD00DD"; < if (factor > 0.0) { // eval(25 + eval(Math.abs(factor) * < factor/=3; < //context.fillRect(25, 25, eval(25 + eval(Math.abs(factor) * Math.round(eval('' + document.getElementById('ry').value)))), eval(25 + eval(Math.abs(factor) * Math.round(eval('' + document.getElementById('rx').value))))); < py=eval(eval(Math.abs(factor) * eval('' + document.getElementById('ry').value)) / 2); < px=eval(eval(Math.abs(factor) * eval('' + document.getElementById('rx').value)) / 2); < path=new Path2D(); < path.moveTo((cwidth/2)+25,eval((cheight/2)+25) + py); < path.lineTo(eval((cwidth/2)+25) + px,(cheight/2)+25); < path.lineTo((cwidth/2)+25,eval((cheight/2)+25) - py); < path.lineTo(eval((cwidth/2)+25) - px,(cheight/2)+25); < path.lineTo((cwidth/2)+25,eval((cheight/2)+25) + py); < context.fill(path); < context.fillStyle = "#000000"; < context.fillText("<--- " + document.getElementById('rx').value + " --->", Math.round(eval(25 - px/2 + eval(cwidth / 2))), Math.round(eval(25 + eval(cheight / 2))), eval(rnum * Math.abs(factor))); < } else { < //context.fillRect(25, 25, eval(25 + eval(Math.abs(factor) * Math.round(eval('' + document.getElementById('rx').value)))), eval(25 + eval(Math.abs(factor) * Math.round(eval('' + document.getElementById('ry').value))))); < factor/=3; < py=eval(eval(Math.abs(factor) * eval('' + document.getElementById('ry').value)) / 2); < px=eval(eval(Math.abs(factor) * eval('' + document.getElementById('rx').value)) / 2); < path=new Path2D(); < path.moveTo((cwidth/2)+25,eval((cheight/2)+25) + px); < path.lineTo(eval((cwidth/2)+25) + py,(cheight/2)+25); < path.lineTo((cwidth/2)+25,eval((cheight/2)+25) - px); < path.lineTo(eval((cwidth/2)+25) - py,(cheight/2)+25); < path.lineTo((cwidth/2)+25,eval((cheight/2)+25) + px); < context.fill(path); < context.fillStyle = "#000000"; < context.fillText("<--- " + document.getElementById('ry').value + " --->", Math.round(eval(25 - py/2 + eval(cwidth / 2))), Math.round(eval(25 + eval(cheight / 2))), eval(rnum * Math.abs(factor))); < } < //context.stroke(); 503c222 < Rhombus: Diagonal
--- > Rhombus: Long Diagonal Short Diagonal 528,530d246 <