标签:float color oat tin nbsp func 坐标 lin pre
1 var splitLine = function(g3_point,splitIndex){ 2 var slist = new Array(); 3 var x1 = g3_point[0][0]; 4 var y1 = g3_point[0][1]; 5 var x2 = g3_point[1][0]; 6 var y2 = g3_point[1][1]; 7 console.info(‘00000‘); 8 var k = ((y2-y1)/(x2-x1)).toFixed(2); 9 console.info(‘斜率‘,k); 10 for(var i=0;i<splitIndex;i++){ 11 var x3 = parseFloat((Math.abs(x2-x1)*((i+1)/splitIndex)).toFixed(2))+x1;//等分 12 var y3 = Math.abs(x3-x1)*k+y1; 13 var temp = new Array(); 14 temp.push(x3); 15 temp.push(y3); 16 slist.push(temp); 17 } 18 return slist; 19 }
标签:float color oat tin nbsp func 坐标 lin pre
原文地址:http://www.cnblogs.com/SATinnovation/p/6784972.html