Improved shape of L2RD harai's tail.
authorKoichi KAMICHI <kamichi@fonts.jp>
Mon, 23 Feb 2009 02:34:06 +0000 (02:34 +0000)
committerKoichi KAMICHI <kamichi@fonts.jp>
Mon, 23 Feb 2009 02:34:06 +0000 (02:34 +0000)
engine/kagecd.js

index a3adf0f..d0b6310 100755 (executable)
@@ -798,19 +798,31 @@ function cdDrawCurve(kage, polygons, x1, y1, x2, y2, x3, y3, a1, a2){
     }\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
+      if(type > 0){\r
+        type = type * 8;\r
+      } else {\r
+        type = type * 3;\r
+      }\r
+      var pm;\r
+      if(type < 0){\r
+        pm = -1;\r
+      } else {\r
+        pm = 1;\r
+      }\r
       if(y2 == y3){\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, y3 - kage.kMinWidthT * kage.kL2RDfatten);\r
+        poly.push(x3 + kage.kMinWidthT * kage.kL2RDfatten * Math.abs(type), y3 + 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 * XX - kage.kMinWidthT * kage.kL2RDfatten * YX,\r
-                  y3 + kage.kMinWidthT * kage.kL2RDfatten * XY - 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
         polygons.push(poly);\r
       }\r
     }\r