-// may be it can join 3curve and 4curve. the difference is may be only calculating x,y,ix,iy\r
-\r
-function cdDrawBezier(kage, polygons, x1, y1, x2, y2, x3, y3, x4, y4, a1, a2){\r
- var rad, t;\r
- var x, y, v;\r
- var ix, iy, ia, ib, ir;\r
- var tt;\r
- var delta;\r
- var deltad;\r
- var XX, XY, YX, YY;\r
- var poly, poly2;\r
- var hosomi;\r
- \r
- if(kage.kShotai == kage.kMincho){ // mincho\r
- switch(a1){\r
- case 0:\r
- case 7:\r
- delta = -1 * kage.kMinWidthY * 0.5;\r
- break;\r
- case 1:\r
- case 2: // must be 32\r
- case 6:\r
- case 22:\r
- delta = 0;\r
- break;\r
- case 12:\r
- case 32:\r
- delta = kage.kMinWidthY;\r
- break;\r
- default:\r
- break;\r
- }\r
- \r
- if(x1 == x2){\r
- if(y1 < y2){ y1 = y1 - delta; }\r
- else{ y1 = y1 + delta; }\r
- }\r
- else if(y1 == y2){\r
- if(x1 < x2){ x1 = x1 - delta; }\r
- else{ x1 = x1 + delta; }\r
- }\r
- else{\r
- rad = Math.atan((y2 - y1) / (x2 - x1));\r
- if(x1 < x2){ v = 1; } else{ v = -1; }\r
- x1 = x1 - delta * Math.cos(rad) * v;\r
- y1 = y1 - delta * Math.sin(rad) * v;\r
- }\r
- \r
- switch(a2){\r
- case 0:\r
- case 1:\r
- case 8:\r
- case 7:\r
- case 9:\r
- case 15: // it can change to 15->5\r
- case 14: // it can change to 14->4\r
- case 17: // no need\r
- case 5:\r
- delta = 0;\r
- break;\r
- default:\r
- break;\r
- }\r
- \r
- if(x3 == x4){\r
- if(y3 < y4){ y4 = y4 + delta; }\r
- else{ y4 = y4 - delta; }\r
- }\r
- else if(y3 == y4){\r
- if(x3 < x4){ x4 = x4 + delta; }\r
- else{ x4 = x4 - delta; }\r
- }\r
- else{\r
- rad = Math.atan((y4 - y3) / (x4 - x3));\r
- if(x3 < x4){ v = 1; } else{ v = -1; }\r
- x4 = x4 + delta * Math.cos(rad) * v;\r
- y4 = y4 + delta * Math.sin(rad) * v;\r
- }\r
- \r
- hosomi = 0.5;\r
- if(Math.sqrt((x3 - x1) * (x3 - x1) + (y3 - y1) * (y3 - y1)) < 50){\r
- hosomi += 0.4 * (1 - Math.sqrt((x3 - x1) * (x3 - x1) + (y3 - y1) * (y3 - y1)) / 50);\r
- }\r
-\r
- poly = new Polygon();\r
- poly2 = new Polygon();\r
- for(tt = 0; tt <= 1000; tt = tt + kage.kRate){\r
- t = (tt) / 1000;\r
- \r
- //calculate a dot\r
- x = (1.0 - t) * (1.0 - t) * (1.0 - t) * x1 + 3.0 * t * (1.0 - t) * (1.0 - t) * x2 + 3 * t * t * (1.0 - t) * x3 + t * t * t * x4;\r
- y = (1.0 - t) * (1.0 - t) * (1.0 - t) * y1 + 3.0 * t * (1.0 - t) * (1.0 - t) * y2 + 3 * t * t * (1.0 - t) * y3 + t * t * t * y4;\r
- //KATAMUKI of vector by BIBUN\r
- ix = t * t * (-3 * x1 + 9 * x2 + -9 * x3 + 3 * x4) + t * (6 * x1 + -12 * x2 + 6 * x3) + -3 * x1 + 3 * x2;\r
- iy = t * t * (-3 * y1 + 9 * y2 + -9 * y3 + 3 * y4) + t * (6 * y1 + -12 * y2 + 6 * y3) + -3 * y1 + 3 * y2;\r
- \r
- //line SUICHOKU by vector\r
- if(ix != 0 && iy != 0){\r
- ir = Math.atan(iy / ix * -1);\r
- ia = Math.sin(ir) * (kage.kMinWidthT);\r
- ib = Math.cos(ir) * (kage.kMinWidthT);\r
- }\r
- else if(ix == 0){\r
- ia = kage.kMinWidthT;\r
- ib = 0;\r
- }\r
- else{\r
- ia = 0;\r
- ib = kage.kMinWidthT;\r
- }\r
- \r
- if(a1 == 7 && a2 == 0){ // L2RD: fatten\r
- deltad = Math.pow(t, hosomi) * kage.kL2RDfatten;\r
- }\r
- else if(a1 == 7){\r
- deltad = Math.pow(t, hosomi);\r
- }\r
- else if(a2 == 7){\r
- deltad = Math.pow(1.0 - t, hosomi);\r
- }\r
- else{ deltad = 1; }\r
-\r
- if(deltad < 0.15){\r
- deltad = 0.15;\r
- }\r
- ia = ia * deltad;\r
- ib = ib * deltad;\r
- \r
- //reverse if vector is going 2nd/3rd quadrants\r
- if(ix <= 0){\r
- ia = ia * -1;\r
- ib = ib * -1;\r
- }\r
- \r
- //copy to polygon structuer\r
- poly.push(x - ia, y - ib);\r
- poly2.push(x + ia, y + ib);\r
- }\r
- poly2.reverse();\r
- poly.concat(poly2);\r
- polygons.push(poly);\r
- \r
- //process for head of stroke\r
- rad = Math.atan((y2 - y1) / (x2 - x1));\r
- if(x1 < x2){ v = 1; } else{ v = -1; }\r
- XX = Math.sin(rad) * v;\r
- XY = Math.cos(rad) * v * -1;\r
- YX = Math.cos(rad) * v;\r
- YY = Math.sin(rad) * v;\r
- \r
- if(a1 == 12){\r
- if(x1 == x2){\r
- poly = new Polygon();\r
- poly.push(x1 - kage.kMinWidthT, y1);\r
- poly.push(x1 + kage.kMinWidthT, y1);\r
- poly.push(x1 - kage.kMinWidthT, y1 - kage.kMinWidthT);\r
- polygons.push(poly);\r
- }\r
- else{\r
- poly = new Polygon();\r
- poly.push(x1 - kage.kMinWidthT * XX, y1 - kage.kMinWidthT * XY);\r
- poly.push(x1 + kage.kMinWidthT * XX, y1 + kage.kMinWidthT * XY);\r
- poly.push(x1 - kage.kMinWidthT * XX - kage.kMinWidthT * YX, y1 - kage.kMinWidthT * XY - kage.kMinWidthT * YY);\r
- polygons.push(poly);\r
- }\r
- }\r
- \r
- if(a1 == 0){\r
- if(y1 <= y4){ //from up to bottom\r
- if(x1 == x2){\r
- poly = new Polygon();\r
- poly.push(x1 - kage.kMinWidthT, y1);\r
- poly.push(x1 + kage.kMinWidthT, y1);\r
- poly.push(x1 - kage.kMinWidthT, y1 - kage.kMinWidthY);\r
- polygons.push(poly);\r
- }\r
- else{\r
- poly = new Polygon();\r
- poly.push(x1 - kage.kMinWidthT * XX, y1 - kage.kMinWidthT * XY);\r
- poly.push(x1 + kage.kMinWidthT * XX, y1 + kage.kMinWidthT * XY);\r
- poly.push(x1 - kage.kMinWidthT * XX - kage.kMinWidthY * YX, y1 - kage.kMinWidthT * XY - kage.kMinWidthY * YY);\r
- polygons.push(poly);\r
- }\r
- }\r
- else{ //bottom to up\r
- if(x1 == x2){\r
- poly = new Polygon();\r
- poly.push(x1 - kage.kMinWidthT, y1);\r
- poly.push(x1 + kage.kMinWidthT, y1);\r
- poly.push(x1 + kage.kMinWidthT, y1 - kage.kMinWidthY);\r
- polygons.push(poly);\r
- }\r
- else{\r
- poly = new Polygon();\r
- poly.push(x1 - kage.kMinWidthT * XX, y1 - kage.kMinWidthT * XY);\r
- poly.push(x1 + kage.kMinWidthT * XX, y1 + kage.kMinWidthT * XY);\r
- poly.push(x1 + kage.kMinWidthT * XX - kage.kMinWidthY * YX, y1 + kage.kMinWidthT * XY - kage.kMinWidthY * YY);\r
- polygons.push(poly);\r
- }\r
- }\r
- }\r
- \r
- if(a1 == 22){ //box's up-right corner, any time same degree\r
- poly = new Polygon();\r
- poly.push(x1 - kage.kMinWidthT, y1 - kage.kMinWidthY);\r
- poly.push(x1, y1 - kage.kMinWidthY - kage.kWidth);\r
- poly.push(x1 + kage.kMinWidthT + kage.kWidth, y1 + kage.kMinWidthY);\r
- poly.push(x1 + kage.kMinWidthT, y1 + kage.kMinWidthT);\r
- poly.push(x1, y1 + kage.kMinWidthT);\r
- polygons.push(poly);\r
- }\r
- \r
- if(a1 == 0){ //beginning of the stroke\r
- if(y1 <= y4){ //from up to bottom\r
- if(x1 == x2){\r
- poly = new Polygon();\r
- poly.push(x1 + kage.kMinWidthT, y1);\r
- poly.push(x1 + kage.kMinWidthT * 1.5, y1 + kage.kMinWidthY);\r
- poly.push(x1 + kage.kMinWidthT * 0.5, y1 + kage.kMinWidthY * 3);\r
- polygons.push(poly);\r
- }\r
- else{\r
- poly = new Polygon();\r
- poly.push(x1 + kage.kMinWidthT * XX,\r
- y1 + kage.kMinWidthT * XY);\r
- poly.push(x1 + kage.kMinWidthT * 1.5 * XX + kage.kMinWidthY * YX,\r
- y1 + kage.kMinWidthT * 1.5 * XY + kage.kMinWidthY * YY);\r
- poly.push(x1 + kage.kMinWidthT * 0.5 * XX + kage.kMinWidthY * 3 * YX,\r
- y1 + kage.kMinWidthT * 0.5 * XY + kage.kMinWidthY * 3 * YY);\r
- polygons.push(poly);\r
- }\r
- }\r
- else{ //from bottom to up\r
- if(x1 == x2){\r
- poly = new Polygon();\r
- poly.push(x1 - kage.kMinWidthT, y1);\r
- poly.push(x1 - kage.kMinWidthT * 1.5, y1 + kage.kMinWidthY);\r
- poly.push(x1 - kage.kMinWidthT * 0.5, y1 + kage.kMinWidthY * 3);\r
- polygons.push(poly);\r
- }\r
- else{\r
- poly = new Polygon();\r
- poly.push(x1 - kage.kMinWidthT * XX, y1 - kage.kMinWidthT * XY);\r
- poly.push(x1 - kage.kMinWidthT * 1.5 * XX + kage.kMinWidthY * YX, y1 + kage.kMinWidthY * YY - kage.kMinWidthT * 1.5 * XY);\r
- poly.push(x1 - kage.kMinWidthT * 0.5 * XX + kage.kMinWidthY * 3 * YX, y1 + kage.kMinWidthY * 3 * YY - kage.kMinWidthT * 0.5 * XY);\r
- polygons.push(poly);\r
- }\r
- }\r
- }\r
- \r
- //process for tail\r
- rad = Math.atan((y4 - y3) / (x4 - x3));\r
- if(x3 < x4){ v = 1; } else{ v = -1; }\r
- YX = Math.sin(rad) * v * -1;\r
- YY = Math.cos(rad) * v;\r
- XX = Math.cos(rad) * v;\r
- XY = Math.sin(rad) * v;\r
- \r
- if(a2 == 1 || a2 == 8 || a2 == 15){ //the last filled circle ... it can change to 15->5\r
- if(x3 == x4){\r
- poly = Polygon();\r
- poly.push(x4 - kage.kMinWidthT, y4);\r
- poly.push(x4 - kage.kMinWidthT * 0.7, y4 + kage.kMinWidthT * 0.7);\r
- poly.push(x4, y4 + kage.kMinWidthT);\r
- poly.push(x4 + kage.kMinWidthT * 0.7, y4 + kage.kMinWidthT * 0.7);\r
- poly.push(x4 + kage.kMinWidthT, y4);\r
- polygons.push(poly);\r
- }\r
- else if(y3 == y4){\r
- poly = new Polygon();\r
- poly.push(x4, y4 - kage.kMinWidthT);\r
- poly.push(x4 + kage.kMinWidthT * 0.7, y4 - kage.kMinWidthT * 0.7);\r
- poly.push(x4 + kage.kMinWidthT, y4);\r
- poly.push(x4 + kage.kMinWidthT * 0.7, y4 + kage.kMinWidthT * 0.7);\r
- poly.push(x4, y4 + kage.kMinWidthT);\r
- polygons.push(poly);\r
- }\r
- else{\r
- poly = new Polygon();\r
- poly.push(x4 + Math.sin(rad) * kage.kMinWidthT * v, y4 - Math.cos(rad) * kage.kMinWidthT * v);\r
- poly.push(x4 + Math.cos(rad) * kage.kMinWidthT * 0.7 * v + Math.sin(rad) * kage.kMinWidthT * 0.7 * v,\r
- y4 + Math.sin(rad) * kage.kMinWidthT * 0.7 * v - Math.cos(rad) * kage.kMinWidthT * 0.7 * v);\r
- poly.push(x4 + Math.cos(rad) * kage.kMinWidthT * v, y4 + Math.sin(rad) * kage.kMinWidthT * v);\r
- poly.push(x4 + Math.cos(rad) * kage.kMinWidthT * 0.7 * v - Math.sin(rad) * kage.kMinWidthT * 0.7 * v,\r
- y4 + Math.sin(rad) * kage.kMinWidthT * 0.7 * v + Math.cos(rad) * kage.kMinWidthT * 0.7 * v);\r
- poly.push(x4 - Math.sin(rad) * kage.kMinWidthT * v, y4 + Math.cos(rad) * kage.kMinWidthT * v);\r
- polygons.push(poly);\r
- }\r
- }\r
- \r
- if(a2 == 9 || (a1 == 7 && a2 == 0)){ // Math.sinnyu & L2RD Harai\r
- if(y3 == y4){\r
- poly = new Polygon();\r
- poly.push(x4, y4 + kage.kMinWidthT);\r
- poly.push(x4, y4 - kage.kMinWidthT);\r
- poly.push(x4 + kage.kMinWidthT, y4 - kage.kMinWidthT);\r
- polygons.push(poly);\r
- }\r
- else{\r
- poly = new Polygon();\r
- poly.push(x4 + kage.kMinWidthT * YX, y4 + kage.kMinWidthT * YY);\r
- poly.push(x4 - kage.kMinWidthT * YX, y4 - kage.kMinWidthT * YY);\r
- poly.push(x4 + kage.kMinWidthT * XX - kage.kMinWidthT * YX, y4 + kage.kMinWidthT * XY - kage.kMinWidthT * YY);\r
- polygons.push(poly);\r
- }\r
- }\r
- \r
- if(a2 == 15){ //jump up ... it can change to 15->5\r
- if(y3 == y4){\r
- poly = new Polygon();\r
- poly.push(x4, y4 - kage.kMinWidthT + 1);\r
- poly.push(x4 + 2, y4 - kage.kMinWidthT - kage.kWidth * 5);\r
- poly.push(x4, y4 - kage.kMinWidthT - kage.kWidth * 5);\r
- poly.push(x4 - kage.kMinWidthT, y4 - kage.kMinWidthT + 1);\r
- polygons.push(poly);\r
- }\r
- else{\r
- poly = new Polygon();\r
- poly.push(x4 + (kage.kMinWidthT - 1) * Math.sin(rad) * v, y4 - (kage.kMinWidthT - 1) * Math.cos(rad) * v);\r
- poly.push(x4 + 2 * Math.cos(rad) * v + (kage.kMinWidthT + kage.kWidth * 5) * Math.sin(rad) * v,\r
- y4 + 2 * Math.sin(rad) * v - (kage.kMinWidthT + kage.kWidth * 5) * Math.cos(rad) * v);\r
- poly.push(x4 + (kage.kMinWidthT + kage.kWidth * 5) * Math.sin(rad) * v,\r
- y4 - (kage.kMinWidthT + kage.kWidth * 5) * Math.cos(rad) * v);\r
- poly.push(x4 + (kage.kMinWidthT - 1) * Math.sin(rad) * v - kage.kMinWidthT * Math.cos(rad) * v,\r
- y4 - (kage.kMinWidthT - 1) * Math.cos(rad) * v - kage.kMinWidthT * Math.sin(rad) * v);\r
- polygons.push(poly);\r
- }\r
- }\r
- \r
- if(a2 == 14){ //jump to left, allways go left ... it can change to 14->4\r
- poly = new Polygon();\r
- poly.push(x4, y4);\r
- poly.push(x4, y4 - kage.kMinWidthT);\r
- poly.push(x4 - kage.kWidth * 4, y4 - kage.kMinWidthT);\r
- poly.push(x4 - kage.kWidth * 4, y4 - kage.kMinWidthT * 0.5);\r
- polygons.push(poly);\r
- }\r
- }\r
- else{ //gothic\r
- if(a1 % 10 == 2){\r
- if(x1 == x2){\r
- if(y1 < y2){ y1 = y1 - kage.kWidth; } else{ y1 = y1 + kage.kWidth; }\r
- }\r
- else if(y1 == y2){\r
- if(x1 < x2){ x1 = x1 - kage.kWidth; } else{ x1 = x1 + kage.kWidth; }\r
- }\r
- else{\r
- rad = Math.atan((y2 - y1) / (x2 - x1));\r
- if(x1 < x2){ v = 1; } else{ v = -1; }\r
- x1 = x1 - kage.kWidth * Math.cos(rad) * v;\r
- y1 = y1 - kage.kWidth * Math.sin(rad) * v;\r
- }\r
- }\r
- \r
- if(a1 % 10 == 3){\r
- if(x1 == x2){\r
- if(y1 < y2){\r
- y1 = y1 - kage.kWidth * kage.kKakato;\r
- }\r
- else{\r
- y1 = y1 + kage.kWidth * kage.kKakato;\r
- }\r
- }\r
- else if(y1 == y2){\r
- if(x1 < x2){\r
- x1 = x1 - kage.kWidth * kage.kKakato;\r
- }\r
- else{\r
- x1 = x1 + kage.kWidth * kage.kKakato;\r
- }\r
- }\r
- else{\r
- rad = Math.atan((y2 - y1) / (x2 - x1));\r
- if(x1 < x2){ v = 1; } else{ v = -1; }\r
- x1 = x1 - kage.kWidth * Math.cos(rad) * v * kage.kKakato;\r
- y1 = y1 - kage.kWidth * Math.sin(rad) * v * kage.kKakato;\r
- }\r
- }\r
- if(a2 % 10 == 2){\r
- if(x3 == x4){\r
- if(y3 < y4){ y4 = y4 + kage.kWidth; } else{ y4 = y4 - kage.kWidth; }\r
- }\r
- else if(y3 == y4){\r
- if(x3 < x4){ x4 = x4 + kage.kWidth; } else{ x4 = x4 - kage.kWidth; }\r
- }\r
- else{\r
- rad = Math.atan((y4 - y3) / (x4 - x3));\r
- if(x3 < x4){ v = 1; } else{ v = -1; }\r
- x4 = x4 + kage.kWidth * Math.cos(rad) * v;\r
- y4 = y4 + kage.kWidth * Math.sin(rad) * v;\r
- }\r
- }\r
- \r
- if(a2 % 10 == 3){\r
- if(x3 == x4){\r
- if(y3 < y4){\r
- y4 = y4 + kage.kWidth * kage.kKakato;\r
- }\r
- else{\r
- y4 = y4 - kage.kWidth * kage.kKakato;\r
- }\r
- }\r
- else if(y3 == y4){\r
- if(x3 < x4){\r
- x4 = x4 + kage.kWidth * kage.kKakato;\r
- }\r
- else{\r
- x4 = x4 - kage.kWidth * kage.kKakato;\r
- }\r
- }\r
- else{\r
- rad = Math.atan((y4 - y3) / (x4 - x3));\r
- if(x3 < x4){ v = 1; } else{ v = -1; }\r
- x4 = x4 + kage.kWidth * Math.cos(rad) * v * kage.kKakato;\r
- y4 = y4 + kage.kWidth * Math.sin(rad) * v * kage.kKakato;\r
- }\r
- }\r
- \r
- poly = new Polygon();\r
- poly2= new Polygon();\r
- \r
- for(tt = 0; tt <= 1000; tt = tt + kage.kRate){\r
- t = tt / 1000;\r
- \r
- //calculate a dot\r
- x = (1.0 - t) * (1.0 - t) * (1.0 - t) * x1 + 3.0 * t * (1.0 - t) * (1.0 - t) * x2 + 3 * t * t * (1.0 - t) * x3 + t * t * t * x4;\r
- y = (1.0 - t) * (1.0 - t) * (1.0 - t) * y1 + 3.0 * t * (1.0 - t) * (1.0 - t) * y2 + 3 * t * t * (1.0 - t) * y3 + t * t * t * y4;\r
- //KATAMUKI of vector by BIBUN\r
- ix = t * t * (-3 * x1 + 9 * x2 + -9 * x3 + 3 * x4) + t * (6 * x1 + -12 * x2 + 6 * x3) + -3 * x1 + 3 * x2;\r
- iy = t * t * (-3 * y1 + 9 * y2 + -9 * y3 + 3 * y4) + t * (6 * y1 + -12 * y2 + 6 * y3) + -3 * y1 + 3 * y2;\r
- \r
- //SESSEN NI SUICHOKU NA CHOKUSEN NO KEISAN\r
- if(kage.kShotai == kage.kMincho){ //always false ?\r
- if(ix != 0 && iy != 0){\r
- ir = Math.atan(iy / ix * -1.0);\r
- ia = Math.sin(ir) * kage.kMinWidthT;\r
- ib = Math.cos(ir) * kage.kMinWidthT;\r
- }\r
- else if(ix == 0){\r
- ia = kage.kMinWidthT;\r
- ib = 0;\r
- }\r
- else{\r
- ia = 0;\r
- ib = kage.kMinWidthT;\r
- }\r
- ia = ia * Math.sqrt(1.0 - t);\r
- ib = ib * Math.sqrt(1.0 - t);\r
- }\r
- else{\r
- if(ix != 0 && iy != 0){\r
- ir = Math.atan(iy / ix * -1.0);\r
- ia = Math.sin(ir) * kage.kWidth;\r
- ib = Math.cos(ir) * kage.kWidth;\r
- }\r
- else if(ix == 0){\r
- ia = kage.kWidth;\r
- ib = 0;\r
- }\r
- else{\r
- ia = 0;\r
- ib = kage.kWidth;\r
- }\r
- }\r
- \r
- //reverse if vector is going 2nd/3rd quadrants\r
- if(ix <= 0){\r
- ia = ia * -1;\r
- ib = ib * -1;\r
- }\r
- \r
- //save to polygon\r
- poly.push(x - ia, y - ib);\r
- poly2.push(x + ia, y + ib);\r
- }\r
- \r
- poly2.reverse();\r
- poly.concat(poly2);\r
- polygons.push(poly);\r
- }\r
-}\r
-\r
-function cdDrawCurve(kage, polygons, x1, y1, x2, y2, x3, y3, a1, a2){\r
+function cdDrawCurveU(kage, polygons, x1, y1, sx1, sy1, sx2, sy2, x2, y2, a1, a2){\r
var rad, t;\r
var x, y, v;\r
var ix, iy, ia, ib, ir;\r
var deltad;\r
var XX, XY, YX, YY;\r
var poly, poly2;\r
- var hosomi;\r
+ var hosomi;\r
\r
if(kage.kShotai == kage.kMincho){ // mincho\r
switch(a1 % 100){\r
break;\r
}\r
\r
- if(x1 == x2){\r
- if(y1 < y2){ y1 = y1 - delta; }\r
+ if(x1 == sx1){\r
+ if(y1 < sy1){ y1 = y1 - delta; }\r
else{ y1 = y1 + delta; }\r
}\r
- else if(y1 == y2){\r
- if(x1 < x2){ x1 = x1 - delta; }\r
+ else if(y1 == sy1){\r
+ if(x1 < sx1){ x1 = x1 - delta; }\r
else{ x1 = x1 + delta; }\r
}\r
else{\r
- rad = Math.atan((y2 - y1) / (x2 - x1));\r
- if(x1 < x2){ v = 1; } else{ v = -1; }\r
+ rad = Math.atan((sy1 - y1) / (sx1 - x1));\r
+ if(x1 < sx1){ v = 1; } else{ v = -1; }\r
x1 = x1 - delta * Math.cos(rad) * v;\r
y1 = y1 - delta * Math.sin(rad) * v;\r
}\r
break;\r
}\r
\r
- if(x2 == x3){\r
- if(y2 < y3){ y3 = y3 + delta; }\r
- else{ y3 = y3 - delta; }\r
+ if(sx2 == x2){\r
+ if(sy2 < y2){ y2 = y2 + delta; }\r
+ else{ y2 = y2 - delta; }\r
}\r
- else if(y2 == y3){\r
- if(x2 < x3){ x3 = x3 + delta; }\r
- else{ x3 = x3 - delta; }\r
+ else if(sy2 == y2){\r
+ if(sx2 < x2){ x2 = x2 + delta; }\r
+ else{ x2 = x2 - delta; }\r
}\r
else{\r
- rad = Math.atan((y3 - y2) / (x3 - x2));\r
- if(x2 < x3){ v = 1; } else{ v = -1; }\r
- x3 = x3 + delta * Math.cos(rad) * v;\r
- y3 = y3 + delta * Math.sin(rad) * v;\r
+ rad = Math.atan((y2 - sy2) / (x2 - sx2));\r
+ if(sx2 < x2){ v = 1; } else{ v = -1; }\r
+ x2 = x2 + delta * Math.cos(rad) * v;\r
+ y2 = y2 + delta * Math.sin(rad) * v;\r
}\r
\r
hosomi = 0.5;\r
- if(Math.sqrt((x3 - x1) * (x3 - x1) + (y3 - y1) * (y3 - y1)) < 50){\r
- hosomi += 0.4 * (1 - Math.sqrt((x3 - x1) * (x3 - x1) + (y3 - y1) * (y3 - y1)) / 50);\r
+ if(Math.sqrt((x2 - x1) * (x2 - x1) + (y2 - y1) * (y2 - y1)) < 50){\r
+ hosomi += 0.4 * (1 - Math.sqrt((x2 - x1) * (x2 - x1) + (y2 - y1) * (y2 - y1)) / 50);\r
}\r
\r
poly = new Polygon();\r
for(tt = 0; tt <= 1000; tt = tt + kage.kRate){\r
t = tt / 1000;\r
\r
- //calculate a dot\r
- x = ((1.0 - t) * (1.0 - t) * x1 + 2.0 * t * (1.0 - t) * x2 + t * t * x3);\r
- y = ((1.0 - t) * (1.0 - t) * y1 + 2.0 * t * (1.0 - t) * y2 + t * t * y3);\r
- \r
- //KATAMUKI of vector by BIBUN\r
- ix = (x1 - 2.0 * x2 + x3) * 2.0 * t + (-2.0 * x1 + 2.0 * x2);\r
- iy = (y1 - 2.0 * y2 + y3) * 2.0 * t + (-2.0 * y1 + 2.0 * y2);\r
- \r
+ if(sx1 == sx2 && sy1 == sy2){ // Spline\r
+ //calculate a dot\r
+ x = ((1.0 - t) * (1.0 - t) * x1 + 2.0 * t * (1.0 - t) * sx1 + t * t * x2);\r
+ y = ((1.0 - t) * (1.0 - t) * y1 + 2.0 * t * (1.0 - t) * sy1 + t * t * y2);\r
+ \r
+ //KATAMUKI of vector by BIBUN\r
+ ix = (x1 - 2.0 * sx1 + x2) * 2.0 * t + (-2.0 * x1 + 2.0 * sx1);\r
+ iy = (y1 - 2.0 * sy1 + y2) * 2.0 * t + (-2.0 * y1 + 2.0 * sy1);\r
+ } else { // Bezier\r
+ //calculate a dot\r
+ x = (1.0 - t) * (1.0 - t) * (1.0 - t) * x1 + 3.0 * t * (1.0 - t) * (1.0 - t) * sx1 + 3 * t * t * (1.0 - t) * sx2 + t * t * t * x2;\r
+ y = (1.0 - t) * (1.0 - t) * (1.0 - t) * y1 + 3.0 * t * (1.0 - t) * (1.0 - t) * sy1 + 3 * t * t * (1.0 - t) * sy2 + t * t * t * y2;\r
+ //KATAMUKI of vector by BIBUN\r
+ ix = t * t * (-3 * x1 + 9 * sx1 + -9 * sx2 + 3 * x2) + t * (6 * x1 + -12 * sx1 + 6 * sx2) + -3 * x1 + 3 * sx1;\r
+ iy = t * t * (-3 * y1 + 9 * sy1 + -9 * sy2 + 3 * y2) + t * (6 * y1 + -12 * sy1 + 6 * sy2) + -3 * y1 + 3 * sy1;\r
+ }\r
//line SUICHOKU by vector\r
if(ix != 0 && iy != 0){\r
ir = Math.atan(iy / ix * -1);\r
\r
if(a1 == 7 && a2 == 0){ // L2RD: fatten\r
deltad = Math.pow(t, hosomi) * kage.kL2RDfatten;\r
- }\r
+ }\r
else if(a1 == 7){\r
- deltad = Math.pow(t, hosomi);\r
- }\r
- else if(a2 == 7){\r
- deltad = Math.pow(1.0 - t, hosomi);\r
- }\r
+ deltad = Math.pow(t, hosomi);\r
+ }\r
+ else if(a2 == 7){\r
+ deltad = Math.pow(1.0 - t, hosomi);\r
+ }\r
else{ deltad = 1; }\r
\r
- if(deltad < 0.15){\r
- deltad = 0.15;\r
- }\r
+ if(deltad < 0.15){\r
+ deltad = 0.15;\r
+ }\r
ia = ia * deltad;\r
ib = ib * deltad;\r
\r
polygons.push(poly);\r
\r
//process for head of stroke\r
- rad = Math.atan((y2 - y1) / (x2 - x1));\r
- if(x1 < x2){ v = 1; } else{ v = -1; }\r
+ rad = Math.atan((sy1 - y1) / (sx1 - x1));\r
+ if(x1 < sx1){ v = 1; } else{ v = -1; }\r
XX = Math.sin(rad) * v;\r
XY = Math.cos(rad) * v * -1;\r
YX = Math.cos(rad) * v;\r
}\r
\r
if(a1 == 0){\r
- if(y1 <= y3){ //from up to bottom\r
- if(x1 == x2){\r
+ if(y1 <= y2){ //from up to bottom\r
+ if(x1 == sx1){\r
poly = new Polygon();\r
poly.push(x1 - kage.kMinWidthT, y1);\r
poly.push(x1 + kage.kMinWidthT, y1);\r
}\r
}\r
else{ //bottom to up\r
- if(x1 == x2){\r
+ if(x1 == sx1){\r
poly = new Polygon();\r
poly.push(x1 - kage.kMinWidthT, y1);\r
poly.push(x1 + kage.kMinWidthT, y1);\r
}\r
\r
if(a1 == 0){ //beginning of the stroke\r
- if(y1 <= y3){ //from up to bottom\r
- if(x1 == x2){\r
+ if(y1 <= y2){ //from up to bottom\r
+ if(x1 == sx1){\r
poly = new Polygon();\r
poly.push(x1 + kage.kMinWidthT, y1);\r
poly.push(x1 + kage.kMinWidthT * 1.5, y1 + kage.kMinWidthY);\r
}\r
}\r
else{ //from bottom to up\r
- if(x1 == x2){\r
+ if(x1 == sx1){\r
poly = new Polygon();\r
poly.push(x1 - kage.kMinWidthT, y1);\r
poly.push(x1 - kage.kMinWidthT * 1.5, y1 + kage.kMinWidthY);\r
}\r
\r
//process for tail\r
- rad = Math.atan((y3 - y2) / (x3 - x2));\r
- if(x2 < x3){ v = 1; } else{ v = -1; }\r
+ rad = Math.atan((y2 - sy2) / (x2 - sx2));\r
+ if(sx2 < x2){ v = 1; } else{ v = -1; }\r
YX = Math.sin(rad) * v * -1;\r
YY = Math.cos(rad) * v;\r
XX = Math.cos(rad) * v;\r
XY = Math.sin(rad) * v;\r
\r
if(a2 == 1 || a2 == 8 || a2 == 15){ //the last filled circle ... it can change 15->5\r
- if(x2 == x3){\r
+ if(sx2 == x2){\r
poly = new Polygon();\r
- poly.push(x3 - kage.kMinWidthT, y3);\r
- poly.push(x3 - kage.kMinWidthT * 0.7, y3 + kage.kMinWidthT * 0.7);\r
- poly.push(x3, y3 + kage.kMinWidthT);\r
- poly.push(x3 + kage.kMinWidthT * 0.7, y3 + kage.kMinWidthT * 0.7);\r
- poly.push(x3 + kage.kMinWidthT, y3);\r
+ poly.push(x2 - kage.kMinWidthT, y2);\r
+ poly.push(x2 - kage.kMinWidthT * 0.7, y2 + kage.kMinWidthT * 0.7);\r
+ poly.push(x2, y2 + kage.kMinWidthT);\r
+ poly.push(x2 + kage.kMinWidthT * 0.7, y2 + kage.kMinWidthT * 0.7);\r
+ poly.push(x2 + kage.kMinWidthT, y2);\r
polygons.push(poly);\r
}\r
- else if(y2 == y3){\r
+ else if(sy2 == y2){\r
poly = new Polygon();\r
- poly.push(x3, y3 - kage.kMinWidthT);\r
- poly.push(x3 + kage.kMinWidthT * 0.7, y3 - kage.kMinWidthT * 0.7);\r
- poly.push(x3 + kage.kMinWidthT, y3);\r
- poly.push(x3 + kage.kMinWidthT * 0.7, y3 + kage.kMinWidthT * 0.7);\r
- poly.push(x3, y3 + kage.kMinWidthT);\r
+ poly.push(x2, y2 - kage.kMinWidthT);\r
+ poly.push(x2 + kage.kMinWidthT * 0.7, y2 - kage.kMinWidthT * 0.7);\r
+ poly.push(x2 + kage.kMinWidthT, y2);\r
+ poly.push(x2 + kage.kMinWidthT * 0.7, y2 + kage.kMinWidthT * 0.7);\r
+ poly.push(x2, y2 + kage.kMinWidthT);\r
polygons.push(poly);\r
}\r
else{\r
poly = new Polygon();\r
- poly.push(x3 + Math.sin(rad) * kage.kMinWidthT * v, y3 - Math.cos(rad) * kage.kMinWidthT * v);\r
- poly.push(x3 + Math.cos(rad) * kage.kMinWidthT * 0.7 * v + Math.sin(rad) * kage.kMinWidthT * 0.7 * v,\r
- y3 + Math.sin(rad) * kage.kMinWidthT * 0.7 * v - Math.cos(rad) * kage.kMinWidthT * 0.7 * v);\r
- poly.push(x3 + Math.cos(rad) * kage.kMinWidthT * v, y3 + Math.sin(rad) * kage.kMinWidthT * v);\r
- poly.push(x3 + Math.cos(rad) * kage.kMinWidthT * 0.7 * v - Math.sin(rad) * kage.kMinWidthT * 0.7 * v,\r
- y3 + Math.sin(rad) * kage.kMinWidthT * 0.7 * v + Math.cos(rad) * kage.kMinWidthT * 0.7 * v);\r
- poly.push(x3 - Math.sin(rad) * kage.kMinWidthT * v, y3 + Math.cos(rad) * kage.kMinWidthT * v);\r
+ poly.push(x2 + Math.sin(rad) * kage.kMinWidthT * v, y2 - Math.cos(rad) * kage.kMinWidthT * v);\r
+ poly.push(x2 + Math.cos(rad) * kage.kMinWidthT * 0.7 * v + Math.sin(rad) * kage.kMinWidthT * 0.7 * v,\r
+ y2 + Math.sin(rad) * kage.kMinWidthT * 0.7 * v - Math.cos(rad) * kage.kMinWidthT * 0.7 * v);\r
+ poly.push(x2 + Math.cos(rad) * kage.kMinWidthT * v, y2 + Math.sin(rad) * kage.kMinWidthT * v);\r
+ poly.push(x2 + Math.cos(rad) * kage.kMinWidthT * 0.7 * v - Math.sin(rad) * kage.kMinWidthT * 0.7 * v,\r
+ y2 + Math.sin(rad) * kage.kMinWidthT * 0.7 * v + Math.cos(rad) * kage.kMinWidthT * 0.7 * v);\r
+ poly.push(x2 - Math.sin(rad) * kage.kMinWidthT * v, y2 + Math.cos(rad) * kage.kMinWidthT * v);\r
polygons.push(poly);\r
}\r
}\r
\r
if(a2 == 9 || (a1 == 7 && a2 == 0)){ // Math.sinnyu & L2RD Harai ... no need for a2=9\r
- var type = (Math.atan2(Math.abs(y3 - y2), Math.abs(x3 - x2)) / Math.PI * 2 - 0.6);\r
+ var type = (Math.atan2(Math.abs(y2 - sy2), Math.abs(x2 - sx2)) / Math.PI * 2 - 0.6);\r
if(type > 0){\r
type = type * 8;\r
} else {\r
} else {\r
pm = 1;\r
}\r
- if(y2 == y3){\r
+ if(sy2 == y2){\r
poly = new Polygon();\r
- poly.push(x3, y3 + kage.kMinWidthT * kage.kL2RDfatten);\r
- poly.push(x3, y3 - kage.kMinWidthT * kage.kL2RDfatten);\r
- poly.push(x3 + kage.kMinWidthT * kage.kL2RDfatten * Math.abs(type), y3 + kage.kMinWidthT * kage.kL2RDfatten * pm);\r
+ poly.push(x2, y2 + kage.kMinWidthT * kage.kL2RDfatten);\r
+ poly.push(x2, y2 - kage.kMinWidthT * kage.kL2RDfatten);\r
+ poly.push(x2 + kage.kMinWidthT * kage.kL2RDfatten * Math.abs(type), y2 + kage.kMinWidthT * kage.kL2RDfatten * pm);\r
polygons.push(poly);\r
}\r
else{\r
poly = new Polygon();\r
- poly.push(x3 + kage.kMinWidthT * kage.kL2RDfatten * YX, y3 + kage.kMinWidthT * kage.kL2RDfatten * YY);\r
- poly.push(x3 - kage.kMinWidthT * kage.kL2RDfatten * YX, y3 - kage.kMinWidthT * kage.kL2RDfatten * YY);\r
- poly.push(x3 + kage.kMinWidthT * kage.kL2RDfatten * Math.abs(type) * XX + kage.kMinWidthT * kage.kL2RDfatten * pm * YX,\r
- y3 + kage.kMinWidthT * kage.kL2RDfatten * Math.abs(type) * XY + kage.kMinWidthT * kage.kL2RDfatten * pm * YY);\r
+ poly.push(x2 + kage.kMinWidthT * kage.kL2RDfatten * YX, y2 + kage.kMinWidthT * kage.kL2RDfatten * YY);\r
+ poly.push(x2 - kage.kMinWidthT * kage.kL2RDfatten * YX, y2 - kage.kMinWidthT * kage.kL2RDfatten * YY);\r
+ poly.push(x2 + kage.kMinWidthT * kage.kL2RDfatten * Math.abs(type) * XX + kage.kMinWidthT * kage.kL2RDfatten * pm * YX,\r
+ y2 + kage.kMinWidthT * kage.kL2RDfatten * Math.abs(type) * XY + kage.kMinWidthT * kage.kL2RDfatten * pm * YY);\r
polygons.push(poly);\r
}\r
}\r
\r
if(a2 == 15){ //jump up ... it can change 15->5\r
- if(y2 == y3){\r
+ if(sy2 == y2){\r
poly = new Polygon();\r
- poly.push(x3, y3 - kage.kMinWidthT + 1);\r
- poly.push(x3 + 2, y3 - kage.kMinWidthT - kage.kWidth * 5);\r
- poly.push(x3, y3 - kage.kMinWidthT - kage.kWidth * 5);\r
- poly.push(x3 - kage.kMinWidthT, y3 - kage.kMinWidthT + 1);\r
+ poly.push(x2, y2 - kage.kMinWidthT + 1);\r
+ poly.push(x2 + 2, y2 - kage.kMinWidthT - kage.kWidth * 5);\r
+ poly.push(x2, y2 - kage.kMinWidthT - kage.kWidth * 5);\r
+ poly.push(x2 - kage.kMinWidthT, y2 - kage.kMinWidthT + 1);\r
polygons.push(poly);\r
}\r
else{\r
poly = new Polygon();\r
- poly.push(x3 + (kage.kMinWidthT - 1) * Math.sin(rad) * v, y3 - (kage.kMinWidthT - 1) * Math.cos(rad) * v);\r
- poly.push(x3 + 2 * Math.cos(rad) * v + (kage.kMinWidthT + kage.kWidth * 5) * Math.sin(rad) * v,\r
- y3 + 2 * Math.sin(rad) * v - (kage.kMinWidthT + kage.kWidth * 5) * Math.cos(rad) * v);\r
- poly.push(x3 + (kage.kMinWidthT + kage.kWidth * 5) * Math.sin(rad) * v,\r
- y3 - (kage.kMinWidthT + kage.kWidth * 5) * Math.cos(rad) * v);\r
- poly.push(x3 + (kage.kMinWidthT - 1) * Math.sin(rad) * v - kage.kMinWidthT * Math.cos(rad) * v,\r
- y3 - (kage.kMinWidthT - 1) * Math.cos(rad) * v - kage.kMinWidthT * Math.sin(rad) * v);\r
+ poly.push(x2 + (kage.kMinWidthT - 1) * Math.sin(rad) * v, y2 - (kage.kMinWidthT - 1) * Math.cos(rad) * v);\r
+ poly.push(x2 + 2 * Math.cos(rad) * v + (kage.kMinWidthT + kage.kWidth * 5) * Math.sin(rad) * v,\r
+ y2 + 2 * Math.sin(rad) * v - (kage.kMinWidthT + kage.kWidth * 5) * Math.cos(rad) * v);\r
+ poly.push(x2 + (kage.kMinWidthT + kage.kWidth * 5) * Math.sin(rad) * v,\r
+ y2 - (kage.kMinWidthT + kage.kWidth * 5) * Math.cos(rad) * v);\r
+ poly.push(x2 + (kage.kMinWidthT - 1) * Math.sin(rad) * v - kage.kMinWidthT * Math.cos(rad) * v,\r
+ y2 - (kage.kMinWidthT - 1) * Math.cos(rad) * v - kage.kMinWidthT * Math.sin(rad) * v);\r
polygons.push(poly);\r
}\r
}\r
\r
if(a2 == 14){ //jump to left, allways go left ... it can change 14->4\r
poly = new Polygon();\r
- poly.push(x3, y3);\r
- poly.push(x3, y3 - kage.kMinWidthT);\r
- poly.push(x3 - kage.kWidth * 4, y3 - kage.kMinWidthT);\r
- poly.push(x3 - kage.kWidth * 4, y3 - kage.kMinWidthT * 0.5);\r
+ poly.push(x2, y2);\r
+ poly.push(x2, y2 - kage.kMinWidthT);\r
+ poly.push(x2 - kage.kWidth * 4, y2 - kage.kMinWidthT);\r
+ poly.push(x2 - kage.kWidth * 4, y2 - kage.kMinWidthT * 0.5);\r
polygons.push(poly);\r
}\r
}\r
else{ //gothic\r
if(a1 % 10 == 2){\r
- if(x1 == x2){\r
- if(y1 < y2){ y1 = y1 - kage.kWidth; } else{ y1 = y1 + kage.kWidth; }\r
+ if(x1 == sx1){\r
+ if(y1 < sy1){ y1 = y1 - kage.kWidth; } else{ y1 = y1 + kage.kWidth; }\r
}\r
- else if(y1 == y2){\r
- if(x1 < x2){ x1 = x1 - kage.kWidth; } else{ x1 = x1 + kage.kWidth; }\r
+ else if(y1 == sy1){\r
+ if(x1 < sx1){ x1 = x1 - kage.kWidth; } else{ x1 = x1 + kage.kWidth; }\r
}\r
else{\r
- rad = Math.atan((y2 - y1) / (x2 - x1));\r
- if(x1 < x2){ v = 1; } else{ v = -1; }\r
+ rad = Math.atan((sy1 - y1) / (sx1 - x1));\r
+ if(x1 < sx1){ v = 1; } else{ v = -1; }\r
x1 = x1 - kage.kWidth * Math.cos(rad) * v;\r
y1 = y1 - kage.kWidth * Math.sin(rad) * v;\r
}\r
}\r
\r
if(a1 % 10 == 3){\r
- if(x1 == x2){\r
- if(y1 < y2){\r
+ if(x1 == sx1){\r
+ if(y1 < sy1){\r
y1 = y1 - kage.kWidth * kage.kKakato;\r
}\r
else{\r
y1 = y1 + kage.kWidth * kage.kKakato;\r
}\r
}\r
- else if(y1 == y2){\r
- if(x1 < x2){\r
+ else if(y1 == sy1){\r
+ if(x1 < sx1){\r
x1 = x1 - kage.kWidth * kage.kKakato;\r
}\r
else{\r
}\r
}\r
else{\r
- rad = Math.atan((y2 - y1) / (x2 - x1));\r
- if(x1 < x2){ v = 1; } else{ v = -1; }\r
+ rad = Math.atan((sy1 - y1) / (sx1 - x1));\r
+ if(x1 < sx1){ v = 1; } else{ v = -1; }\r
x1 = x1 - kage.kWidth * Math.cos(rad) * v * kage.kKakato;\r
y1 = y1 - kage.kWidth * Math.sin(rad) * v * kage.kKakato;\r
}\r
}\r
if(a2 % 10 == 2){\r
- if(x2 == x3){\r
- if(y2 < y3){ y3 = y3 + kage.kWidth; } else{ y3 = y3 - kage.kWidth; }\r
+ if(sx2 == x2){\r
+ if(sy2 < y2){ y2 = y2 + kage.kWidth; } else{ y2 = y2 - kage.kWidth; }\r
}\r
- else if(y2 == y3){\r
- if(x2 < x3){ x3 = x3 + kage.kWidth; } else{ x3 = x3 - kage.kWidth; }\r
+ else if(sy2 == y2){\r
+ if(sx2 < x2){ x2 = x2 + kage.kWidth; } else{ x2 = x2 - kage.kWidth; }\r
}\r
else{\r
- rad = Math.atan((y3 - y2) / (x3 - x2));\r
- if(x2 < x3){ v = 1; } else{ v = -1; }\r
- x3 = x3 + kage.kWidth * Math.cos(rad) * v;\r
- y3 = y3 + kage.kWidth * Math.sin(rad) * v;\r
+ rad = Math.atan((y2 - sy2) / (x2 - sx2));\r
+ if(sx2 < x2){ v = 1; } else{ v = -1; }\r
+ x2 = x2 + kage.kWidth * Math.cos(rad) * v;\r
+ y2 = y2 + kage.kWidth * Math.sin(rad) * v;\r
}\r
}\r
\r
if(a2 % 10 == 3){\r
- if(x2 == x3){\r
- if(y2 < y3){\r
- y3 = y3 + kage.kWidth * kage.kKakato;\r
+ if(sx2 == x2){\r
+ if(sy2 < y2){\r
+ y2 = y2 + kage.kWidth * kage.kKakato;\r
}\r
else{\r
- y3 = y3 - kage.kWidth * kage.kKakato;\r
+ y2 = y2 - kage.kWidth * kage.kKakato;\r
}\r
}\r
- else if(y2 == y3){\r
- if(x2 < x3){\r
- x3 = x3 + kage.kWidth * kage.kKakato;\r
+ else if(sy2 == y2){\r
+ if(sx2 < x2){\r
+ x2 = x2 + kage.kWidth * kage.kKakato;\r
}\r
else{\r
- x3 = x3 - kage.kWidth * kage.kKakato;\r
+ x2 = x2 - kage.kWidth * kage.kKakato;\r
}\r
}\r
else{\r
- rad = Math.atan((y3 - y2) / (x3 - x2));\r
- if(x2 < x3){ v = 1; } else{ v = -1; }\r
- x3 = x3 + kage.kWidth * Math.cos(rad) * v * kage.kKakato;\r
- y3 = y3 + kage.kWidth * Math.sin(rad) * v * kage.kKakato;\r
+ rad = Math.atan((y2 - sy2) / (x2 - sx2));\r
+ if(sx2 < x2){ v = 1; } else{ v = -1; }\r
+ x2 = x2 + kage.kWidth * Math.cos(rad) * v * kage.kKakato;\r
+ y2 = y2 + kage.kWidth * Math.sin(rad) * v * kage.kKakato;\r
}\r
}\r
\r
for(tt = 0; tt <= 1000; tt = tt + kage.kRate){\r
t = tt / 1000;\r
\r
- //calculating each point\r
- x = ((1.0 - t) * (1.0 - t) * x1 + 2.0 * t * (1.0 - t) * x2 + t * t * x3);\r
- y = ((1.0 - t) * (1.0 - t) * y1 + 2.0 * t * (1.0 - t) * y2 + t * t * y3);\r
- \r
- //SESSEN NO KATAMUKI NO KEISAN(BIBUN)\r
- ix = (x1 - 2.0 * x2 + x3) * 2.0 * t + (-2.0 * x1 + 2.0 * x2);\r
- iy = (y1 - 2.0 * y2 + y3) * 2.0 * t + (-2.0 * y1 + 2.0 * y2);\r
- \r
+ if(sx1 == sx2 && sy1 == sy2){\r
+ //calculating each point\r
+ x = ((1.0 - t) * (1.0 - t) * x1 + 2.0 * t * (1.0 - t) * sx1 + t * t * x2);\r
+ y = ((1.0 - t) * (1.0 - t) * y1 + 2.0 * t * (1.0 - t) * sy1 + t * t * y2);\r
+ \r
+ //SESSEN NO KATAMUKI NO KEISAN(BIBUN)\r
+ ix = (x1 - 2.0 * sx1 + x2) * 2.0 * t + (-2.0 * x1 + 2.0 * sx1);\r
+ iy = (y1 - 2.0 * sy1 + y2) * 2.0 * t + (-2.0 * y1 + 2.0 * sy1);\r
+ } else {\r
+ }\r
//SESSEN NI SUICHOKU NA CHOKUSEN NO KEISAN\r
if(kage.kShotai == kage.kMincho){ //always false ?\r
if(ix != 0 && iy != 0){\r
}\r
}\r
\r
+function cdDrawBezier(kage, polygons, x1, y1, x2, y2, x3, y3, x4, y4, a1, a2){\r
+ cdDrawCurveU(kage, polygons, x1, y1, x2, y2, x3, y3, x4, y4, a1, a2);\r
+}\r
+\r
+function cdDrawCurve(kage, polygons, x1, y1, x2, y2, x3, y3, a1, a2){\r
+ cdDrawCurveU(kage, polygons, x1, y1, x2, y2, x2, y2, x3, y3, a1, a2);\r
+}\r
+\r
function cdDrawLine(kage, polygons, tx1, ty1, tx2, ty2, ta1, ta2){\r
var rad;\r
var v, x1, y1, x2, y2;\r