1 function cdDrawCurveU(kage, polygons, x1, y1, sx1, sy1, sx2, sy2, x2, y2, a1, a2){
\r
4 var ix, iy, ia, ib, ir;
\r
12 if(kage.kShotai == kage.kMincho){ // mincho
\r
16 delta = -1 * kage.kMinWidthY * 0.5;
\r
19 case 2: // ... must be 32
\r
27 delta = kage.kMinWidthY;
\r
34 if(y1 < sy1){ y1 = y1 - delta; }
\r
35 else{ y1 = y1 + delta; }
\r
38 if(x1 < sx1){ x1 = x1 - delta; }
\r
39 else{ x1 = x1 + delta; }
\r
42 rad = Math.atan((sy1 - y1) / (sx1 - x1));
\r
43 if(x1 < sx1){ v = 1; } else{ v = -1; }
\r
44 x1 = x1 - delta * Math.cos(rad) * v;
\r
45 y1 = y1 - delta * Math.sin(rad) * v;
\r
53 case 15: // it can change to 15->5
\r
54 case 14: // it can change to 14->4
\r
59 case 8: // get shorten for tail's circle
\r
60 delta = -1 * kage.kMinWidthT * 0.5;
\r
67 if(sy2 < y2){ y2 = y2 + delta; }
\r
68 else{ y2 = y2 - delta; }
\r
71 if(sx2 < x2){ x2 = x2 + delta; }
\r
72 else{ x2 = x2 - delta; }
\r
75 rad = Math.atan((y2 - sy2) / (x2 - sx2));
\r
76 if(sx2 < x2){ v = 1; } else{ v = -1; }
\r
77 x2 = x2 + delta * Math.cos(rad) * v;
\r
78 y2 = y2 + delta * Math.sin(rad) * v;
\r
82 if(Math.sqrt((x2 - x1) * (x2 - x1) + (y2 - y1) * (y2 - y1)) < 50){
\r
83 hosomi += 0.4 * (1 - Math.sqrt((x2 - x1) * (x2 - x1) + (y2 - y1) * (y2 - y1)) / 50);
\r
86 //---------------------------------------------------------------
\r
88 poly = new Polygon();
\r
89 poly2 = new Polygon();
\r
91 if(sx1 == sx2 && sy1 == sy2){ // Spline
\r
93 // generating fatten curve -- begin
\r
94 var kage2 = new Kage();
\r
97 var curve = new Array(2); // L and R
\r
98 get_candidate(kage2, curve, a1, a2, x1, y1, sx1, sy1, x2, y2);
\r
100 var dcl12_34 = new Array(2);
\r
101 var dcr12_34 = new Array(2);
\r
102 var dpl12_34 = new Array(2);
\r
103 var dpr12_34 = new Array(2);
\r
104 divide_curve(kage2, x1, y1, sx1, sy1, x2, y2, curve[0], dcl12_34, dpl12_34);
\r
105 divide_curve(kage2, x1, y1, sx1, sy1, x2, y2, curve[1], dcr12_34, dpr12_34);
\r
107 var ncl1 = new Array(7);
\r
108 var ncl2 = new Array(7);
\r
109 find_offcurve(kage2, dcl12_34[0], dpl12_34[0][2], dpl12_34[0][3], ncl1);
\r
110 find_offcurve(kage2, dcl12_34[1], dpl12_34[1][2], dpl12_34[1][3], ncl2);
\r
112 poly.push(ncl1[0], ncl1[1]);
\r
113 poly.push(ncl1[2], ncl1[3], 1);
\r
114 poly.push(ncl1[4], ncl1[5]);
\r
115 poly.push(ncl2[2], ncl2[3], 1);
\r
116 poly.push(ncl2[4], ncl2[5]);
\r
118 poly2.push(dcr12_34[0][0][0], dcr12_34[0][0][1]);
\r
119 poly2.push(dpr12_34[0][2] - (ncl1[2] - dpl12_34[0][2]), dpl12_34[0][3] - (ncl1[3] - dpl12_34[0][3]), 1);
\r
120 poly2.push(dcr12_34[0][dcr12_34[0].length - 1][0], dcr12_34[0][dcr12_34[0].length - 1][1]);
\r
121 poly2.push(dpr12_34[1][2] - (ncl2[2] - dpl12_34[1][2]), dpl12_34[1][3] - (ncl2[3] - dpl12_34[1][3]), 1);
\r
122 poly2.push(dcr12_34[1][dcr12_34[1].length - 1][0], dcr12_34[1][dcr12_34[1].length - 1][1]);
\r
125 poly.concat(poly2);
\r
126 polygons.push(poly);
\r
127 // generating fatten curve -- end
\r
129 for(tt = 0; tt <= 1000; tt = tt + kage.kRate){
\r
133 x = ((1.0 - t) * (1.0 - t) * x1 + 2.0 * t * (1.0 - t) * sx1 + t * t * x2);
\r
134 y = ((1.0 - t) * (1.0 - t) * y1 + 2.0 * t * (1.0 - t) * sy1 + t * t * y2);
\r
136 // KATAMUKI of vector by BIBUN
\r
137 ix = (x1 - 2.0 * sx1 + x2) * 2.0 * t + (-2.0 * x1 + 2.0 * sx1);
\r
138 iy = (y1 - 2.0 * sy1 + y2) * 2.0 * t + (-2.0 * y1 + 2.0 * sy1);
\r
140 // line SUICHOKU by vector
\r
141 if(ix != 0 && iy != 0){
\r
142 ir = Math.atan(iy / ix * -1);
\r
143 ia = Math.sin(ir) * (kage.kMinWidthT);
\r
144 ib = Math.cos(ir) * (kage.kMinWidthT);
\r
147 ia = kage.kMinWidthT;
\r
152 ib = kage.kMinWidthT;
\r
155 if(a1 == 7 && a2 == 0){ // L2RD: fatten
\r
156 deltad = Math.pow(t, hosomi) * kage.kL2RDfatten;
\r
159 deltad = Math.pow(t, hosomi);
\r
162 deltad = Math.pow(1.0 - t, hosomi);
\r
164 else{ deltad = 1; }
\r
172 //reverse if vector is going 2nd/3rd quadrants
\r
178 //copy to polygon structure
\r
179 poly.push(x - ia, y - ib);
\r
180 poly2.push(x + ia, y + ib);
\r
183 // suiheisen ni setsuzoku
\r
187 if(poly2.array[index].y <= y1 && y1 <= poly2.array[index + 1].y){
\r
192 newx1 = poly2.array[index + 1].x + (poly2.array[index].x - poly2.array[index + 1].x) *
\r
193 (poly2.array[index + 1].y - y1) / (poly2.array[index + 1].y - poly2.array[index].y);
\r
195 newx2 = poly.array[0].x + (poly.array[0].x - poly.array[1].x) * (poly.array[0].y - y1) /
\r
196 (poly.array[1].y - poly.array[0].y);
\r
199 for(var i = 0; i < index; i++){
\r
202 poly2.set(0, newx1, newy1);
\r
203 poly.unshift(newx2, newy2);
\r
207 poly.concat(poly2);
\r
208 polygons.push(poly);
\r
211 for(tt = 0; tt <= 1000; tt = tt + kage.kRate){
\r
215 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
216 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
217 // KATAMUKI of vector by BIBUN
\r
218 ix = t * t * (-3 * x1 + 9 * sx1 + -9 * sx2 + 3 * x2) + t * (6 * x1 + -12 * sx1 + 6 * sx2) + -3 * x1 + 3 * sx1;
\r
219 iy = t * t * (-3 * y1 + 9 * sy1 + -9 * sy2 + 3 * y2) + t * (6 * y1 + -12 * sy1 + 6 * sy2) + -3 * y1 + 3 * sy1;
\r
221 // line SUICHOKU by vector
\r
222 if(ix != 0 && iy != 0){
\r
223 ir = Math.atan(iy / ix * -1);
\r
224 ia = Math.sin(ir) * (kage.kMinWidthT);
\r
225 ib = Math.cos(ir) * (kage.kMinWidthT);
\r
228 ia = kage.kMinWidthT;
\r
233 ib = kage.kMinWidthT;
\r
236 if(a1 == 7 && a2 == 0){ // L2RD: fatten
\r
237 deltad = Math.pow(t, hosomi) * kage.kL2RDfatten;
\r
240 deltad = Math.pow(t, hosomi);
\r
241 deltad = Math.pow(deltad, 0.7); // make fatten
\r
244 deltad = Math.pow(1.0 - t, hosomi);
\r
246 else{ deltad = 1; }
\r
254 //reverse if vector is going 2nd/3rd quadrants
\r
260 //copy to polygon structure
\r
261 poly.push(x - ia, y - ib);
\r
262 poly2.push(x + ia, y + ib);
\r
265 // suiheisen ni setsuzoku
\r
269 if(poly2.array[index].y <= y1 && y1 <= poly2.array[index + 1].y){
\r
274 newx1 = poly2.array[index + 1].x + (poly2.array[index].x - poly2.array[index + 1].x) *
\r
275 (poly2.array[index + 1].y - y1) / (poly2.array[index + 1].y - poly2.array[index].y);
\r
277 newx2 = poly.array[0].x + (poly.array[0].x - poly.array[1].x) * (poly.array[0].y - y1) /
\r
278 (poly.array[1].y - poly.array[0].y);
\r
281 for(var i = 0; i < index; i++){
\r
284 poly2.set(0, newx1, newy1);
\r
285 poly.unshift(newx2, newy2);
\r
289 poly.concat(poly2);
\r
290 polygons.push(poly);
\r
293 //process for head of stroke
\r
294 rad = Math.atan((sy1 - y1) / (sx1 - x1));
\r
295 if(x1 < sx1){ v = 1; } else{ v = -1; }
\r
296 XX = Math.sin(rad) * v;
\r
297 XY = Math.cos(rad) * v * -1;
\r
298 YX = Math.cos(rad) * v;
\r
299 YY = Math.sin(rad) * v;
\r
303 poly= new Polygon();
\r
304 poly.push(x1 - kage.kMinWidthT, y1);
\r
305 poly.push(x1 + kage.kMinWidthT, y1);
\r
306 poly.push(x1 - kage.kMinWidthT, y1 - kage.kMinWidthT);
\r
307 polygons.push(poly);
\r
310 poly = new Polygon();
\r
311 poly.push(x1 - kage.kMinWidthT * XX, y1 - kage.kMinWidthT * XY);
\r
312 poly.push(x1 + kage.kMinWidthT * XX, y1 + kage.kMinWidthT * XY);
\r
313 poly.push(x1 - kage.kMinWidthT * XX - kage.kMinWidthT * YX, y1 - kage.kMinWidthT * XY - kage.kMinWidthT * YY);
\r
314 polygons.push(poly);
\r
321 if(y1 <= y2){ //from up to bottom
\r
322 type = (Math.atan2(Math.abs(y1 - sy1), Math.abs(x1 - sx1)) / Math.PI * 2 - 0.4);
\r
334 poly = new Polygon();
\r
335 poly.push(x1 - kage.kMinWidthT, y1);
\r
336 poly.push(x1 + kage.kMinWidthT, y1);
\r
337 poly.push(x1 - kage.kMinWidthT * pm, y1 - kage.kMinWidthY * type * pm);
\r
338 polygons.push(poly);
\r
341 poly = new Polygon();
\r
342 poly.push(x1 - kage.kMinWidthT * XX, y1 - kage.kMinWidthT * XY);
\r
343 poly.push(x1 + kage.kMinWidthT * XX, y1 + kage.kMinWidthT * XY);
\r
344 poly.push(x1 - kage.kMinWidthT * pm * XX - kage.kMinWidthY * type * pm * YX, y1 - kage.kMinWidthT * pm * XY - kage.kMinWidthY * type * pm * YY);
\r
345 polygons.push(poly);
\r
348 else{ //bottom to up
\r
350 poly = new Polygon();
\r
351 poly.push(x1 - kage.kMinWidthT, y1);
\r
352 poly.push(x1 + kage.kMinWidthT, y1);
\r
353 poly.push(x1 + kage.kMinWidthT, y1 - kage.kMinWidthY);
\r
354 polygons.push(poly);
\r
357 poly = new Polygon();
\r
358 poly.push(x1 - kage.kMinWidthT * XX, y1 - kage.kMinWidthT * XY);
\r
359 poly.push(x1 + kage.kMinWidthT * XX, y1 + kage.kMinWidthT * XY);
\r
360 poly.push(x1 + kage.kMinWidthT * XX - kage.kMinWidthY * YX, y1 + kage.kMinWidthT * XY - kage.kMinWidthY * YY);
\r
361 polygons.push(poly);
\r
366 if(a1 == 22){ //box's up-right corner, any time same degree
\r
367 poly = new Polygon();
\r
368 poly.push(x1 - kage.kMinWidthT, y1 - kage.kMinWidthY);
\r
369 poly.push(x1, y1 - kage.kMinWidthY - kage.kWidth);
\r
370 poly.push(x1 + kage.kMinWidthT + kage.kWidth, y1 + kage.kMinWidthY);
\r
371 poly.push(x1 + kage.kMinWidthT, y1 + kage.kMinWidthT);
\r
372 poly.push(x1, y1 + kage.kMinWidthT);
\r
373 polygons.push(poly);
\r
376 if(a1 == 0){ //beginning of the stroke
\r
377 if(y1 <= y2){ //from up to bottom
\r
381 var move = kage.kMinWidthY * type * pm;
\r
383 poly = new Polygon();
\r
384 poly.push(x1 + kage.kMinWidthT, y1 - move);
\r
385 poly.push(x1 + kage.kMinWidthT * 1.5, y1 + kage.kMinWidthY - move);
\r
386 poly.push(x1 + kage.kMinWidthT * 0.5, y1 + kage.kMinWidthY * 3 - move / 2);
\r
387 polygons.push(poly);
\r
390 poly = new Polygon();
\r
391 poly.push(x1 + kage.kMinWidthT * XX - move * YX,
\r
392 y1 + kage.kMinWidthT * XY - move * YY);
\r
393 poly.push(x1 + kage.kMinWidthT * 1.5 * XX + (kage.kMinWidthY - move * 1.2) * YX,
\r
394 y1 + kage.kMinWidthT * 1.5 * XY + (kage.kMinWidthY - move * 1.2) * YY);
\r
395 poly.push(x1 + kage.kMinWidthT * 0.5 * XX + (kage.kMinWidthY * 3 - move * 0.8) * YX,
\r
396 y1 + kage.kMinWidthT * 0.5 * XY + (kage.kMinWidthY * 3 - move * 0.8) * YY);
\r
397 polygons.push(poly);
\r
400 else{ //from bottom to up
\r
402 poly = new Polygon();
\r
403 poly.push(x1 - kage.kMinWidthT, y1);
\r
404 poly.push(x1 - kage.kMinWidthT * 1.5, y1 + kage.kMinWidthY);
\r
405 poly.push(x1 - kage.kMinWidthT * 0.5, y1 + kage.kMinWidthY * 3);
\r
406 polygons.push(poly);
\r
409 poly = new Polygon();
\r
410 poly.push(x1 - kage.kMinWidthT * XX, y1 - kage.kMinWidthT * XY);
\r
411 poly.push(x1 - kage.kMinWidthT * 1.5 * XX + kage.kMinWidthY * YX, y1 + kage.kMinWidthY * YY - kage.kMinWidthT * 1.5 * XY);
\r
412 poly.push(x1 - kage.kMinWidthT * 0.5 * XX + kage.kMinWidthY * 3 * YX, y1 + kage.kMinWidthY * 3 * YY - kage.kMinWidthT * 0.5 * XY);
\r
413 polygons.push(poly);
\r
419 rad = Math.atan((y2 - sy2) / (x2 - sx2));
\r
420 if(sx2 < x2){ v = 1; } else{ v = -1; }
\r
421 YX = Math.sin(rad) * v * -1;
\r
422 YY = Math.cos(rad) * v;
\r
423 XX = Math.cos(rad) * v;
\r
424 XY = Math.sin(rad) * v;
\r
426 if(a2 == 1 || a2 == 8 || a2 == 15){ //the last filled circle ... it can change 15->5
\r
428 poly = new Polygon();
\r
429 if(kage.kUseCurve){
\r
431 poly.push(x2 - kage.kMinWidthT, y2);
\r
432 poly.push(x2 - kage.kMinWidthT, y2 + kage.kMinWidthT, 1);
\r
433 poly.push(x2, y2 + kage.kMinWidthT);
\r
434 poly.push(x2 + kage.kMinWidthT, y2 + kage.kMinWidthT, 1);
\r
435 poly.push(x2 + kage.kMinWidthT, y2);
\r
438 poly.push(x2 - kage.kMinWidthT, y2);
\r
439 poly.push(x2 - kage.kMinWidthT * 0.7, y2 + kage.kMinWidthT * 0.7);
\r
440 poly.push(x2, y2 + kage.kMinWidthT);
\r
441 poly.push(x2 + kage.kMinWidthT * 0.7, y2 + kage.kMinWidthT * 0.7);
\r
442 poly.push(x2 + kage.kMinWidthT, y2);
\r
444 polygons.push(poly);
\r
446 else if(sy2 == y2){
\r
447 poly = new Polygon();
\r
448 if(kage.kUseCurve){
\r
450 poly.push(x2 - kage.kMinWidthT, y2);
\r
451 poly.push(x2 - kage.kMinWidthT, y2 + kage.kMinWidthT, 1);
\r
452 poly.push(x2, y2 + kage.kMinWidthT);
\r
453 poly.push(x2 + kage.kMinWidthT, y2 + kage.kMinWidthT, 1);
\r
454 poly.push(x2 + kage.kMinWidthT, y2);
\r
457 poly.push(x2, y2 - kage.kMinWidthT);
\r
458 poly.push(x2 + kage.kMinWidthT * 0.7, y2 - kage.kMinWidthT * 0.7);
\r
459 poly.push(x2 + kage.kMinWidthT, y2);
\r
460 poly.push(x2 + kage.kMinWidthT * 0.7, y2 + kage.kMinWidthT * 0.7);
\r
461 poly.push(x2, y2 + kage.kMinWidthT);
\r
463 polygons.push(poly);
\r
466 poly = new Polygon();
\r
467 if(kage.kUseCurve){
\r
468 poly.push(x2 + Math.sin(rad) * kage.kMinWidthT * v, y2 - Math.cos(rad) * kage.kMinWidthT * v);
\r
469 poly.push(x2 + Math.cos(rad) * kage.kMinWidthT * 0.9 * v + Math.sin(rad) * kage.kMinWidthT * 0.9 * v,
\r
470 y2 + Math.sin(rad) * kage.kMinWidthT * 0.9 * v - Math.cos(rad) * kage.kMinWidthT * 0.9 * v, 1);
\r
471 poly.push(x2 + Math.cos(rad) * kage.kMinWidthT * v, y2 + Math.sin(rad) * kage.kMinWidthT * v);
\r
472 poly.push(x2 + Math.cos(rad) * kage.kMinWidthT * 0.9 * v - Math.sin(rad) * kage.kMinWidthT * 0.9 * v,
\r
473 y2 + Math.sin(rad) * kage.kMinWidthT * 0.9 * v + Math.cos(rad) * kage.kMinWidthT * 0.9 * v, 1);
\r
474 poly.push(x2 - Math.sin(rad) * kage.kMinWidthT * v, y2 + Math.cos(rad) * kage.kMinWidthT * v);
\r
476 poly.push(x2 + Math.sin(rad) * kage.kMinWidthT * v, y2 - Math.cos(rad) * kage.kMinWidthT * v);
\r
477 poly.push(x2 + Math.cos(rad) * kage.kMinWidthT * 0.7 * v + Math.sin(rad) * kage.kMinWidthT * 0.7 * v,
\r
478 y2 + Math.sin(rad) * kage.kMinWidthT * 0.7 * v - Math.cos(rad) * kage.kMinWidthT * 0.7 * v);
\r
479 poly.push(x2 + Math.cos(rad) * kage.kMinWidthT * v, y2 + Math.sin(rad) * kage.kMinWidthT * v);
\r
480 poly.push(x2 + Math.cos(rad) * kage.kMinWidthT * 0.7 * v - Math.sin(rad) * kage.kMinWidthT * 0.7 * v,
\r
481 y2 + Math.sin(rad) * kage.kMinWidthT * 0.7 * v + Math.cos(rad) * kage.kMinWidthT * 0.7 * v);
\r
482 poly.push(x2 - Math.sin(rad) * kage.kMinWidthT * v, y2 + Math.cos(rad) * kage.kMinWidthT * v);
\r
484 polygons.push(poly);
\r
488 if(a2 == 9 || (a1 == 7 && a2 == 0)){ // Math.sinnyu & L2RD Harai ... no need for a2=9
\r
489 var type = (Math.atan2(Math.abs(y2 - sy2), Math.abs(x2 - sx2)) / Math.PI * 2 - 0.6);
\r
502 poly = new Polygon();
\r
503 poly.push(x2, y2 + kage.kMinWidthT * kage.kL2RDfatten);
\r
504 poly.push(x2, y2 - kage.kMinWidthT * kage.kL2RDfatten);
\r
505 poly.push(x2 + kage.kMinWidthT * kage.kL2RDfatten * Math.abs(type), y2 + kage.kMinWidthT * kage.kL2RDfatten * pm);
\r
506 polygons.push(poly);
\r
509 poly = new Polygon();
\r
510 poly.push(x2 + kage.kMinWidthT * kage.kL2RDfatten * YX, y2 + kage.kMinWidthT * kage.kL2RDfatten * YY);
\r
511 poly.push(x2 - kage.kMinWidthT * kage.kL2RDfatten * YX, y2 - kage.kMinWidthT * kage.kL2RDfatten * YY);
\r
512 poly.push(x2 + kage.kMinWidthT * kage.kL2RDfatten * Math.abs(type) * XX + kage.kMinWidthT * kage.kL2RDfatten * pm * YX,
\r
513 y2 + kage.kMinWidthT * kage.kL2RDfatten * Math.abs(type) * XY + kage.kMinWidthT * kage.kL2RDfatten * pm * YY);
\r
514 polygons.push(poly);
\r
518 if(a2 == 15){ //jump up ... it can change 15->5
\r
520 poly = new Polygon();
\r
521 poly.push(x2, y2 - kage.kMinWidthT + 1);
\r
522 poly.push(x2 + 2, y2 - kage.kMinWidthT - kage.kWidth * 5);
\r
523 poly.push(x2, y2 - kage.kMinWidthT - kage.kWidth * 5);
\r
524 poly.push(x2 - kage.kMinWidthT, y2 - kage.kMinWidthT + 1);
\r
525 polygons.push(poly);
\r
528 poly = new Polygon();
\r
529 poly.push(x2 + (kage.kMinWidthT - 1) * Math.sin(rad) * v, y2 - (kage.kMinWidthT - 1) * Math.cos(rad) * v);
\r
530 poly.push(x2 + 2 * Math.cos(rad) * v + (kage.kMinWidthT + kage.kWidth * 5) * Math.sin(rad) * v,
\r
531 y2 + 2 * Math.sin(rad) * v - (kage.kMinWidthT + kage.kWidth * 5) * Math.cos(rad) * v);
\r
532 poly.push(x2 + (kage.kMinWidthT + kage.kWidth * 5) * Math.sin(rad) * v,
\r
533 y2 - (kage.kMinWidthT + kage.kWidth * 5) * Math.cos(rad) * v);
\r
534 poly.push(x2 + (kage.kMinWidthT - 1) * Math.sin(rad) * v - kage.kMinWidthT * Math.cos(rad) * v,
\r
535 y2 - (kage.kMinWidthT - 1) * Math.cos(rad) * v - kage.kMinWidthT * Math.sin(rad) * v);
\r
536 polygons.push(poly);
\r
540 if(a2 == 14){ //jump to left, allways go left ... it can change 14->4
\r
541 poly = new Polygon();
\r
543 poly.push(x2, y2 - kage.kMinWidthT);
\r
544 poly.push(x2 - kage.kWidth * 4, y2 - kage.kMinWidthT);
\r
545 poly.push(x2 - kage.kWidth * 4, y2 - kage.kMinWidthT * 0.5);
\r
546 polygons.push(poly);
\r
552 if(y1 < sy1){ y1 = y1 - kage.kWidth; } else{ y1 = y1 + kage.kWidth; }
\r
554 else if(y1 == sy1){
\r
555 if(x1 < sx1){ x1 = x1 - kage.kWidth; } else{ x1 = x1 + kage.kWidth; }
\r
558 rad = Math.atan((sy1 - y1) / (sx1 - x1));
\r
559 if(x1 < sx1){ v = 1; } else{ v = -1; }
\r
560 x1 = x1 - kage.kWidth * Math.cos(rad) * v;
\r
561 y1 = y1 - kage.kWidth * Math.sin(rad) * v;
\r
568 y1 = y1 - kage.kWidth * kage.kKakato;
\r
571 y1 = y1 + kage.kWidth * kage.kKakato;
\r
574 else if(y1 == sy1){
\r
576 x1 = x1 - kage.kWidth * kage.kKakato;
\r
579 x1 = x1 + kage.kWidth * kage.kKakato;
\r
583 rad = Math.atan((sy1 - y1) / (sx1 - x1));
\r
584 if(x1 < sx1){ v = 1; } else{ v = -1; }
\r
585 x1 = x1 - kage.kWidth * Math.cos(rad) * v * kage.kKakato;
\r
586 y1 = y1 - kage.kWidth * Math.sin(rad) * v * kage.kKakato;
\r
591 if(sy2 < y2){ y2 = y2 + kage.kWidth; } else{ y2 = y2 - kage.kWidth; }
\r
593 else if(sy2 == y2){
\r
594 if(sx2 < x2){ x2 = x2 + kage.kWidth; } else{ x2 = x2 - kage.kWidth; }
\r
597 rad = Math.atan((y2 - sy2) / (x2 - sx2));
\r
598 if(sx2 < x2){ v = 1; } else{ v = -1; }
\r
599 x2 = x2 + kage.kWidth * Math.cos(rad) * v;
\r
600 y2 = y2 + kage.kWidth * Math.sin(rad) * v;
\r
607 y2 = y2 + kage.kWidth * kage.kKakato;
\r
610 y2 = y2 - kage.kWidth * kage.kKakato;
\r
613 else if(sy2 == y2){
\r
615 x2 = x2 + kage.kWidth * kage.kKakato;
\r
618 x2 = x2 - kage.kWidth * kage.kKakato;
\r
622 rad = Math.atan((y2 - sy2) / (x2 - sx2));
\r
623 if(sx2 < x2){ v = 1; } else{ v = -1; }
\r
624 x2 = x2 + kage.kWidth * Math.cos(rad) * v * kage.kKakato;
\r
625 y2 = y2 + kage.kWidth * Math.sin(rad) * v * kage.kKakato;
\r
629 poly = new Polygon();
\r
630 poly2 = new Polygon();
\r
632 for(tt = 0; tt <= 1000; tt = tt + kage.kRate){
\r
635 if(sx1 == sx2 && sy1 == sy2){
\r
636 //calculating each point
\r
637 x = ((1.0 - t) * (1.0 - t) * x1 + 2.0 * t * (1.0 - t) * sx1 + t * t * x2);
\r
638 y = ((1.0 - t) * (1.0 - t) * y1 + 2.0 * t * (1.0 - t) * sy1 + t * t * y2);
\r
640 //SESSEN NO KATAMUKI NO KEISAN(BIBUN)
\r
641 ix = (x1 - 2.0 * sx1 + x2) * 2.0 * t + (-2.0 * x1 + 2.0 * sx1);
\r
642 iy = (y1 - 2.0 * sy1 + y2) * 2.0 * t + (-2.0 * y1 + 2.0 * sy1);
\r
645 //SESSEN NI SUICHOKU NA CHOKUSEN NO KEISAN
\r
646 if(kage.kShotai == kage.kMincho){ //always false ?
\r
647 if(ix != 0 && iy != 0){
\r
648 ir = Math.atan(iy / ix * -1.0);
\r
649 ia = Math.sin(ir) * kage.kMinWidthT;
\r
650 ib = Math.cos(ir) * kage.kMinWidthT;
\r
653 ia = kage.kMinWidthT;
\r
658 ib = kage.kMinWidthT;
\r
660 ia = ia * Math.sqrt(1.0 - t);
\r
661 ib = ib * Math.sqrt(1.0 - t);
\r
664 if(ix != 0 && iy != 0){
\r
665 ir = Math.atan(iy / ix * -1.0);
\r
666 ia = Math.sin(ir) * kage.kWidth;
\r
667 ib = Math.cos(ir) * kage.kWidth;
\r
679 //reverse if vector is going 2nd/3rd quadrants
\r
686 poly.push(x - ia, y - ib);
\r
687 poly2.push(x + ia, y + ib);
\r
691 poly.concat(poly2);
\r
692 polygons.push(poly);
\r
696 function cdDrawBezier(kage, polygons, x1, y1, x2, y2, x3, y3, x4, y4, a1, a2){
\r
697 cdDrawCurveU(kage, polygons, x1, y1, x2, y2, x3, y3, x4, y4, a1, a2);
\r
700 function cdDrawCurve(kage, polygons, x1, y1, x2, y2, x3, y3, a1, a2){
\r
701 cdDrawCurveU(kage, polygons, x1, y1, x2, y2, x2, y2, x3, y3, a1, a2);
\r
704 function cdDrawLine(kage, polygons, tx1, ty1, tx2, ty2, ta1, ta2){
\r
706 var v, x1, y1, x2, y2;
\r
707 var a1, a2, opt1, opt2;
\r
708 var XX, XY, YX, YY;
\r
711 if(kage.kShotai == kage.kMincho){ //mincho
\r
718 opt1 = Math.floor(ta1 / 100);
\r
719 opt2 = Math.floor(ta2 / 100);
\r
721 if(x1 == x2){ //if TATE stroke, use y-axis
\r
722 poly = new Polygon(4);
\r
725 poly.set(3, x1 - kage.kMinWidthT, y1 - kage.kMinWidthY / 2);
\r
726 poly.set(0, x1 + kage.kMinWidthT, y1 + kage.kMinWidthY / 2);
\r
729 case 6: //... no need
\r
731 poly.set(3, x1 - kage.kMinWidthT, y1);
\r
732 poly.set(0, x1 + kage.kMinWidthT, y1);
\r
735 poly.set(3, x1 - kage.kMinWidthT, y1 - kage.kMinWidthY - kage.kMinWidthT);
\r
736 poly.set(0, x1 + kage.kMinWidthT, y1 - kage.kMinWidthY);
\r
739 poly.set(3, x1 - kage.kMinWidthT, y1 - kage.kMinWidthY);
\r
740 poly.set(0, x1 + kage.kMinWidthT, y1 - kage.kMinWidthY);
\r
746 if(a1 == 6){ //KAGI's tail ... no need
\r
747 poly.set(2, x2 - kage.kMinWidthT, y2);
\r
748 poly.set(1, x2 + kage.kMinWidthT, y2);
\r
751 poly.set(2, x2 - kage.kMinWidthT, y2 + kage.kMinWidthT / 2);
\r
752 poly.set(1, x2 + kage.kMinWidthT, y2 - kage.kMinWidthT / 2);
\r
756 poly.set(2, x2 - kage.kMinWidthT, y2);
\r
757 poly.set(1, x2 + kage.kMinWidthT, y2);
\r
760 poly.set(2, x2 - kage.kMinWidthT, y2 + kage.kAdjustKakatoL[opt2] + kage.kMinWidthT);
\r
761 poly.set(1, x2 + kage.kMinWidthT, y2 + kage.kAdjustKakatoL[opt2]);
\r
764 poly.set(2, x2 - kage.kMinWidthT, y2 + kage.kAdjustKakatoR[opt2] + kage.kMinWidthT);
\r
765 poly.set(1, x2 + kage.kMinWidthT, y2 + kage.kAdjustKakatoR[opt2]);
\r
768 poly.set(2, x2 - kage.kMinWidthT, y2 + kage.kMinWidthY);
\r
769 poly.set(1, x2 + kage.kMinWidthT, y2 + kage.kMinWidthY);
\r
773 polygons.push(poly);
\r
775 if(a1 == 22){ //box's right top corner
\r
776 poly = new Polygon();
\r
777 poly.push(x1 - kage.kMinWidthT, y1 - kage.kMinWidthY);
\r
778 poly.push(x1, y1 - kage.kMinWidthY - kage.kWidth);
\r
779 poly.push(x1 + kage.kMinWidthT + kage.kWidth, y1 + kage.kMinWidthY);
\r
780 poly.push(x1 + kage.kMinWidthT, y1 + kage.kMinWidthT);
\r
781 poly.push(x1 - kage.kMinWidthT, y1);
\r
782 polygons.push(poly);
\r
785 if(a1 == 0){ //beginning of the stroke
\r
786 poly = new Polygon();
\r
787 poly.push(x1 + kage.kMinWidthT, y1 + kage.kMinWidthY * 0.5);
\r
788 poly.push(x1 + kage.kMinWidthT + kage.kMinWidthT * 0.5, y1 + kage.kMinWidthY * 0.5 + kage.kMinWidthY);
\r
789 poly.push(x1 + kage.kMinWidthT, y1 + kage.kMinWidthY * 0.5 + kage.kMinWidthY * 2);
\r
790 polygons.push(poly);
\r
793 if((a1 == 6 && a2 == 0) || a2 == 1){ //KAGI NO YOKO BOU NO SAIGO NO MARU ... no need only used at 1st=yoko
\r
794 poly = new Polygon();
\r
795 poly.push(x2 - kage.kMinWidthT, y2);
\r
796 poly.push(x2 - kage.kMinWidthT * 0.6, y2 + kage.kMinWidthT * 0.6);
\r
797 poly.push(x2, y2 + kage.kMinWidthT);
\r
798 poly.push(x2 + kage.kMinWidthT * 0.6, y2 + kage.kMinWidthT * 0.6);
\r
799 poly.push(x2 + kage.kMinWidthT, y2);
\r
800 poly.reverse(); // for fill-rule
\r
801 polygons.push(poly);
\r
804 else if(y1 == y2){ //if it is YOKO stroke, use x-axis
\r
805 if(a1 == 6){ //if it is KAGI's YOKO stroke, get bold
\r
806 poly = new Polygon();
\r
807 poly.push(x1, y1 - kage.kMinWidthT);
\r
808 poly.push(x2, y2 - kage.kMinWidthT);
\r
809 poly.push(x2, y2 + kage.kMinWidthT);
\r
810 poly.push(x1, y1 + kage.kMinWidthT);
\r
811 polygons.push(poly);
\r
813 if(a2 == 1 || a2 == 0 || a2 == 5){ // no need a2=1
\r
814 //KAGI NO YOKO BOU NO SAIGO NO MARU
\r
815 poly = new Polygon();
\r
816 poly.push(x2, y2 - kage.kMinWidthT);
\r
817 poly.push(x2 + kage.kMinWidthT * 0.6, y2 - kage.kMinWidthT * 0.6);
\r
818 poly.push(x2 + kage.kMinWidthT, y2);
\r
819 poly.push(x2 + kage.kMinWidthT * 0.6, y2 + kage.kMinWidthT * 0.6);
\r
820 poly.push(x2, y2 + kage.kMinWidthT);
\r
821 polygons.push(poly);
\r
825 //KAGI NO YOKO BOU NO HANE
\r
826 poly = new Polygon();
\r
827 poly.push(x2, y2 - kage.kMinWidthT + 1);
\r
828 poly.push(x2 + 2, y2 - kage.kMinWidthT - kage.kWidth * 5);
\r
829 poly.push(x2, y2 - kage.kMinWidthT - kage.kWidth * 5);
\r
830 poly.push(x2 - kage.kMinWidthT, y2 - kage.kMinWidthT + 1);
\r
831 poly.reverse(); // for fill-rule
\r
832 polygons.push(poly);
\r
837 poly = new Polygon(4);
\r
838 poly.set(0, x1, y1 - kage.kMinWidthY);
\r
839 poly.set(1, x2, y2 - kage.kMinWidthY);
\r
840 poly.set(2, x2, y2 + kage.kMinWidthY);
\r
841 poly.set(3, x1, y1 + kage.kMinWidthY);
\r
842 polygons.push(poly);
\r
846 poly = new Polygon();
\r
847 poly.push(x2, y2 - kage.kMinWidthY);
\r
848 poly.push(x2 - kage.kAdjustUrokoX[opt2], y2);
\r
849 poly.push(x2 - kage.kAdjustUrokoX[opt2] / 2, y2 - kage.kAdjustUrokoY[opt2]);
\r
850 polygons.push(poly);
\r
854 else{ //for others, use x-axis
\r
855 rad = Math.atan((y2 - y1) / (x2 - x1));
\r
856 if((Math.abs(y2 - y1) < Math.abs(x2 - x1)) && (a1 != 6) && (a2 != 6) && !(x1 > x2)){ //ASAI KAUDO
\r
858 poly = new Polygon(4);
\r
859 poly.set(0, x1 + Math.sin(rad) * kage.kMinWidthY, y1 - Math.cos(rad) * kage.kMinWidthY);
\r
860 poly.set(1, x2 + Math.sin(rad) * kage.kMinWidthY, y2 - Math.cos(rad) * kage.kMinWidthY);
\r
861 poly.set(2, x2 - Math.sin(rad) * kage.kMinWidthY, y2 + Math.cos(rad) * kage.kMinWidthY);
\r
862 poly.set(3, x1 - Math.sin(rad) * kage.kMinWidthY, y1 + Math.cos(rad) * kage.kMinWidthY);
\r
863 polygons.push(poly);
\r
867 poly = new Polygon();
\r
868 poly.push(x2 + Math.sin(rad) * kage.kMinWidthY, y2 - Math.cos(rad) * kage.kMinWidthY);
\r
869 poly.push(x2 - Math.cos(rad) * kage.kAdjustUrokoX[opt2], y2 - Math.sin(rad) * kage.kAdjustUrokoX[opt2]);
\r
870 poly.push(x2 - Math.cos(rad) * kage.kAdjustUrokoX[opt2] / 2 + Math.sin(rad) * kage.kAdjustUrokoX[opt2] / 2, y2 - Math.sin(rad) * kage.kAdjustUrokoY[opt2] - Math.cos(rad) * kage.kAdjustUrokoY[opt2]);
\r
871 polygons.push(poly);
\r
875 else{ //KAKUDO GA FUKAI or KAGI NO YOKO BOU
\r
876 if(x1 > x2){ v = -1; } else{ v = 1; }
\r
877 poly = new Polygon(4);
\r
880 poly.set(0, x1 + Math.sin(rad) * kage.kMinWidthT * v + kage.kMinWidthY * Math.cos(rad) * 0.5 * v,
\r
881 y1 - Math.cos(rad) * kage.kMinWidthT * v + kage.kMinWidthY * Math.sin(rad) * 0.5 * v);
\r
882 poly.set(3, x1 - Math.sin(rad) * kage.kMinWidthT * v - kage.kMinWidthY * Math.cos(rad) * 0.5 * v,
\r
883 y1 + Math.cos(rad) * kage.kMinWidthT * v - kage.kMinWidthY * Math.sin(rad) * 0.5 * v);
\r
888 poly.set(0, x1 + Math.sin(rad) * kage.kMinWidthT * v, y1 - Math.cos(rad) * kage.kMinWidthT * v);
\r
889 poly.set(3, x1 - Math.sin(rad) * kage.kMinWidthT * v, y1 + Math.cos(rad) * kage.kMinWidthT * v);
\r
892 poly.set(0, x1 + Math.sin(rad) * kage.kMinWidthT * v - kage.kMinWidthY * Math.cos(rad) * v,
\r
893 y1 - Math.cos(rad) * kage.kMinWidthT * v - kage.kMinWidthY * Math.sin(rad) * v);
\r
894 poly.set(3, x1 - Math.sin(rad) * kage.kMinWidthT * v - (kage.kMinWidthT + kage.kMinWidthY) * Math.cos(rad) * v,
\r
895 y1 + Math.cos(rad) * kage.kMinWidthT * v - (kage.kMinWidthT + kage.kMinWidthY) * Math.sin(rad) * v);
\r
898 poly.set(0, x1 + Math.sin(rad) * kage.kMinWidthT * v - kage.kMinWidthY * Math.cos(rad) * v,
\r
899 y1 - Math.cos(rad) * kage.kMinWidthT * v - kage.kMinWidthY * Math.sin(rad) * v);
\r
900 poly.set(3, x1 - Math.sin(rad) * kage.kMinWidthT * v - kage.kMinWidthY * Math.cos(rad) * v,
\r
901 y1 + Math.cos(rad) * kage.kMinWidthT * v - kage.kMinWidthY * Math.sin(rad) * v);
\r
908 poly.set(1, x2 + Math.sin(rad) * kage.kMinWidthT * v, y2 - Math.cos(rad) * kage.kMinWidthT * v);
\r
909 poly.set(2, x2 - Math.sin(rad) * kage.kMinWidthT * v, y2 + Math.cos(rad) * kage.kMinWidthT * v);
\r
912 poly.set(1, x2 + Math.sin(rad) * kage.kMinWidthT * v - kage.kMinWidthT * 0.5 * Math.cos(rad) * v,
\r
913 y2 - Math.cos(rad) * kage.kMinWidthT * v - kage.kMinWidthT * 0.5 * Math.sin(rad) * v);
\r
914 poly.set(2, x2 - Math.sin(rad) * kage.kMinWidthT * v + kage.kMinWidthT * 0.5 * Math.cos(rad) * v,
\r
915 y2 + Math.cos(rad) * kage.kMinWidthT * v + kage.kMinWidthT * 0.5 * Math.sin(rad) * v);
\r
918 case 1: // is needed?
\r
920 poly.set(1, x2 + Math.sin(rad) * kage.kMinWidthT * v, y2 - Math.cos(rad) * kage.kMinWidthT * v);
\r
921 poly.set(2, x2 - Math.sin(rad) * kage.kMinWidthT * v, y2 + Math.cos(rad) * kage.kMinWidthT * v);
\r
924 poly.set(1, x2 + Math.sin(rad) * kage.kMinWidthT * v + kage.kAdjustKakatoL[opt2] * Math.cos(rad) * v,
\r
925 y2 - Math.cos(rad) * kage.kMinWidthT * v + kage.kAdjustKakatoL[opt2] * Math.sin(rad) * v);
\r
926 poly.set(2, x2 - Math.sin(rad) * kage.kMinWidthT * v + (kage.kAdjustKakatoL[opt2] + kage.kMinWidthT) * Math.cos(rad) * v,
\r
927 y2 + Math.cos(rad) * kage.kMinWidthT * v + (kage.kAdjustKakatoL[opt2] + kage.kMinWidthT) * Math.sin(rad) * v);
\r
930 poly.set(1, x2 + Math.sin(rad) * kage.kMinWidthT * v + kage.kAdjustKakatoR[opt2] * Math.cos(rad) * v,
\r
931 y2 - Math.cos(rad) * kage.kMinWidthT * v + kage.kAdjustKakatoR[opt2] * Math.sin(rad) * v);
\r
933 x2 - Math.sin(rad) * kage.kMinWidthT * v + (kage.kAdjustKakatoR[opt2] + kage.kMinWidthT) * Math.cos(rad) * v,
\r
934 y2 + Math.cos(rad) * kage.kMinWidthT * v + (kage.kAdjustKakatoR[opt2] + kage.kMinWidthT) * Math.sin(rad) * v);
\r
937 poly.set(1, x2 + Math.sin(rad) * kage.kMinWidthT * v + kage.kMinWidthY * Math.cos(rad) * v,
\r
938 y2 - Math.cos(rad) * kage.kMinWidthT * v + kage.kMinWidthY * Math.sin(rad) * v);
\r
939 poly.set(2, x2 - Math.sin(rad) * kage.kMinWidthT * v + kage.kMinWidthY * Math.cos(rad) * v,
\r
940 y2 + Math.cos(rad) * kage.kMinWidthT * v + kage.kMinWidthY * Math.sin(rad) * v);
\r
944 polygons.push(poly);
\r
946 if((a1 == 6) && (a2 == 0 || a2 == 5)){ //KAGI NO YOKO BOU NO SAIGO NO MARU
\r
947 poly = new Polygon();
\r
948 poly.push(x2 + Math.sin(rad) * kage.kMinWidthT * v, y2 - Math.cos(rad) * kage.kMinWidthT * v);
\r
949 poly.push(x2 + Math.cos(rad) * kage.kMinWidthT * 0.8 * v + Math.sin(rad) * kage.kMinWidthT * 0.6 * v,
\r
950 y2 + Math.sin(rad) * kage.kMinWidthT * 0.8 * v - Math.cos(rad) * kage.kMinWidthT * 0.6 * v);
\r
951 poly.push(x2 + Math.cos(rad) * kage.kMinWidthT * v, y2 + Math.sin(rad) * kage.kMinWidthT * v);
\r
952 poly.push(x2 + Math.cos(rad) * kage.kMinWidthT * 0.8 * v - Math.sin(rad) * kage.kMinWidthT * 0.6 * v,
\r
953 y2 + Math.sin(rad) * kage.kMinWidthT * 0.8 * v + Math.cos(rad) * kage.kMinWidthT * 0.6 * v);
\r
954 poly.push(x2 - Math.sin(rad) * kage.kMinWidthT * v, y2 + Math.cos(rad) * kage.kMinWidthT * v);
\r
955 polygons.push(poly);
\r
958 if(a1 == 6 && a2 == 5){
\r
959 //KAGI NO YOKO BOU NO HANE
\r
960 poly = new Polygon();
\r
961 poly.push(x2 + (kage.kMinWidthT - 1) * Math.sin(rad) * v, y2 - (kage.kMinWidthT - 1) * Math.cos(rad) * v);
\r
962 poly.push(x2 + 2 * Math.cos(rad) * v + (kage.kMinWidthT + kage.kWidth * 5) * Math.sin(rad) * v,
\r
963 y2 + 2 * Math.sin(rad) * v - (kage.kMinWidthT + kage.kWidth * 5) * Math.cos(rad) * v);
\r
964 poly.push(x2 + (kage.kMinWidthT + kage.kWidth * 5) * Math.sin(rad) * v,
\r
965 y2 - (kage.kMinWidthT + kage.kWidth * 5) * Math.cos(rad) * v);
\r
966 poly.push(x2 + (kage.kMinWidthT - 1) * Math.sin(rad) * v - kage.kMinWidthT * Math.cos(rad) * v,
\r
967 y2 - (kage.kMinWidthT - 1) * Math.cos(rad) * v - kage.kMinWidthT * Math.sin(rad) * v);
\r
968 polygons.push(poly);
\r
971 if(a1 == 22){ //SHIKAKU MIGIUE UROKO NANAME DEMO MASSUGU MUKI
\r
972 poly = new Polygon();
\r
973 poly.push(x1 - kage.kMinWidthT, y1 - kage.kMinWidthY);
\r
974 poly.push(x1, y1 - kage.kMinWidthY - kage.kWidth);
\r
975 poly.push(x1 + kage.kMinWidthT + kage.kWidth, y1 + kage.kMinWidthY);
\r
976 poly.push(x1 + kage.kMinWidthT, y1 + kage.kMinWidthT);
\r
977 poly.push(x1 - kage.kMinWidthT, y1);
\r
978 polygons.push(poly);
\r
981 XX = Math.sin(rad) * v;
\r
982 XY = Math.cos(rad) * v * -1;
\r
983 YX = Math.cos(rad) * v;
\r
984 YY = Math.sin(rad) * v;
\r
986 if(a1 == 0){ //beginning of the storke
\r
987 poly = new Polygon();
\r
988 poly.push(x1 + kage.kMinWidthT * XX + (kage.kMinWidthY * 0.5) * YX,
\r
989 y1 + kage.kMinWidthT * XY + (kage.kMinWidthY * 0.5) * YY);
\r
990 poly.push(x1 + (kage.kMinWidthT + kage.kMinWidthT * 0.5) * XX + (kage.kMinWidthY * 0.5 + kage.kMinWidthY) * YX,
\r
991 y1 + (kage.kMinWidthT + kage.kMinWidthT * 0.5) * XY + (kage.kMinWidthY * 0.5 + kage.kMinWidthY) * YY);
\r
992 poly.push(x1 + kage.kMinWidthT * XX + (kage.kMinWidthY * 0.5 + kage.kMinWidthY * 2) * YX,
\r
993 y1 + kage.kMinWidthT * XY + (kage.kMinWidthY * 0.5 + kage.kMinWidthY * 2) * YY);
\r
994 polygons.push(poly);
\r
1000 if(tx1 == tx2){ //if TATE stroke, use y-axis
\r
1018 if(a1 % 10 == 2){ y1 = y1 - kage.kWidth; }
\r
1019 if(a2 % 10 == 2){ y2 = y2 + kage.kWidth; }
\r
1020 if(a1 % 10 == 3){ y1 = y1 - kage.kWidth * kage.kKakato; }
\r
1021 if(a2 % 10 == 3){ y2 = y2 + kage.kWidth * kage.kKakato; }
\r
1023 poly = new Polygon();
\r
1024 poly.push(x1 - kage.kWidth, y1);
\r
1025 poly.push(x2 - kage.kWidth, y2);
\r
1026 poly.push(x2 + kage.kWidth, y2);
\r
1027 poly.push(x1 + kage.kWidth, y1);
\r
1028 poly.reverse(); // for fill-rule
\r
1030 polygons.push(poly);
\r
1032 else if(ty1 == ty2){ //if YOKO stroke, use x-axis
\r
1049 if(a1 % 10 == 2){ x1 = x1 - kage.kWidth; }
\r
1050 if(a2 % 10 == 2){ x2 = x2 + kage.kWidth; }
\r
1051 if(a1 % 10 == 3){ x1 = x1 - kage.kWidth * kage.kKakato; }
\r
1052 if(a2 % 10 == 3){ x2 = x2 + kage.kWidth * kage.kKakato; }
\r
1054 poly = new Polygon();
\r
1055 poly.push(x1, y1 - kage.kWidth);
\r
1056 poly.push(x2, y2 - kage.kWidth);
\r
1057 poly.push(x2, y2 + kage.kWidth);
\r
1058 poly.push(x1, y1 + kage.kWidth);
\r
1060 polygons.push(poly);
\r
1062 else{ //for others, use x-axis
\r
1079 rad = Math.atan((y2 - y1) / (x2 - x1));
\r
1081 x1 = x1 - kage.kWidth * Math.cos(rad);
\r
1082 y1 = y1 - kage.kWidth * Math.sin(rad);
\r
1085 x2 = x2 + kage.kWidth * Math.cos(rad);
\r
1086 y2 = y2 + kage.kWidth * Math.sin(rad);
\r
1089 x1 = x1 - kage.kWidth * Math.cos(rad) * kage.kKakato;
\r
1090 y1 = y1 - kage.kWidth * Math.sin(rad) * kage.kKakato;
\r
1093 x2 = x2 + kage.kWidth * Math.cos(rad) * kage.kKakato;
\r
1094 y2 = y2 + kage.kWidth * Math.sin(rad) * kage.kKakato;
\r
1097 //SUICHOKU NO ICHI ZURASHI HA Math.sin TO Math.cos NO IREKAE + x-axis MAINASU KA
\r
1098 poly = new Polygon();
\r
1099 poly.push(x1 + Math.sin(rad) * kage.kWidth, y1 - Math.cos(rad) * kage.kWidth);
\r
1100 poly.push(x2 + Math.sin(rad) * kage.kWidth, y2 - Math.cos(rad) * kage.kWidth);
\r
1101 poly.push(x2 - Math.sin(rad) * kage.kWidth, y2 + Math.cos(rad) * kage.kWidth);
\r
1102 poly.push(x1 - Math.sin(rad) * kage.kWidth, y1 + Math.cos(rad) * kage.kWidth);
\r
1104 polygons.push(poly);
\r