svnno****@sourc*****
svnno****@sourc*****
2009年 10月 24日 (土) 19:56:26 JST
Revision: 1358 http://sourceforge.jp/projects/sie/svn/view?view=rev&revision=1358 Author: dhrname Date: 2009-10-24 19:56:26 +0900 (Sat, 24 Oct 2009) Log Message: ----------- STArcオブジェクトのコードの整理 Modified Paths: -------------- branches/05x/053/sie.js Modified: branches/05x/053/sie.js =================================================================== --- branches/05x/053/sie.js 2009-10-24 10:44:15 UTC (rev 1357) +++ branches/05x/053/sie.js 2009-10-24 10:56:26 UTC (rev 1358) @@ -1652,11 +1652,11 @@ }; //弧をベジェ曲線に変換 STArc.prototype.set = function starcset(x1,y1,rx,ry,psai,fA,fS,x4,y4) { - var fS = parseFloat(fS), rx = parseFloat(rx), ry = parseFloat(ry), psai = parseFloat(psai), x1 = parseFloat(x1), x4 = parseFloat(x4), y1 = parseFloat(y1), y4 = parseFloat(y4); + var fS = parseFloat(fS), rx = parseFloat(rx), ry = parseFloat(ry), psai = parseFloat(psai), x1 = parseFloat(x1), x4 = parseFloat(x4), y1 = parseFloat(y1), y4 = parseFloat(y4); if (rx === 0 || ry === 0) {throw "line";} rx = Math.abs(rx); ry = Math.abs(ry); var ccx = (x1 - x4) / 2, ccy = (y1 - y4) / 2; - var cpsi = Math.cos(psai*Math.PI/180), spsi = Math.sin(psai*Math.PI/180); + var cpsi = Math.cos(psai*Math.PI/180), spsi = Math.sin(psai*Math.PI/180); var x1d = cpsi*ccx + spsi*ccy, y1d = -1*spsi*ccx + cpsi*ccy; var x1dd = x1d * x1d, y1dd = y1d * y1d; var rxx = rx * rx, ryy = ry * ry; @@ -1675,8 +1675,8 @@ } var cxd = sds*rx*y1d / ry, cyd = -1 * sds*ry*x1d / rx; var cx = cpsi*cxd - spsi*cyd + (x1+x4)/2, cy = spsi*cxd + cpsi*cyd + (y1+y4)/2; - var s1 = this.CVAngle(1,0,(x1d-cxd)/rx,(y1d-cyd)/ry); - var dr = this.CVAngle((x1d-cxd)/rx,(y1d-cyd)/ry,(-x1d-cxd)/rx,(-y1d-cyd)/ry); + var s1 = this.CVAngle(1,0,(x1d-cxd)/rx, (y1d-cyd)/ry); + var dr = this.CVAngle((x1d-cxd)/rx, (y1d-cyd)/ry, (-x1d-cxd)/rx, (-y1d-cyd)/ry); if (!fS && dr > 0) { dr -= 2*Math.PI; } else if (fS && dr < 0) { @@ -1687,22 +1687,17 @@ var segr = dr / seg; var nea = []; var t = 8/3 * Math.sin(segr/4) * Math.sin(segr/4) / Math.sin(segr/2); - var cpsirx = cpsi * rx; - var cpsiry = cpsi * ry; - var spsirx = spsi * rx; - var spsiry = spsi * ry; + var cpsirx = cpsi * rx, cpsiry = cpsi * ry; + var spsirx = spsi * rx, spsiry = spsi * ry; var mc = Math.cos(s1); var ms = Math.sin(s1); - var x2 = x1 - t * (cpsirx * ms + spsiry * mc); - var y2 = y1 - t * (spsirx * ms - cpsiry * mc); + var x2 = x1 - t * (cpsirx * ms + spsiry * mc), y2 = y1 - t * (spsirx * ms - cpsiry * mc); for (var i = 0; i < seg; ++i) { s1 += segr; mc = Math.cos(s1); ms = Math.sin(s1); - var x3 = cpsirx * mc - spsiry * ms + cx; - var y3 = spsirx * mc + cpsiry * ms + cy; - var dx = -t * (cpsirx * ms + spsiry * mc); - var dy = -t * (spsirx * ms - cpsiry * mc); + var x3 = cpsirx * mc - spsiry * ms + cx, y3 = spsirx * mc + cpsiry * ms + cy; + var dx = -t * (cpsirx * ms + spsiry * mc), dy = -t * (spsirx * ms - cpsiry * mc); nea = nea.concat([x2, y2, x3 - dx, y3 - dy, x3, y3]); x2 = x3 + dx; y2 = y3 + dy;