1 function cdDrawCurveU(kage, polygons, x1, y1, sx1, sy1, sx2, sy2, x2, y2, ta1, ta2){
\r
4 var ix, iy, ia, ib, ir;
\r
11 var kMinWidthT, kMinWidthT2;
\r
12 var a1, a2, opt1, opt2, opt3;
\r
14 if(kage.kShotai == kage.kMincho){ // mincho
\r
17 opt1 = Math.floor((ta1 % 10000) / 1000);
\r
18 opt2 = Math.floor(ta2 / 100);
\r
19 opt3 = Math.floor(ta1 / 10000);
\r
21 kMinWidthT = kage.kMinWidthT - opt1 / 2;
\r
22 kMinWidthT2 = kage.kMinWidthT - opt3 / 2;
\r
27 delta = -1 * kage.kMinWidthY * 0.5;
\r
30 case 2: // ... must be 32
\r
38 delta = kage.kMinWidthY;
\r
45 if(y1 < sy1){ y1 = y1 - delta; }
\r
46 else{ y1 = y1 + delta; }
\r
49 if(x1 < sx1){ x1 = x1 - delta; }
\r
50 else{ x1 = x1 + delta; }
\r
53 rad = Math.atan((sy1 - y1) / (sx1 - x1));
\r
54 if(x1 < sx1){ v = 1; } else{ v = -1; }
\r
55 x1 = x1 - delta * Math.cos(rad) * v;
\r
56 y1 = y1 - delta * Math.sin(rad) * v;
\r
64 case 15: // it can change to 15->5
\r
65 case 14: // it can change to 14->4
\r
70 case 8: // get shorten for tail's circle
\r
71 delta = -1 * kMinWidthT * 0.5;
\r
78 if(sy2 < y2){ y2 = y2 + delta; }
\r
79 else{ y2 = y2 - delta; }
\r
82 if(sx2 < x2){ x2 = x2 + delta; }
\r
83 else{ x2 = x2 - delta; }
\r
86 rad = Math.atan((y2 - sy2) / (x2 - sx2));
\r
87 if(sx2 < x2){ v = 1; } else{ v = -1; }
\r
88 x2 = x2 + delta * Math.cos(rad) * v;
\r
89 y2 = y2 + delta * Math.sin(rad) * v;
\r
93 if(Math.sqrt((x2 - x1) * (x2 - x1) + (y2 - y1) * (y2 - y1)) < 50){
\r
94 hosomi += 0.4 * (1 - Math.sqrt((x2 - x1) * (x2 - x1) + (y2 - y1) * (y2 - y1)) / 50);
\r
97 //---------------------------------------------------------------
\r
99 poly = new Polygon();
\r
100 poly2 = new Polygon();
\r
102 if(sx1 == sx2 && sy1 == sy2){ // Spline
\r
103 if(kage.kUseCurve){
\r
104 // generating fatten curve -- begin
\r
105 var kage2 = new Kage();
\r
106 kage2.kMinWidthY = kage.kMinWidthY;
\r
107 kage2.kMinWidthT = kMinWidthT;
\r
108 kage2.kWidth = kage.kWidth;
\r
109 kage2.kKakato = kage.kKakato;
\r
112 var curve = new Array(2); // L and R
\r
113 get_candidate(kage2, curve, a1, a2, x1, y1, sx1, sy1, x2, y2, opt3);
\r
115 var dcl12_34 = new Array(2);
\r
116 var dcr12_34 = new Array(2);
\r
117 var dpl12_34 = new Array(2);
\r
118 var dpr12_34 = new Array(2);
\r
119 divide_curve(kage2, x1, y1, sx1, sy1, x2, y2, curve[0], dcl12_34, dpl12_34);
\r
120 divide_curve(kage2, x1, y1, sx1, sy1, x2, y2, curve[1], dcr12_34, dpr12_34);
\r
122 var ncl1 = new Array(7);
\r
123 var ncl2 = new Array(7);
\r
124 find_offcurve(kage2, dcl12_34[0], dpl12_34[0][2], dpl12_34[0][3], ncl1);
\r
125 find_offcurve(kage2, dcl12_34[1], dpl12_34[1][2], dpl12_34[1][3], ncl2);
\r
127 poly.push(ncl1[0], ncl1[1]);
\r
128 poly.push(ncl1[2], ncl1[3], 1);
\r
129 poly.push(ncl1[4], ncl1[5]);
\r
130 poly.push(ncl2[2], ncl2[3], 1);
\r
131 poly.push(ncl2[4], ncl2[5]);
\r
133 poly2.push(dcr12_34[0][0][0], dcr12_34[0][0][1]);
\r
134 poly2.push(dpr12_34[0][2] - (ncl1[2] - dpl12_34[0][2]), dpl12_34[0][3] - (ncl1[3] - dpl12_34[0][3]), 1);
\r
135 poly2.push(dcr12_34[0][dcr12_34[0].length - 1][0], dcr12_34[0][dcr12_34[0].length - 1][1]);
\r
136 poly2.push(dpr12_34[1][2] - (ncl2[2] - dpl12_34[1][2]), dpl12_34[1][3] - (ncl2[3] - dpl12_34[1][3]), 1);
\r
137 poly2.push(dcr12_34[1][dcr12_34[1].length - 1][0], dcr12_34[1][dcr12_34[1].length - 1][1]);
\r
140 poly.concat(poly2);
\r
141 polygons.push(poly);
\r
142 // generating fatten curve -- end
\r
144 for(tt = 0; tt <= 1000; tt = tt + kage.kRate){
\r
148 x = ((1.0 - t) * (1.0 - t) * x1 + 2.0 * t * (1.0 - t) * sx1 + t * t * x2);
\r
149 y = ((1.0 - t) * (1.0 - t) * y1 + 2.0 * t * (1.0 - t) * sy1 + t * t * y2);
\r
151 // KATAMUKI of vector by BIBUN
\r
152 ix = (x1 - 2.0 * sx1 + x2) * 2.0 * t + (-2.0 * x1 + 2.0 * sx1);
\r
153 iy = (y1 - 2.0 * sy1 + y2) * 2.0 * t + (-2.0 * y1 + 2.0 * sy1);
\r
155 // line SUICHOKU by vector
\r
156 if(ix != 0 && iy != 0){
\r
157 ir = Math.atan(iy / ix * -1);
\r
158 ia = Math.sin(ir) * (kMinWidthT);
\r
159 ib = Math.cos(ir) * (kMinWidthT);
\r
170 if(a1 == 7 && a2 == 0){ // L2RD: fatten
\r
171 deltad = Math.pow(t, hosomi) * kage.kL2RDfatten;
\r
174 deltad = Math.pow(t, hosomi);
\r
177 deltad = Math.pow(1.0 - t, hosomi);
\r
180 deltad = ((kage.kMinWidthT - opt3 / 2) / kage.kMinWidthT) + opt3 / 2 / kage.kMinWidthT * t;
\r
182 else{ deltad = 1; }
\r
190 //reverse if vector is going 2nd/3rd quadrants
\r
196 //copy to polygon structure
\r
197 poly.push(x - ia, y - ib);
\r
198 poly2.push(x + ia, y + ib);
\r
201 // suiheisen ni setsuzoku
\r
205 if(poly2.array[index].y <= y1 && y1 <= poly2.array[index + 1].y){
\r
210 newx1 = poly2.array[index + 1].x + (poly2.array[index].x - poly2.array[index + 1].x) *
\r
211 (poly2.array[index + 1].y - y1) / (poly2.array[index + 1].y - poly2.array[index].y);
\r
213 newx2 = poly.array[0].x + (poly.array[0].x - poly.array[1].x) * (poly.array[0].y - y1) /
\r
214 (poly.array[1].y - poly.array[0].y);
\r
217 for(var i = 0; i < index; i++){
\r
220 poly2.set(0, newx1, newy1);
\r
221 poly.unshift(newx2, newy2);
\r
224 // suiheisen ni setsuzoku 2
\r
225 if(a1 == 22 && y1 > y2){
\r
228 if(poly2.array[index].y <= y1 && y1 <= poly2.array[index + 1].y){
\r
233 newx1 = poly2.array[index + 1].x + (poly2.array[index].x - poly2.array[index + 1].x) *
\r
234 (poly2.array[index + 1].y - y1) / (poly2.array[index + 1].y - poly2.array[index].y);
\r
236 newx2 = poly.array[0].x + (poly.array[0].x - poly.array[1].x - 1) * (poly.array[0].y - y1) /
\r
237 (poly.array[1].y - poly.array[0].y);
\r
240 for(var i = 0; i < index; i++){
\r
243 poly2.set(0, newx1, newy1);
\r
244 poly.unshift(newx2, newy2);
\r
248 poly.concat(poly2);
\r
249 polygons.push(poly);
\r
252 for(tt = 0; tt <= 1000; tt = tt + kage.kRate){
\r
256 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
257 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
258 // KATAMUKI of vector by BIBUN
\r
259 ix = t * t * (-3 * x1 + 9 * sx1 + -9 * sx2 + 3 * x2) + t * (6 * x1 + -12 * sx1 + 6 * sx2) + -3 * x1 + 3 * sx1;
\r
260 iy = t * t * (-3 * y1 + 9 * sy1 + -9 * sy2 + 3 * y2) + t * (6 * y1 + -12 * sy1 + 6 * sy2) + -3 * y1 + 3 * sy1;
\r
262 // line SUICHOKU by vector
\r
263 if(ix != 0 && iy != 0){
\r
264 ir = Math.atan(iy / ix * -1);
\r
265 ia = Math.sin(ir) * (kMinWidthT);
\r
266 ib = Math.cos(ir) * (kMinWidthT);
\r
277 if(a1 == 7 && a2 == 0){ // L2RD: fatten
\r
278 deltad = Math.pow(t, hosomi) * kage.kL2RDfatten;
\r
281 deltad = Math.pow(t, hosomi);
\r
282 deltad = Math.pow(deltad, 0.7); // make fatten
\r
285 deltad = Math.pow(1.0 - t, hosomi);
\r
287 else{ deltad = 1; }
\r
295 //reverse if vector is going 2nd/3rd quadrants
\r
301 //copy to polygon structure
\r
302 poly.push(x - ia, y - ib);
\r
303 poly2.push(x + ia, y + ib);
\r
306 // suiheisen ni setsuzoku
\r
310 if(poly2.array[index].y <= y1 && y1 <= poly2.array[index + 1].y){
\r
315 newx1 = poly2.array[index + 1].x + (poly2.array[index].x - poly2.array[index + 1].x) *
\r
316 (poly2.array[index + 1].y - y1) / (poly2.array[index + 1].y - poly2.array[index].y);
\r
318 newx2 = poly.array[0].x + (poly.array[0].x - poly.array[1].x) * (poly.array[0].y - y1) /
\r
319 (poly.array[1].y - poly.array[0].y);
\r
322 for(var i = 0; i < index; i++){
\r
325 poly2.set(0, newx1, newy1);
\r
326 poly.unshift(newx2, newy2);
\r
329 // suiheisen ni setsuzoku 2
\r
333 if(poly2.array[index].y <= y1 && y1 <= poly2.array[index + 1].y){
\r
338 newx1 = poly2.array[index + 1].x + (poly2.array[index].x - poly2.array[index + 1].x) *
\r
339 (poly2.array[index + 1].y - y1) / (poly2.array[index + 1].y - poly2.array[index].y);
\r
341 newx2 = poly.array[0].x + (poly.array[0].x - poly.array[1].x - 1) * (poly.array[0].y - y1) /
\r
342 (poly.array[1].y - poly.array[0].y);
\r
345 for(var i = 0; i < index; i++){
\r
348 poly2.set(0, newx1, newy1);
\r
349 poly.unshift(newx2, newy2);
\r
353 poly.concat(poly2);
\r
354 polygons.push(poly);
\r
357 //process for head of stroke
\r
358 rad = Math.atan((sy1 - y1) / (sx1 - x1));
\r
359 if(x1 < sx1){ v = 1; } else{ v = -1; }
\r
360 XX = Math.sin(rad) * v;
\r
361 XY = Math.cos(rad) * v * -1;
\r
362 YX = Math.cos(rad) * v;
\r
363 YY = Math.sin(rad) * v;
\r
367 poly= new Polygon();
\r
368 poly.push(x1 - kMinWidthT, y1);
\r
369 poly.push(x1 + kMinWidthT, y1);
\r
370 poly.push(x1 - kMinWidthT, y1 - kMinWidthT);
\r
371 polygons.push(poly);
\r
374 poly = new Polygon();
\r
375 poly.push(x1 - kMinWidthT * XX, y1 - kMinWidthT * XY);
\r
376 poly.push(x1 + kMinWidthT * XX, y1 + kMinWidthT * XY);
\r
377 poly.push(x1 - kMinWidthT * XX - kMinWidthT * YX, y1 - kMinWidthT * XY - kMinWidthT * YY);
\r
378 polygons.push(poly);
\r
385 if(y1 <= y2){ //from up to bottom
\r
386 type = (Math.atan2(Math.abs(y1 - sy1), Math.abs(x1 - sx1)) / Math.PI * 2 - 0.4);
\r
398 poly = new Polygon();
\r
399 poly.push(x1 - kMinWidthT, y1 + 1);
\r
400 poly.push(x1 + kMinWidthT, y1);
\r
401 poly.push(x1 - kMinWidthT * pm, y1 - kage.kMinWidthY * type * pm);
\r
402 polygons.push(poly);
\r
405 poly = new Polygon();
\r
406 poly.push(x1 - kMinWidthT * XX + 1 * YX, y1 - kMinWidthT * XY + 1 * YY);
\r
407 poly.push(x1 + kMinWidthT * XX, y1 + kMinWidthT * XY);
\r
408 poly.push(x1 - kMinWidthT * pm * XX - kage.kMinWidthY * type * pm * YX, y1 - kMinWidthT * pm * XY - kage.kMinWidthY * type * pm * YY);
\r
409 polygons.push(poly);
\r
412 else{ //bottom to up
\r
414 poly = new Polygon();
\r
415 poly.push(x1 - kMinWidthT, y1);
\r
416 poly.push(x1 + kMinWidthT, y1);
\r
417 poly.push(x1 + kMinWidthT, y1 - kage.kMinWidthY);
\r
418 polygons.push(poly);
\r
421 poly = new Polygon();
\r
422 poly.push(x1 - kMinWidthT * XX, y1 - kMinWidthT * XY);
\r
423 poly.push(x1 + kMinWidthT * XX, y1 + kMinWidthT * XY);
\r
424 poly.push(x1 + kMinWidthT * XX - kage.kMinWidthY * YX, y1 + kMinWidthT * XY - kage.kMinWidthY * YY);
\r
425 polygons.push(poly);
\r
430 if(a1 == 22){ //box's up-right corner, any time same degree
\r
431 poly = new Polygon();
\r
432 poly.push(x1 - kMinWidthT, y1 - kage.kMinWidthY);
\r
433 poly.push(x1, y1 - kage.kMinWidthY - kage.kWidth);
\r
434 poly.push(x1 + kMinWidthT + kage.kWidth, y1 + kage.kMinWidthY);
\r
435 poly.push(x1 + kMinWidthT, y1 + kMinWidthT - 1);
\r
436 poly.push(x1 - kMinWidthT, y1 + kMinWidthT + 4);
\r
437 polygons.push(poly);
\r
440 if(a1 == 0){ //beginning of the stroke
\r
441 if(y1 <= y2){ //from up to bottom
\r
445 var move = kage.kMinWidthY * type * pm;
\r
447 poly = new Polygon();
\r
448 poly.push(x1 + kMinWidthT, y1 - move);
\r
449 poly.push(x1 + kMinWidthT * 1.5, y1 + kage.kMinWidthY - move);
\r
450 poly.push(x1 + kMinWidthT - 2, y1 + kage.kMinWidthY * 2 + 1);
\r
451 polygons.push(poly);
\r
454 poly = new Polygon();
\r
455 poly.push(x1 + kMinWidthT * XX - move * YX,
\r
456 y1 + kMinWidthT * XY - move * YY);
\r
457 poly.push(x1 + kMinWidthT * 1.5 * XX + (kage.kMinWidthY - move * 1.2) * YX,
\r
458 y1 + kMinWidthT * 1.5 * XY + (kage.kMinWidthY - move * 1.2) * YY);
\r
459 poly.push(x1 + (kMinWidthT - 2) * XX + (kage.kMinWidthY * 2 - move * 0.8 + 1) * YX,
\r
460 y1 + (kMinWidthT - 2) * XY + (kage.kMinWidthY * 2 - move * 0.8 + 1) * YY);
\r
461 polygons.push(poly);
\r
464 else{ //from bottom to up
\r
466 poly = new Polygon();
\r
467 poly.push(x1 - kMinWidthT, y1);
\r
468 poly.push(x1 - kMinWidthT * 1.5, y1 + kage.kMinWidthY);
\r
469 poly.push(x1 - kMinWidthT * 0.5, y1 + kage.kMinWidthY * 3);
\r
470 polygons.push(poly);
\r
473 poly = new Polygon();
\r
474 poly.push(x1 - kMinWidthT * XX, y1 - kMinWidthT * XY);
\r
475 poly.push(x1 - kMinWidthT * 1.5 * XX + kage.kMinWidthY * YX, y1 + kage.kMinWidthY * YY - kMinWidthT * 1.5 * XY);
\r
476 poly.push(x1 - kMinWidthT * 0.5 * XX + kage.kMinWidthY * 3 * YX, y1 + kage.kMinWidthY * 3 * YY - kMinWidthT * 0.5 * XY);
\r
477 polygons.push(poly);
\r
483 rad = Math.atan((y2 - sy2) / (x2 - sx2));
\r
484 if(sx2 < x2){ v = 1; } else{ v = -1; }
\r
485 YX = Math.sin(rad) * v * -1;
\r
486 YY = Math.cos(rad) * v;
\r
487 XX = Math.cos(rad) * v;
\r
488 XY = Math.sin(rad) * v;
\r
490 if(a2 == 1 || a2 == 8 || a2 == 15){ //the last filled circle ... it can change 15->5
\r
492 poly = new Polygon();
\r
493 if(kage.kUseCurve){
\r
495 poly.push(x2 - kMinWidthT, y2);
\r
496 poly.push(x2 - kMinWidthT * 0.9, y2 + kMinWidthT * 0.9, 1);
\r
497 poly.push(x2, y2 + kMinWidthT);
\r
498 poly.push(x2 + kMinWidthT * 0.9, y2 + kMinWidthT * 0.9, 1);
\r
499 poly.push(x2 + kMinWidthT, y2);
\r
502 poly.push(x2 - kMinWidthT, y2);
\r
503 poly.push(x2 - kMinWidthT * 0.7, y2 + kMinWidthT * 0.7);
\r
504 poly.push(x2, y2 + kMinWidthT);
\r
505 poly.push(x2 + kMinWidthT * 0.7, y2 + kMinWidthT * 0.7);
\r
506 poly.push(x2 + kMinWidthT, y2);
\r
508 polygons.push(poly);
\r
510 else if(sy2 == y2){
\r
511 poly = new Polygon();
\r
512 if(kage.kUseCurve){
\r
514 poly.push(x2, y2 - kMinWidthT);
\r
515 poly.push(x2 + kMinWidthT * 0.9, y2 - kMinWidthT * 0.9, 1);
\r
516 poly.push(x2 + kMinWidthT, y2);
\r
517 poly.push(x2 + kMinWidthT * 0.9, y2 + kMinWidthT * 0.9, 1);
\r
518 poly.push(x2, y2 + kMinWidthT);
\r
521 poly.push(x2, y2 - kMinWidthT);
\r
522 poly.push(x2 + kMinWidthT * 0.7, y2 - kMinWidthT * 0.7);
\r
523 poly.push(x2 + kMinWidthT, y2);
\r
524 poly.push(x2 + kMinWidthT * 0.7, y2 + kMinWidthT * 0.7);
\r
525 poly.push(x2, y2 + kMinWidthT);
\r
527 polygons.push(poly);
\r
530 poly = new Polygon();
\r
531 if(kage.kUseCurve){
\r
532 poly.push(x2 + Math.sin(rad) * kMinWidthT * v, y2 - Math.cos(rad) * kMinWidthT * v);
\r
533 poly.push(x2 + Math.cos(rad) * kMinWidthT * 0.9 * v + Math.sin(rad) * kMinWidthT * 0.9 * v,
\r
534 y2 + Math.sin(rad) * kMinWidthT * 0.9 * v - Math.cos(rad) * kMinWidthT * 0.9 * v, 1);
\r
535 poly.push(x2 + Math.cos(rad) * kMinWidthT * v, y2 + Math.sin(rad) * kMinWidthT * v);
\r
536 poly.push(x2 + Math.cos(rad) * kMinWidthT * 0.9 * v - Math.sin(rad) * kMinWidthT * 0.9 * v,
\r
537 y2 + Math.sin(rad) * kMinWidthT * 0.9 * v + Math.cos(rad) * kMinWidthT * 0.9 * v, 1);
\r
538 poly.push(x2 - Math.sin(rad) * kMinWidthT * v, y2 + Math.cos(rad) * kMinWidthT * v);
\r
540 poly.push(x2 + Math.sin(rad) * kMinWidthT * v, y2 - Math.cos(rad) * kMinWidthT * v);
\r
541 poly.push(x2 + Math.cos(rad) * kMinWidthT * 0.7 * v + Math.sin(rad) * kMinWidthT * 0.7 * v,
\r
542 y2 + Math.sin(rad) * kMinWidthT * 0.7 * v - Math.cos(rad) * kMinWidthT * 0.7 * v);
\r
543 poly.push(x2 + Math.cos(rad) * kMinWidthT * v, y2 + Math.sin(rad) * kMinWidthT * v);
\r
544 poly.push(x2 + Math.cos(rad) * kMinWidthT * 0.7 * v - Math.sin(rad) * kMinWidthT * 0.7 * v,
\r
545 y2 + Math.sin(rad) * kMinWidthT * 0.7 * v + Math.cos(rad) * kMinWidthT * 0.7 * v);
\r
546 poly.push(x2 - Math.sin(rad) * kMinWidthT * v, y2 + Math.cos(rad) * kMinWidthT * v);
\r
548 polygons.push(poly);
\r
552 if(a2 == 9 || (a1 == 7 && a2 == 0)){ // Math.sinnyu & L2RD Harai ... no need for a2=9
\r
553 var type = (Math.atan2(Math.abs(y2 - sy2), Math.abs(x2 - sx2)) / Math.PI * 2 - 0.6);
\r
566 poly = new Polygon();
\r
567 poly.push(x2, y2 + kMinWidthT * kage.kL2RDfatten);
\r
568 poly.push(x2, y2 - kMinWidthT * kage.kL2RDfatten);
\r
569 poly.push(x2 + kMinWidthT * kage.kL2RDfatten * Math.abs(type), y2 + kMinWidthT * kage.kL2RDfatten * pm);
\r
570 polygons.push(poly);
\r
573 poly = new Polygon();
\r
574 poly.push(x2 + kMinWidthT * kage.kL2RDfatten * YX, y2 + kMinWidthT * kage.kL2RDfatten * YY);
\r
575 poly.push(x2 - kMinWidthT * kage.kL2RDfatten * YX, y2 - kMinWidthT * kage.kL2RDfatten * YY);
\r
576 poly.push(x2 + kMinWidthT * kage.kL2RDfatten * Math.abs(type) * XX + kMinWidthT * kage.kL2RDfatten * pm * YX,
\r
577 y2 + kMinWidthT * kage.kL2RDfatten * Math.abs(type) * XY + kMinWidthT * kage.kL2RDfatten * pm * YY);
\r
578 polygons.push(poly);
\r
582 if(a2 == 15){ //jump up ... it can change 15->5
\r
583 // anytime same degree
\r
584 poly = new Polygon();
\r
585 poly.push(x2, y2 - kMinWidthT + 1);
\r
586 poly.push(x2 + 2, y2 - kMinWidthT - kage.kWidth * 5);
\r
587 poly.push(x2, y2 - kMinWidthT - kage.kWidth * 5);
\r
588 poly.push(x2 - kMinWidthT, y2 - kMinWidthT + 1);
\r
589 polygons.push(poly);
\r
592 if(a2 == 14){ //jump to left, allways go left
\r
593 poly = new Polygon();
\r
595 poly.push(x2, y2 - kMinWidthT);
\r
596 poly.push(x2 - kage.kWidth * 4 * Math.pow(kMinWidthT / kage.kMinWidthT, 3), y2 - kMinWidthT);
\r
597 poly.push(x2 - kage.kWidth * 4 * Math.pow(kMinWidthT / kage.kMinWidthT, 3), y2 - kMinWidthT * 0.5);
\r
598 polygons.push(poly);
\r
604 if(y1 < sy1){ y1 = y1 - kage.kWidth; } else{ y1 = y1 + kage.kWidth; }
\r
606 else if(y1 == sy1){
\r
607 if(x1 < sx1){ x1 = x1 - kage.kWidth; } else{ x1 = x1 + kage.kWidth; }
\r
610 rad = Math.atan((sy1 - y1) / (sx1 - x1));
\r
611 if(x1 < sx1){ v = 1; } else{ v = -1; }
\r
612 x1 = x1 - kage.kWidth * Math.cos(rad) * v;
\r
613 y1 = y1 - kage.kWidth * Math.sin(rad) * v;
\r
620 y1 = y1 - kage.kWidth * kage.kKakato;
\r
623 y1 = y1 + kage.kWidth * kage.kKakato;
\r
626 else if(y1 == sy1){
\r
628 x1 = x1 - kage.kWidth * kage.kKakato;
\r
631 x1 = x1 + kage.kWidth * kage.kKakato;
\r
635 rad = Math.atan((sy1 - y1) / (sx1 - x1));
\r
636 if(x1 < sx1){ v = 1; } else{ v = -1; }
\r
637 x1 = x1 - kage.kWidth * Math.cos(rad) * v * kage.kKakato;
\r
638 y1 = y1 - kage.kWidth * Math.sin(rad) * v * kage.kKakato;
\r
643 if(sy2 < y2){ y2 = y2 + kage.kWidth; } else{ y2 = y2 - kage.kWidth; }
\r
645 else if(sy2 == y2){
\r
646 if(sx2 < x2){ x2 = x2 + kage.kWidth; } else{ x2 = x2 - kage.kWidth; }
\r
649 rad = Math.atan((y2 - sy2) / (x2 - sx2));
\r
650 if(sx2 < x2){ v = 1; } else{ v = -1; }
\r
651 x2 = x2 + kage.kWidth * Math.cos(rad) * v;
\r
652 y2 = y2 + kage.kWidth * Math.sin(rad) * v;
\r
659 y2 = y2 + kage.kWidth * kage.kKakato;
\r
662 y2 = y2 - kage.kWidth * kage.kKakato;
\r
665 else if(sy2 == y2){
\r
667 x2 = x2 + kage.kWidth * kage.kKakato;
\r
670 x2 = x2 - kage.kWidth * kage.kKakato;
\r
674 rad = Math.atan((y2 - sy2) / (x2 - sx2));
\r
675 if(sx2 < x2){ v = 1; } else{ v = -1; }
\r
676 x2 = x2 + kage.kWidth * Math.cos(rad) * v * kage.kKakato;
\r
677 y2 = y2 + kage.kWidth * Math.sin(rad) * v * kage.kKakato;
\r
681 poly = new Polygon();
\r
682 poly2 = new Polygon();
\r
684 for(tt = 0; tt <= 1000; tt = tt + kage.kRate){
\r
687 if(sx1 == sx2 && sy1 == sy2){
\r
688 //calculating each point
\r
689 x = ((1.0 - t) * (1.0 - t) * x1 + 2.0 * t * (1.0 - t) * sx1 + t * t * x2);
\r
690 y = ((1.0 - t) * (1.0 - t) * y1 + 2.0 * t * (1.0 - t) * sy1 + t * t * y2);
\r
692 //SESSEN NO KATAMUKI NO KEISAN(BIBUN)
\r
693 ix = (x1 - 2.0 * sx1 + x2) * 2.0 * t + (-2.0 * x1 + 2.0 * sx1);
\r
694 iy = (y1 - 2.0 * sy1 + y2) * 2.0 * t + (-2.0 * y1 + 2.0 * sy1);
\r
697 //SESSEN NI SUICHOKU NA CHOKUSEN NO KEISAN
\r
698 if(kage.kShotai == kage.kMincho){ //always false ?
\r
699 if(ix != 0 && iy != 0){
\r
700 ir = Math.atan(iy / ix * -1.0);
\r
701 ia = Math.sin(ir) * kage.kMinWidthT;
\r
702 ib = Math.cos(ir) * kage.kMinWidthT;
\r
705 ia = kage.kMinWidthT;
\r
710 ib = kage.kMinWidthT;
\r
712 ia = ia * Math.sqrt(1.0 - t);
\r
713 ib = ib * Math.sqrt(1.0 - t);
\r
716 if(ix != 0 && iy != 0){
\r
717 ir = Math.atan(iy / ix * -1.0);
\r
718 ia = Math.sin(ir) * kage.kWidth;
\r
719 ib = Math.cos(ir) * kage.kWidth;
\r
731 //reverse if vector is going 2nd/3rd quadrants
\r
738 poly.push(x - ia, y - ib);
\r
739 poly2.push(x + ia, y + ib);
\r
743 poly.concat(poly2);
\r
744 polygons.push(poly);
\r
748 function cdDrawBezier(kage, polygons, x1, y1, x2, y2, x3, y3, x4, y4, a1, a2){
\r
749 cdDrawCurveU(kage, polygons, x1, y1, x2, y2, x3, y3, x4, y4, a1, a2);
\r
752 function cdDrawCurve(kage, polygons, x1, y1, x2, y2, x3, y3, a1, a2){
\r
753 cdDrawCurveU(kage, polygons, x1, y1, x2, y2, x2, y2, x3, y3, a1, a2);
\r
756 function cdDrawLine(kage, polygons, tx1, ty1, tx2, ty2, ta1, ta2){
\r
758 var v, x1, y1, x2, y2;
\r
759 var a1, a2, opt1, opt2;
\r
760 var XX, XY, YX, YY;
\r
764 if(kage.kShotai == kage.kMincho){ //mincho
\r
771 opt1 = Math.floor(ta1 / 1000);
\r
772 opt2 = Math.floor(ta2 / 100);
\r
774 kMinWidthT = kage.kMinWidthT - opt1 / 2;
\r
776 if(x1 == x2){ //if TATE stroke, use y-axis
\r
777 poly = new Polygon(4);
\r
780 poly.set(3, x1 - kMinWidthT, y1 - kage.kMinWidthY / 2);
\r
781 poly.set(0, x1 + kMinWidthT, y1 + kage.kMinWidthY / 2);
\r
784 case 6: //... no need
\r
786 poly.set(3, x1 - kMinWidthT, y1);
\r
787 poly.set(0, x1 + kMinWidthT, y1);
\r
790 poly.set(3, x1 - kMinWidthT, y1 - kage.kMinWidthY - kMinWidthT);
\r
791 poly.set(0, x1 + kMinWidthT, y1 - kage.kMinWidthY);
\r
794 poly.set(3, x1 - kMinWidthT, y1 - kage.kMinWidthY);
\r
795 poly.set(0, x1 + kMinWidthT, y1 - kage.kMinWidthY);
\r
801 if(a1 == 6){ //KAGI's tail ... no need
\r
802 poly.set(2, x2 - kMinWidthT, y2);
\r
803 poly.set(1, x2 + kMinWidthT, y2);
\r
806 poly.set(2, x2 - kMinWidthT, y2 + kMinWidthT / 2);
\r
807 poly.set(1, x2 + kMinWidthT, y2 - kMinWidthT / 2);
\r
811 poly.set(2, x2 - kMinWidthT, y2);
\r
812 poly.set(1, x2 + kMinWidthT, y2);
\r
815 poly.set(2, x2 - kMinWidthT, y2 + kage.kAdjustKakatoL[opt2] + kMinWidthT);
\r
816 poly.set(1, x2 + kMinWidthT, y2 + kage.kAdjustKakatoL[opt2]);
\r
819 poly.set(2, x2 - kMinWidthT, y2 + kage.kAdjustKakatoR[opt2] + kMinWidthT);
\r
820 poly.set(1, x2 + kMinWidthT, y2 + kage.kAdjustKakatoR[opt2]);
\r
823 poly.set(2, x2 - kMinWidthT, y2 + kage.kMinWidthY);
\r
824 poly.set(1, x2 + kMinWidthT, y2 + kage.kMinWidthY);
\r
828 polygons.push(poly);
\r
830 if(a1 == 22){ //box's right top corner
\r
831 poly = new Polygon();
\r
832 poly.push(x1 - kMinWidthT, y1 - kage.kMinWidthY);
\r
833 poly.push(x1, y1 - kage.kMinWidthY - kage.kWidth);
\r
834 poly.push(x1 + kMinWidthT + kage.kWidth, y1 + kage.kMinWidthY);
\r
835 poly.push(x1 + kMinWidthT, y1 + kMinWidthT);
\r
836 poly.push(x1 - kMinWidthT, y1);
\r
837 polygons.push(poly);
\r
840 if(a1 == 0){ //beginning of the stroke
\r
841 poly = new Polygon();
\r
842 poly.push(x1 + kMinWidthT, y1 + kage.kMinWidthY * 0.5);
\r
843 poly.push(x1 + kMinWidthT + kMinWidthT * 0.5, y1 + kage.kMinWidthY * 0.5 + kage.kMinWidthY);
\r
844 poly.push(x1 + kMinWidthT - 2, y1 + kage.kMinWidthY * 0.5 + kage.kMinWidthY * 2 + 1);
\r
845 polygons.push(poly);
\r
848 if((a1 == 6 && a2 == 0) || a2 == 1){ //KAGI NO YOKO BOU NO SAIGO NO MARU ... no need only used at 1st=yoko
\r
849 poly = new Polygon();
\r
850 if(kage.kUseCurve){
\r
851 poly.push(x2 - kMinWidthT, y2);
\r
852 poly.push(x2 - kMinWidthT * 0.9, y2 + kMinWidthT * 0.9, 1);
\r
853 poly.push(x2, y2 + kMinWidthT);
\r
854 poly.push(x2 + kMinWidthT * 0.9, y2 + kMinWidthT * 0.9, 1);
\r
855 poly.push(x2 + kMinWidthT, y2);
\r
857 poly.push(x2 - kMinWidthT, y2);
\r
858 poly.push(x2 - kMinWidthT * 0.6, y2 + kMinWidthT * 0.6);
\r
859 poly.push(x2, y2 + kMinWidthT);
\r
860 poly.push(x2 + kMinWidthT * 0.6, y2 + kMinWidthT * 0.6);
\r
861 poly.push(x2 + kMinWidthT, y2);
\r
863 poly.reverse(); // for fill-rule
\r
864 polygons.push(poly);
\r
867 else if(y1 == y2){ //if it is YOKO stroke, use x-axis
\r
868 if(a1 == 6){ //if it is KAGI's YOKO stroke, get bold
\r
869 poly = new Polygon();
\r
870 poly.push(x1, y1 - kMinWidthT);
\r
871 poly.push(x2, y2 - kMinWidthT);
\r
872 poly.push(x2, y2 + kMinWidthT);
\r
873 poly.push(x1, y1 + kMinWidthT);
\r
874 polygons.push(poly);
\r
876 if(a2 == 1 || a2 == 0 || a2 == 5){ // no need a2=1
\r
877 //KAGI NO YOKO BOU NO SAIGO NO MARU
\r
878 poly = new Polygon();
\r
879 if(kage.kUseCurve){
\r
881 poly.push(x2, y2 - kMinWidthT);
\r
882 poly.push(x2 + kMinWidthT * 0.9, y2 - kMinWidthT * 0.9, 1);
\r
883 poly.push(x2 + kMinWidthT, y2);
\r
884 poly.push(x2 + kMinWidthT * 0.9, y2 + kMinWidthT * 0.9, 1);
\r
885 poly.push(x2, y2 + kMinWidthT);
\r
887 poly.push(x2, y2 - kMinWidthT);
\r
888 poly.push(x2 - kMinWidthT * 0.9, y2 - kMinWidthT * 0.9, 1);
\r
889 poly.push(x2 - kMinWidthT, y2);
\r
890 poly.push(x2 - kMinWidthT * 0.9, y2 + kMinWidthT * 0.9, 1);
\r
891 poly.push(x2, y2 + kMinWidthT);
\r
895 poly.push(x2, y2 - kMinWidthT);
\r
896 poly.push(x2 + kMinWidthT * 0.6, y2 - kMinWidthT * 0.6);
\r
897 poly.push(x2 + kMinWidthT, y2);
\r
898 poly.push(x2 + kMinWidthT * 0.6, y2 + kMinWidthT * 0.6);
\r
899 poly.push(x2, y2 + kMinWidthT);
\r
901 poly.push(x2, y2 - kMinWidthT);
\r
902 poly.push(x2 - kMinWidthT * 0.6, y2 - kMinWidthT * 0.6);
\r
903 poly.push(x2 - kMinWidthT, y2);
\r
904 poly.push(x2 - kMinWidthT * 0.6, y2 + kMinWidthT * 0.6);
\r
905 poly.push(x2, y2 + kMinWidthT);
\r
908 polygons.push(poly);
\r
912 //KAGI NO YOKO BOU NO HANE
\r
913 poly = new Polygon();
\r
915 poly.push(x2, y2 - kMinWidthT + 1);
\r
916 poly.push(x2 + 2, y2 - kMinWidthT - kage.kWidth * 5);
\r
917 poly.push(x2, y2 - kMinWidthT - kage.kWidth * 5);
\r
918 poly.push(x2 - kMinWidthT, y2 - kMinWidthT + 1);
\r
920 poly.push(x2, y2 - kMinWidthT + 1);
\r
921 poly.push(x2 - 2, y2 - kMinWidthT - kage.kWidth * 5);
\r
922 poly.push(x2, y2 - kMinWidthT - kage.kWidth * 5);
\r
923 poly.push(x2 + kMinWidthT, y2 - kMinWidthT + 1);
\r
925 poly.reverse(); // for fill-rule
\r
926 polygons.push(poly);
\r
931 poly = new Polygon(4);
\r
932 poly.set(0, x1, y1 - kage.kMinWidthY);
\r
933 poly.set(1, x2, y2 - kage.kMinWidthY);
\r
934 poly.set(2, x2, y2 + kage.kMinWidthY);
\r
935 poly.set(3, x1, y1 + kage.kMinWidthY);
\r
936 polygons.push(poly);
\r
940 poly = new Polygon();
\r
941 poly.push(x2, y2 - kage.kMinWidthY);
\r
942 poly.push(x2 - kage.kAdjustUrokoX[opt2], y2);
\r
943 poly.push(x2 - kage.kAdjustUrokoX[opt2] / 2, y2 - kage.kAdjustUrokoY[opt2]);
\r
944 polygons.push(poly);
\r
948 else{ //for others, use x-axis
\r
949 rad = Math.atan((y2 - y1) / (x2 - x1));
\r
950 if((Math.abs(y2 - y1) < Math.abs(x2 - x1)) && (a1 != 6) && (a2 != 6) && !(x1 > x2)){ //ASAI KAUDO
\r
952 poly = new Polygon(4);
\r
953 poly.set(0, x1 + Math.sin(rad) * kage.kMinWidthY, y1 - Math.cos(rad) * kage.kMinWidthY);
\r
954 poly.set(1, x2 + Math.sin(rad) * kage.kMinWidthY, y2 - Math.cos(rad) * kage.kMinWidthY);
\r
955 poly.set(2, x2 - Math.sin(rad) * kage.kMinWidthY, y2 + Math.cos(rad) * kage.kMinWidthY);
\r
956 poly.set(3, x1 - Math.sin(rad) * kage.kMinWidthY, y1 + Math.cos(rad) * kage.kMinWidthY);
\r
957 polygons.push(poly);
\r
961 poly = new Polygon();
\r
962 poly.push(x2 + Math.sin(rad) * kage.kMinWidthY, y2 - Math.cos(rad) * kage.kMinWidthY);
\r
963 poly.push(x2 - Math.cos(rad) * kage.kAdjustUrokoX[opt2], y2 - Math.sin(rad) * kage.kAdjustUrokoX[opt2]);
\r
964 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
965 polygons.push(poly);
\r
969 else{ //KAKUDO GA FUKAI or KAGI NO YOKO BOU
\r
970 if(x1 > x2){ v = -1; } else{ v = 1; }
\r
971 poly = new Polygon(4);
\r
974 poly.set(0, x1 + Math.sin(rad) * kMinWidthT * v + kage.kMinWidthY * Math.cos(rad) * 0.5 * v,
\r
975 y1 - Math.cos(rad) * kMinWidthT * v + kage.kMinWidthY * Math.sin(rad) * 0.5 * v);
\r
976 poly.set(3, x1 - Math.sin(rad) * kMinWidthT * v - kage.kMinWidthY * Math.cos(rad) * 0.5 * v,
\r
977 y1 + Math.cos(rad) * kMinWidthT * v - kage.kMinWidthY * Math.sin(rad) * 0.5 * v);
\r
981 poly.set(0, x1 + Math.sin(rad) * kMinWidthT * v, y1 - Math.cos(rad) * kMinWidthT * v);
\r
982 poly.set(3, x1 - Math.sin(rad) * kMinWidthT * v, y1 + Math.cos(rad) * kMinWidthT * v);
\r
985 poly.set(0, x1 + Math.sin(rad) * kMinWidthT * v - kage.kMinWidthY * Math.cos(rad) * v,
\r
986 y1 - Math.cos(rad) * kMinWidthT * v - kage.kMinWidthY * Math.sin(rad) * v);
\r
987 poly.set(3, x1 - Math.sin(rad) * kMinWidthT * v - (kMinWidthT + kage.kMinWidthY) * Math.cos(rad) * v,
\r
988 y1 + Math.cos(rad) * kMinWidthT * v - (kMinWidthT + kage.kMinWidthY) * Math.sin(rad) * v);
\r
991 poly.set(0, x1 + (kMinWidthT * v + 1) / Math.sin(rad), y1 + 1);
\r
992 poly.set(3, x1 - (kMinWidthT * v) / Math.sin(rad), y1);
\r
995 poly.set(0, x1 + (kMinWidthT * v) / Math.sin(rad), y1);
\r
996 poly.set(3, x1 - (kMinWidthT * v) / Math.sin(rad), y1);
\r
1003 poly.set(1, x2 + Math.sin(rad) * kMinWidthT * v, y2 - Math.cos(rad) * kMinWidthT * v);
\r
1004 poly.set(2, x2 - Math.sin(rad) * kMinWidthT * v, y2 + Math.cos(rad) * kMinWidthT * v);
\r
1007 poly.set(1, x2 + Math.sin(rad) * kMinWidthT * v - kMinWidthT * 0.5 * Math.cos(rad) * v,
\r
1008 y2 - Math.cos(rad) * kMinWidthT * v - kMinWidthT * 0.5 * Math.sin(rad) * v);
\r
1009 poly.set(2, x2 - Math.sin(rad) * kMinWidthT * v + kMinWidthT * 0.5 * Math.cos(rad) * v,
\r
1010 y2 + Math.cos(rad) * kMinWidthT * v + kMinWidthT * 0.5 * Math.sin(rad) * v);
\r
1013 case 1: // is needed?
\r
1015 poly.set(1, x2 + Math.sin(rad) * kMinWidthT * v, y2 - Math.cos(rad) * kMinWidthT * v);
\r
1016 poly.set(2, x2 - Math.sin(rad) * kMinWidthT * v, y2 + Math.cos(rad) * kMinWidthT * v);
\r
1019 poly.set(1, x2 + Math.sin(rad) * kMinWidthT * v + kage.kAdjustKakatoL[opt2] * Math.cos(rad) * v,
\r
1020 y2 - Math.cos(rad) * kMinWidthT * v + kage.kAdjustKakatoL[opt2] * Math.sin(rad) * v);
\r
1021 poly.set(2, x2 - Math.sin(rad) * kMinWidthT * v + (kage.kAdjustKakatoL[opt2] + kMinWidthT) * Math.cos(rad) * v,
\r
1022 y2 + Math.cos(rad) * kMinWidthT * v + (kage.kAdjustKakatoL[opt2] + kMinWidthT) * Math.sin(rad) * v);
\r
1025 poly.set(1, x2 + Math.sin(rad) * kMinWidthT * v + kage.kAdjustKakatoR[opt2] * Math.cos(rad) * v,
\r
1026 y2 - Math.cos(rad) * kMinWidthT * v + kage.kAdjustKakatoR[opt2] * Math.sin(rad) * v);
\r
1028 x2 - Math.sin(rad) * kMinWidthT * v + (kage.kAdjustKakatoR[opt2] + kMinWidthT) * Math.cos(rad) * v,
\r
1029 y2 + Math.cos(rad) * kMinWidthT * v + (kage.kAdjustKakatoR[opt2] + kMinWidthT) * Math.sin(rad) * v);
\r
1032 poly.set(1, x2 + (kMinWidthT * v) / Math.sin(rad), y2);
\r
1033 poly.set(2, x2 - (kMinWidthT * v) / Math.sin(rad), y2);
\r
1037 polygons.push(poly);
\r
1039 if((a1 == 6) && (a2 == 0 || a2 == 5)){ //KAGI NO YOKO BOU NO SAIGO NO MARU
\r
1040 poly = new Polygon();
\r
1041 if(kage.kUseCurve){
\r
1042 poly.push(x2 + Math.sin(rad) * kMinWidthT * v, y2 - Math.cos(rad) * kMinWidthT * v);
\r
1043 poly.push(x2 - Math.cos(rad) * kMinWidthT * 0.9 * v + Math.sin(rad) * kMinWidthT * 0.9 * v,
\r
1044 y2 + Math.sin(rad) * kMinWidthT * 0.9 * v - Math.cos(rad) * kMinWidthT * 0.9 * v, 1);
\r
1045 poly.push(x2 + Math.cos(rad) * kMinWidthT * v, y2 + Math.sin(rad) * kMinWidthT * v);
\r
1046 poly.push(x2 + Math.cos(rad) * kMinWidthT * 0.9 * v - Math.sin(rad) * kMinWidthT * 0.9 * v,
\r
1047 y2 + Math.sin(rad) * kMinWidthT * 0.9 * v + Math.cos(rad) * kMinWidthT * 0.9 * v, 1);
\r
1048 poly.push(x2 - Math.sin(rad) * kMinWidthT * v, y2 + Math.cos(rad) * kMinWidthT * v);
\r
1050 poly.push(x2 + Math.sin(rad) * kMinWidthT * v, y2 - Math.cos(rad) * kMinWidthT * v);
\r
1051 poly.push(x2 + Math.cos(rad) * kMinWidthT * 0.8 * v + Math.sin(rad) * kMinWidthT * 0.6 * v,
\r
1052 y2 + Math.sin(rad) * kMinWidthT * 0.8 * v - Math.cos(rad) * kMinWidthT * 0.6 * v);
\r
1053 poly.push(x2 + Math.cos(rad) * kMinWidthT * v, y2 + Math.sin(rad) * kMinWidthT * v);
\r
1054 poly.push(x2 + Math.cos(rad) * kMinWidthT * 0.8 * v - Math.sin(rad) * kMinWidthT * 0.6 * v,
\r
1055 y2 + Math.sin(rad) * kMinWidthT * 0.8 * v + Math.cos(rad) * kMinWidthT * 0.6 * v);
\r
1056 poly.push(x2 - Math.sin(rad) * kMinWidthT * v, y2 + Math.cos(rad) * kMinWidthT * v);
\r
1058 polygons.push(poly);
\r
1061 if(a1 == 6 && a2 == 5){
\r
1062 //KAGI NO YOKO BOU NO HANE
\r
1063 poly = new Polygon();
\r
1065 poly.push(x2 + (kMinWidthT - 1) * Math.sin(rad) * v, y2 - (kMinWidthT - 1) * Math.cos(rad) * v);
\r
1066 poly.push(x2 + 2 * Math.cos(rad) * v + (kMinWidthT + kage.kWidth * 5) * Math.sin(rad) * v,
\r
1067 y2 + 2 * Math.sin(rad) * v - (kMinWidthT + kage.kWidth * 5) * Math.cos(rad) * v);
\r
1068 poly.push(x2 + (kMinWidthT + kage.kWidth * 5) * Math.sin(rad) * v,
\r
1069 y2 - (kMinWidthT + kage.kWidth * 5) * Math.cos(rad) * v);
\r
1070 poly.push(x2 + (kMinWidthT - 1) * Math.sin(rad) * v - kMinWidthT * Math.cos(rad) * v,
\r
1071 y2 - (kMinWidthT - 1) * Math.cos(rad) * v - kMinWidthT * Math.sin(rad) * v);
\r
1073 poly.push(x2 - (kMinWidthT - 1) * Math.sin(rad) * v, y2 + (kMinWidthT - 1) * Math.cos(rad) * v);
\r
1074 poly.push(x2 + 2 * Math.cos(rad) * v - (kMinWidthT + kage.kWidth * 5) * Math.sin(rad) * v,
\r
1075 y2 + 2 * Math.sin(rad) * v + (kMinWidthT + kage.kWidth * 5) * Math.cos(rad) * v);
\r
1076 poly.push(x2 - (kMinWidthT + kage.kWidth * 5) * Math.sin(rad) * v,
\r
1077 y2 + (kMinWidthT + kage.kWidth * 5) * Math.cos(rad) * v);
\r
1078 poly.push(x2 + (kMinWidthT - 1) * Math.sin(rad) * v - kMinWidthT * Math.cos(rad) * v,
\r
1079 y2 - (kMinWidthT - 1) * Math.cos(rad) * v - kMinWidthT * Math.sin(rad) * v);
\r
1081 polygons.push(poly);
\r
1084 if(a1 == 22){ //SHIKAKU MIGIUE UROKO NANAME DEMO MASSUGU MUKI
\r
1085 poly = new Polygon();
\r
1086 poly.push(x1 - kMinWidthT, y1 - kage.kMinWidthY);
\r
1087 poly.push(x1, y1 - kage.kMinWidthY - kage.kWidth);
\r
1088 poly.push(x1 + kMinWidthT + kage.kWidth, y1 + kage.kMinWidthY);
\r
1089 poly.push(x1 + kMinWidthT, y1 + kMinWidthT - 1);
\r
1090 poly.push(x1 - kMinWidthT, y1 + kMinWidthT + 4);
\r
1091 polygons.push(poly);
\r
1094 XX = Math.sin(rad) * v;
\r
1095 XY = Math.cos(rad) * v * -1;
\r
1096 YX = Math.cos(rad) * v;
\r
1097 YY = Math.sin(rad) * v;
\r
1099 if(a1 == 0){ //beginning of the storke
\r
1100 poly = new Polygon();
\r
1101 poly.push(x1 + kMinWidthT * XX + (kage.kMinWidthY * 0.5) * YX,
\r
1102 y1 + kMinWidthT * XY + (kage.kMinWidthY * 0.5) * YY);
\r
1103 poly.push(x1 + (kMinWidthT + kMinWidthT * 0.5) * XX + (kage.kMinWidthY * 0.5 + kage.kMinWidthY) * YX,
\r
1104 y1 + (kMinWidthT + kMinWidthT * 0.5) * XY + (kage.kMinWidthY * 0.5 + kage.kMinWidthY) * YY);
\r
1105 poly.push(x1 + kMinWidthT * XX + (kage.kMinWidthY * 0.5 + kage.kMinWidthY * 2) * YX - 2 * XX,
\r
1106 y1 + kMinWidthT * XY + (kage.kMinWidthY * 0.5 + kage.kMinWidthY * 2) * YY + 1 * XY);
\r
1107 polygons.push(poly);
\r
1113 if(tx1 == tx2){ //if TATE stroke, use y-axis
\r
1131 if(a1 % 10 == 2){ y1 = y1 - kage.kWidth; }
\r
1132 if(a2 % 10 == 2){ y2 = y2 + kage.kWidth; }
\r
1133 if(a1 % 10 == 3){ y1 = y1 - kage.kWidth * kage.kKakato; }
\r
1134 if(a2 % 10 == 3){ y2 = y2 + kage.kWidth * kage.kKakato; }
\r
1136 poly = new Polygon();
\r
1137 poly.push(x1 - kage.kWidth, y1);
\r
1138 poly.push(x2 - kage.kWidth, y2);
\r
1139 poly.push(x2 + kage.kWidth, y2);
\r
1140 poly.push(x1 + kage.kWidth, y1);
\r
1141 poly.reverse(); // for fill-rule
\r
1143 polygons.push(poly);
\r
1145 else if(ty1 == ty2){ //if YOKO stroke, use x-axis
\r
1162 if(a1 % 10 == 2){ x1 = x1 - kage.kWidth; }
\r
1163 if(a2 % 10 == 2){ x2 = x2 + kage.kWidth; }
\r
1164 if(a1 % 10 == 3){ x1 = x1 - kage.kWidth * kage.kKakato; }
\r
1165 if(a2 % 10 == 3){ x2 = x2 + kage.kWidth * kage.kKakato; }
\r
1167 poly = new Polygon();
\r
1168 poly.push(x1, y1 - kage.kWidth);
\r
1169 poly.push(x2, y2 - kage.kWidth);
\r
1170 poly.push(x2, y2 + kage.kWidth);
\r
1171 poly.push(x1, y1 + kage.kWidth);
\r
1173 polygons.push(poly);
\r
1175 else{ //for others, use x-axis
\r
1192 rad = Math.atan((y2 - y1) / (x2 - x1));
\r
1194 x1 = x1 - kage.kWidth * Math.cos(rad);
\r
1195 y1 = y1 - kage.kWidth * Math.sin(rad);
\r
1198 x2 = x2 + kage.kWidth * Math.cos(rad);
\r
1199 y2 = y2 + kage.kWidth * Math.sin(rad);
\r
1202 x1 = x1 - kage.kWidth * Math.cos(rad) * kage.kKakato;
\r
1203 y1 = y1 - kage.kWidth * Math.sin(rad) * kage.kKakato;
\r
1206 x2 = x2 + kage.kWidth * Math.cos(rad) * kage.kKakato;
\r
1207 y2 = y2 + kage.kWidth * Math.sin(rad) * kage.kKakato;
\r
1210 //SUICHOKU NO ICHI ZURASHI HA Math.sin TO Math.cos NO IREKAE + x-axis MAINASU KA
\r
1211 poly = new Polygon();
\r
1212 poly.push(x1 + Math.sin(rad) * kage.kWidth, y1 - Math.cos(rad) * kage.kWidth);
\r
1213 poly.push(x2 + Math.sin(rad) * kage.kWidth, y2 - Math.cos(rad) * kage.kWidth);
\r
1214 poly.push(x2 - Math.sin(rad) * kage.kWidth, y2 + Math.cos(rad) * kage.kWidth);
\r
1215 poly.push(x1 - Math.sin(rad) * kage.kWidth, y1 + Math.cos(rad) * kage.kWidth);
\r
1217 polygons.push(poly);
\r