正剧开始:
星历2016年03月20日 09:42:00, 银河系厄尔斯星球中华帝国江南行省。
[工程师阿伟]正在和[机器小伟]一起研究[平行四边形]。
<span style="font-size:18px;"> var r = 20; config.setSector(1,1,1,1); config.graphPaper2D(0, 0, r); config.axis2D(0, 0,180); var triangle = new Triangle(); var a = []; var tmp = []; config.setSector(3,3,1,1); a = shape.paraquad(0, 0, 0, 10, 5, Math.PI/6); tmp = [].concat(a); //document.write(tmp); shape.angleDraw(tmp, 'red', 20); config.setSector(3,3,2,1); a = shape.paraquad(0, 0, 0, 5, 10, Math.PI/6); tmp = [].concat(a); //document.write(tmp); shape.angleDraw(tmp, 'green', 20);</span>
<span style="font-size:18px;"> this.paraquad = function(x, y, rot, a, b, angle) { angle = angle ? Math.abs(angle) : 0; rot = rot ? rot : 0; //参数说明: //平行四边形的两条边a, b, 以及它们之间的夹角angle //这个平行四边形的起始点(x, y), 以及整个图形与x轴的夹角rot var retArray = new Array(); retArray.push([x, -y]); retArray.push([x + a * Math.cos(rot), -(y + a * Math.sin(rot))]); retArray.push([x + a * Math.cos(rot)+ b * Math.cos(rot+angle), -(y + a * Math.sin(rot)+ b * Math.sin(rot+angle))]); retArray.push([x + b * Math.cos(rot+angle), -(y + b * Math.sin(rot+angle))]); return retArray; }</span>
<span style="font-size:18px;"> var r = 20; config.setSector(1,1,1,1); config.graphPaper2D(0, 0, r); config.axis2D(0, 0,180); var triangle = new Triangle(); var a = []; var tmp = []; config.setSector(3,3,1,1); a = triangle.know2edges([10, 8], -90); tmp = [].concat(a); //document.write(tmp); shape.angleDraw(tmp, 'red', 20); config.setSector(3,3,2,1); a = shape.paraquad(0, 0, 0, 6, 10, 53.13/180*Math.PI); tmp = [].concat(a); //document.write(tmp); shape.angleDraw(tmp, 'green', 20, 'BCDA');</span>
<span style="font-size:18px;"> var r = 20; config.setSector(1,1,1,1); config.graphPaper2D(0, 0, r); config.axis2D(0, 0,180); var triangle = new Triangle(); var a = []; var tmp = []; /* config.setSector(3,3,1,1); a = triangle.know2edges([10, 8], -90); tmp = [].concat(a); //document.write(tmp); shape.angleDraw(tmp, 'red', 20); */ config.setSector(3,3,2,1); a = shape.paraquad(0, 0, 0, 10, 10, 60/180*Math.PI); tmp = [].concat(a); //document.write(tmp); shape.angleDraw(tmp, 'green', 20); a = triangle.know2edges([10, 10], 120); tmp = [].concat(a); //document.write(tmp); shape.angleDraw(tmp, 'red', 20, 'ABE'); a = triangle.know2edges([10, 10], 60); tmp = [].concat(a); //document.write(tmp); shape.angleDraw(tmp, 'pink', 20); </span>
<span style="font-size:18px;"> var r = 20; config.setSector(1,1,1,1); config.graphPaper2D(0, 0, r); config.axis2D(0, 0,180); var triangle = new Triangle(); var a = []; var tmp = []; /* config.setSector(3,3,1,1); a = triangle.know2edges([10, 8], -90); tmp = [].concat(a); //document.write(tmp); shape.angleDraw(tmp, 'red', 20); */ config.setSector(3,3,1,2); a = shape.paraquad(0, 0, 0, 10, 10, 90/180*Math.PI); tmp = [].concat(a); //document.write(tmp); shape.angleDraw(tmp, 'green', 20); a = shape.paraquad(-5*0.5, 5*0.707, Math.PI/6, 10, 10, 90/180*Math.PI); tmp = [].concat(a); //document.write(tmp); shape.angleDraw(tmp, 'red', 20, 'EFGH');</span>
<span style="font-size:18px;"> config.setSector(3,3,1,1); a = shape.paraquad(0, 0, 0, 10, 6.18, 90/180*Math.PI); tmp = [].concat(a); //document.write(tmp); shape.angleDraw(tmp, 'red', 20); a = [[0, -3.09], [10, -3.09]]; tmp = [].concat(a); shape.multiLineDraw(tmp, 'green', 20);</span>
<span style="font-size:18px;"> config.setSector(3,3,1,1); a = triangle.know2edges([1, 2]); tmp = [].concat(a); shape.angleDraw(tmp, 'green', 80); config.setSector(3,3,1,2); a = shape.paraquad(0, 0, 0, 2.24, 2.24, 63.23/180*Math.PI); tmp = [].concat(a); //document.write(tmp); shape.angleDraw(tmp, 'red', 80);</span>
本节到此结束,欲知后事如何,请看下回分解。