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
225 poly.concat(poly2);
\r
226 polygons.push(poly);
\r
229 for(tt = 0; tt <= 1000; tt = tt + kage.kRate){
\r
233 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
234 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
235 // KATAMUKI of vector by BIBUN
\r
236 ix = t * t * (-3 * x1 + 9 * sx1 + -9 * sx2 + 3 * x2) + t * (6 * x1 + -12 * sx1 + 6 * sx2) + -3 * x1 + 3 * sx1;
\r
237 iy = t * t * (-3 * y1 + 9 * sy1 + -9 * sy2 + 3 * y2) + t * (6 * y1 + -12 * sy1 + 6 * sy2) + -3 * y1 + 3 * sy1;
\r
239 // line SUICHOKU by vector
\r
240 if(ix != 0 && iy != 0){
\r
241 ir = Math.atan(iy / ix * -1);
\r
242 ia = Math.sin(ir) * (kMinWidthT);
\r
243 ib = Math.cos(ir) * (kMinWidthT);
\r
254 if(a1 == 7 && a2 == 0){ // L2RD: fatten
\r
255 deltad = Math.pow(t, hosomi) * kage.kL2RDfatten;
\r
258 deltad = Math.pow(t, hosomi);
\r
259 deltad = Math.pow(deltad, 0.7); // make fatten
\r
262 deltad = Math.pow(1.0 - t, hosomi);
\r
264 else{ deltad = 1; }
\r
272 //reverse if vector is going 2nd/3rd quadrants
\r
278 //copy to polygon structure
\r
279 poly.push(x - ia, y - ib);
\r
280 poly2.push(x + ia, y + ib);
\r
283 // suiheisen ni setsuzoku
\r
287 if(poly2.array[index].y <= y1 && y1 <= poly2.array[index + 1].y){
\r
292 newx1 = poly2.array[index + 1].x + (poly2.array[index].x - poly2.array[index + 1].x) *
\r
293 (poly2.array[index + 1].y - y1) / (poly2.array[index + 1].y - poly2.array[index].y);
\r
295 newx2 = poly.array[0].x + (poly.array[0].x - poly.array[1].x) * (poly.array[0].y - y1) /
\r
296 (poly.array[1].y - poly.array[0].y);
\r
299 for(var i = 0; i < index; i++){
\r
302 poly2.set(0, newx1, newy1);
\r
303 poly.unshift(newx2, newy2);
\r
307 poly.concat(poly2);
\r
308 polygons.push(poly);
\r
311 //process for head of stroke
\r
312 rad = Math.atan((sy1 - y1) / (sx1 - x1));
\r
313 if(x1 < sx1){ v = 1; } else{ v = -1; }
\r
314 XX = Math.sin(rad) * v;
\r
315 XY = Math.cos(rad) * v * -1;
\r
316 YX = Math.cos(rad) * v;
\r
317 YY = Math.sin(rad) * v;
\r
321 poly= new Polygon();
\r
322 poly.push(x1 - kMinWidthT, y1);
\r
323 poly.push(x1 + kMinWidthT, y1);
\r
324 poly.push(x1 - kMinWidthT, y1 - kMinWidthT);
\r
325 polygons.push(poly);
\r
328 poly = new Polygon();
\r
329 poly.push(x1 - kMinWidthT * XX, y1 - kMinWidthT * XY);
\r
330 poly.push(x1 + kMinWidthT * XX, y1 + kMinWidthT * XY);
\r
331 poly.push(x1 - kMinWidthT * XX - kMinWidthT * YX, y1 - kMinWidthT * XY - kMinWidthT * YY);
\r
332 polygons.push(poly);
\r
339 if(y1 <= y2){ //from up to bottom
\r
340 type = (Math.atan2(Math.abs(y1 - sy1), Math.abs(x1 - sx1)) / Math.PI * 2 - 0.4);
\r
352 poly = new Polygon();
\r
353 poly.push(x1 - kMinWidthT, y1);
\r
354 poly.push(x1 + kMinWidthT, y1);
\r
355 poly.push(x1 - kMinWidthT * pm, y1 - kage.kMinWidthY * type * pm);
\r
356 polygons.push(poly);
\r
359 poly = new Polygon();
\r
360 poly.push(x1 - kMinWidthT * XX, y1 - kMinWidthT * XY);
\r
361 poly.push(x1 + kMinWidthT * XX, y1 + kMinWidthT * XY);
\r
362 poly.push(x1 - kMinWidthT * pm * XX - kage.kMinWidthY * type * pm * YX, y1 - kMinWidthT * pm * XY - kage.kMinWidthY * type * pm * YY);
\r
363 polygons.push(poly);
\r
366 else{ //bottom to up
\r
368 poly = new Polygon();
\r
369 poly.push(x1 - kMinWidthT, y1);
\r
370 poly.push(x1 + kMinWidthT, y1);
\r
371 poly.push(x1 + kMinWidthT, y1 - kage.kMinWidthY);
\r
372 polygons.push(poly);
\r
375 poly = new Polygon();
\r
376 poly.push(x1 - kMinWidthT * XX, y1 - kMinWidthT * XY);
\r
377 poly.push(x1 + kMinWidthT * XX, y1 + kMinWidthT * XY);
\r
378 poly.push(x1 + kMinWidthT * XX - kage.kMinWidthY * YX, y1 + kMinWidthT * XY - kage.kMinWidthY * YY);
\r
379 polygons.push(poly);
\r
384 if(a1 == 22){ //box's up-right corner, any time same degree
\r
385 poly = new Polygon();
\r
386 poly.push(x1 - kMinWidthT, y1 - kage.kMinWidthY);
\r
387 poly.push(x1, y1 - kage.kMinWidthY - kage.kWidth);
\r
388 poly.push(x1 + kMinWidthT + kage.kWidth, y1 + kage.kMinWidthY);
\r
389 poly.push(x1 + kMinWidthT, y1 + kMinWidthT);
\r
390 poly.push(x1, y1 + kMinWidthT);
\r
391 polygons.push(poly);
\r
394 if(a1 == 0){ //beginning of the stroke
\r
395 if(y1 <= y2){ //from up to bottom
\r
399 var move = kage.kMinWidthY * type * pm;
\r
401 poly = new Polygon();
\r
402 poly.push(x1 + kMinWidthT, y1 - move);
\r
403 poly.push(x1 + kMinWidthT * 1.5, y1 + kage.kMinWidthY - move);
\r
404 poly.push(x1 + kMinWidthT * 0.5, y1 + kage.kMinWidthY * 3 - move / 2);
\r
405 polygons.push(poly);
\r
408 poly = new Polygon();
\r
409 poly.push(x1 + kMinWidthT * XX - move * YX,
\r
410 y1 + kMinWidthT * XY - move * YY);
\r
411 poly.push(x1 + kMinWidthT * 1.5 * XX + (kage.kMinWidthY - move * 1.2) * YX,
\r
412 y1 + kMinWidthT * 1.5 * XY + (kage.kMinWidthY - move * 1.2) * YY);
\r
413 poly.push(x1 + kMinWidthT * 0.5 * XX + (kage.kMinWidthY * 3 - move * 0.8) * YX,
\r
414 y1 + kMinWidthT * 0.5 * XY + (kage.kMinWidthY * 3 - move * 0.8) * YY);
\r
415 polygons.push(poly);
\r
418 else{ //from bottom to up
\r
420 poly = new Polygon();
\r
421 poly.push(x1 - kMinWidthT, y1);
\r
422 poly.push(x1 - kMinWidthT * 1.5, y1 + kage.kMinWidthY);
\r
423 poly.push(x1 - kMinWidthT * 0.5, y1 + kage.kMinWidthY * 3);
\r
424 polygons.push(poly);
\r
427 poly = new Polygon();
\r
428 poly.push(x1 - kMinWidthT * XX, y1 - kMinWidthT * XY);
\r
429 poly.push(x1 - kMinWidthT * 1.5 * XX + kage.kMinWidthY * YX, y1 + kage.kMinWidthY * YY - kMinWidthT * 1.5 * XY);
\r
430 poly.push(x1 - kMinWidthT * 0.5 * XX + kage.kMinWidthY * 3 * YX, y1 + kage.kMinWidthY * 3 * YY - kMinWidthT * 0.5 * XY);
\r
431 polygons.push(poly);
\r
437 rad = Math.atan((y2 - sy2) / (x2 - sx2));
\r
438 if(sx2 < x2){ v = 1; } else{ v = -1; }
\r
439 YX = Math.sin(rad) * v * -1;
\r
440 YY = Math.cos(rad) * v;
\r
441 XX = Math.cos(rad) * v;
\r
442 XY = Math.sin(rad) * v;
\r
444 if(a2 == 1 || a2 == 8 || a2 == 15){ //the last filled circle ... it can change 15->5
\r
446 poly = new Polygon();
\r
447 if(kage.kUseCurve){
\r
449 poly.push(x2 - kMinWidthT, y2);
\r
450 poly.push(x2 - kMinWidthT * 0.9, y2 + kMinWidthT * 0.9, 1);
\r
451 poly.push(x2, y2 + kMinWidthT);
\r
452 poly.push(x2 + kMinWidthT * 0.9, y2 + kMinWidthT * 0.9, 1);
\r
453 poly.push(x2 + kMinWidthT, y2);
\r
456 poly.push(x2 - kMinWidthT, y2);
\r
457 poly.push(x2 - kMinWidthT * 0.7, y2 + kMinWidthT * 0.7);
\r
458 poly.push(x2, y2 + kMinWidthT);
\r
459 poly.push(x2 + kMinWidthT * 0.7, y2 + kMinWidthT * 0.7);
\r
460 poly.push(x2 + kMinWidthT, y2);
\r
462 polygons.push(poly);
\r
464 else if(sy2 == y2){
\r
465 poly = new Polygon();
\r
466 if(kage.kUseCurve){
\r
468 poly.push(x2, y2 - kMinWidthT);
\r
469 poly.push(x2 + kMinWidthT * 0.9, y2 - kMinWidthT * 0.9, 1);
\r
470 poly.push(x2 + kMinWidthT, y2);
\r
471 poly.push(x2 + kMinWidthT * 0.9, y2 + kMinWidthT * 0.9, 1);
\r
472 poly.push(x2, y2 + kMinWidthT);
\r
475 poly.push(x2, y2 - kMinWidthT);
\r
476 poly.push(x2 + kMinWidthT * 0.7, y2 - kMinWidthT * 0.7);
\r
477 poly.push(x2 + kMinWidthT, y2);
\r
478 poly.push(x2 + kMinWidthT * 0.7, y2 + kMinWidthT * 0.7);
\r
479 poly.push(x2, y2 + kMinWidthT);
\r
481 polygons.push(poly);
\r
484 poly = new Polygon();
\r
485 if(kage.kUseCurve){
\r
486 poly.push(x2 + Math.sin(rad) * kMinWidthT * v, y2 - Math.cos(rad) * kMinWidthT * v);
\r
487 poly.push(x2 + Math.cos(rad) * kMinWidthT * 0.9 * v + Math.sin(rad) * kMinWidthT * 0.9 * v,
\r
488 y2 + Math.sin(rad) * kMinWidthT * 0.9 * v - Math.cos(rad) * kMinWidthT * 0.9 * v, 1);
\r
489 poly.push(x2 + Math.cos(rad) * kMinWidthT * v, y2 + Math.sin(rad) * kMinWidthT * v);
\r
490 poly.push(x2 + Math.cos(rad) * kMinWidthT * 0.9 * v - Math.sin(rad) * kMinWidthT * 0.9 * v,
\r
491 y2 + Math.sin(rad) * kMinWidthT * 0.9 * v + Math.cos(rad) * kMinWidthT * 0.9 * v, 1);
\r
492 poly.push(x2 - Math.sin(rad) * kMinWidthT * v, y2 + Math.cos(rad) * kMinWidthT * v);
\r
494 poly.push(x2 + Math.sin(rad) * kMinWidthT * v, y2 - Math.cos(rad) * kMinWidthT * v);
\r
495 poly.push(x2 + Math.cos(rad) * kMinWidthT * 0.7 * v + Math.sin(rad) * kMinWidthT * 0.7 * v,
\r
496 y2 + Math.sin(rad) * kMinWidthT * 0.7 * v - Math.cos(rad) * kMinWidthT * 0.7 * v);
\r
497 poly.push(x2 + Math.cos(rad) * kMinWidthT * v, y2 + Math.sin(rad) * kMinWidthT * v);
\r
498 poly.push(x2 + Math.cos(rad) * kMinWidthT * 0.7 * v - Math.sin(rad) * kMinWidthT * 0.7 * v,
\r
499 y2 + Math.sin(rad) * kMinWidthT * 0.7 * v + Math.cos(rad) * kMinWidthT * 0.7 * v);
\r
500 poly.push(x2 - Math.sin(rad) * kMinWidthT * v, y2 + Math.cos(rad) * kMinWidthT * v);
\r
502 polygons.push(poly);
\r
506 if(a2 == 9 || (a1 == 7 && a2 == 0)){ // Math.sinnyu & L2RD Harai ... no need for a2=9
\r
507 var type = (Math.atan2(Math.abs(y2 - sy2), Math.abs(x2 - sx2)) / Math.PI * 2 - 0.6);
\r
520 poly = new Polygon();
\r
521 poly.push(x2, y2 + kMinWidthT * kage.kL2RDfatten);
\r
522 poly.push(x2, y2 - kMinWidthT * kage.kL2RDfatten);
\r
523 poly.push(x2 + kMinWidthT * kage.kL2RDfatten * Math.abs(type), y2 + kMinWidthT * kage.kL2RDfatten * pm);
\r
524 polygons.push(poly);
\r
527 poly = new Polygon();
\r
528 poly.push(x2 + kMinWidthT * kage.kL2RDfatten * YX, y2 + kMinWidthT * kage.kL2RDfatten * YY);
\r
529 poly.push(x2 - kMinWidthT * kage.kL2RDfatten * YX, y2 - kMinWidthT * kage.kL2RDfatten * YY);
\r
530 poly.push(x2 + kMinWidthT * kage.kL2RDfatten * Math.abs(type) * XX + kMinWidthT * kage.kL2RDfatten * pm * YX,
\r
531 y2 + kMinWidthT * kage.kL2RDfatten * Math.abs(type) * XY + kMinWidthT * kage.kL2RDfatten * pm * YY);
\r
532 polygons.push(poly);
\r
536 if(a2 == 15){ //jump up ... it can change 15->5
\r
538 poly = new Polygon();
\r
539 poly.push(x2, y2 - kMinWidthT + 1);
\r
540 poly.push(x2 + 2, y2 - kMinWidthT - kage.kWidth * 5);
\r
541 poly.push(x2, y2 - kMinWidthT - kage.kWidth * 5);
\r
542 poly.push(x2 - kMinWidthT, y2 - kMinWidthT + 1);
\r
543 polygons.push(poly);
\r
546 poly = new Polygon();
\r
547 poly.push(x2 + (kMinWidthT - 1) * Math.sin(rad) * v, y2 - (kMinWidthT - 1) * Math.cos(rad) * v);
\r
548 poly.push(x2 + 2 * Math.cos(rad) * v + (kMinWidthT + kage.kWidth * 5) * Math.sin(rad) * v,
\r
549 y2 + 2 * Math.sin(rad) * v - (kMinWidthT + kage.kWidth * 5) * Math.cos(rad) * v);
\r
550 poly.push(x2 + (kMinWidthT + kage.kWidth * 5) * Math.sin(rad) * v,
\r
551 y2 - (kMinWidthT + kage.kWidth * 5) * Math.cos(rad) * v);
\r
552 poly.push(x2 + (kMinWidthT - 1) * Math.sin(rad) * v - kMinWidthT * Math.cos(rad) * v,
\r
553 y2 - (kMinWidthT - 1) * Math.cos(rad) * v - kMinWidthT * Math.sin(rad) * v);
\r
554 polygons.push(poly);
\r
558 if(a2 == 14){ //jump to left, allways go left
\r
559 poly = new Polygon();
\r
561 poly.push(x2, y2 - kMinWidthT);
\r
562 poly.push(x2 - kage.kWidth * 4 * Math.pow(kMinWidthT / kage.kMinWidthT, 3), y2 - kMinWidthT);
\r
563 poly.push(x2 - kage.kWidth * 4 * Math.pow(kMinWidthT / kage.kMinWidthT, 3), y2 - kMinWidthT * 0.5);
\r
564 polygons.push(poly);
\r
570 if(y1 < sy1){ y1 = y1 - kage.kWidth; } else{ y1 = y1 + kage.kWidth; }
\r
572 else if(y1 == sy1){
\r
573 if(x1 < sx1){ x1 = x1 - kage.kWidth; } else{ x1 = x1 + kage.kWidth; }
\r
576 rad = Math.atan((sy1 - y1) / (sx1 - x1));
\r
577 if(x1 < sx1){ v = 1; } else{ v = -1; }
\r
578 x1 = x1 - kage.kWidth * Math.cos(rad) * v;
\r
579 y1 = y1 - kage.kWidth * Math.sin(rad) * v;
\r
586 y1 = y1 - kage.kWidth * kage.kKakato;
\r
589 y1 = y1 + kage.kWidth * kage.kKakato;
\r
592 else if(y1 == sy1){
\r
594 x1 = x1 - kage.kWidth * kage.kKakato;
\r
597 x1 = x1 + kage.kWidth * kage.kKakato;
\r
601 rad = Math.atan((sy1 - y1) / (sx1 - x1));
\r
602 if(x1 < sx1){ v = 1; } else{ v = -1; }
\r
603 x1 = x1 - kage.kWidth * Math.cos(rad) * v * kage.kKakato;
\r
604 y1 = y1 - kage.kWidth * Math.sin(rad) * v * kage.kKakato;
\r
609 if(sy2 < y2){ y2 = y2 + kage.kWidth; } else{ y2 = y2 - kage.kWidth; }
\r
611 else if(sy2 == y2){
\r
612 if(sx2 < x2){ x2 = x2 + kage.kWidth; } else{ x2 = x2 - kage.kWidth; }
\r
615 rad = Math.atan((y2 - sy2) / (x2 - sx2));
\r
616 if(sx2 < x2){ v = 1; } else{ v = -1; }
\r
617 x2 = x2 + kage.kWidth * Math.cos(rad) * v;
\r
618 y2 = y2 + kage.kWidth * Math.sin(rad) * v;
\r
625 y2 = y2 + kage.kWidth * kage.kKakato;
\r
628 y2 = y2 - kage.kWidth * kage.kKakato;
\r
631 else if(sy2 == y2){
\r
633 x2 = x2 + kage.kWidth * kage.kKakato;
\r
636 x2 = x2 - kage.kWidth * kage.kKakato;
\r
640 rad = Math.atan((y2 - sy2) / (x2 - sx2));
\r
641 if(sx2 < x2){ v = 1; } else{ v = -1; }
\r
642 x2 = x2 + kage.kWidth * Math.cos(rad) * v * kage.kKakato;
\r
643 y2 = y2 + kage.kWidth * Math.sin(rad) * v * kage.kKakato;
\r
647 poly = new Polygon();
\r
648 poly2 = new Polygon();
\r
650 for(tt = 0; tt <= 1000; tt = tt + kage.kRate){
\r
653 if(sx1 == sx2 && sy1 == sy2){
\r
654 //calculating each point
\r
655 x = ((1.0 - t) * (1.0 - t) * x1 + 2.0 * t * (1.0 - t) * sx1 + t * t * x2);
\r
656 y = ((1.0 - t) * (1.0 - t) * y1 + 2.0 * t * (1.0 - t) * sy1 + t * t * y2);
\r
658 //SESSEN NO KATAMUKI NO KEISAN(BIBUN)
\r
659 ix = (x1 - 2.0 * sx1 + x2) * 2.0 * t + (-2.0 * x1 + 2.0 * sx1);
\r
660 iy = (y1 - 2.0 * sy1 + y2) * 2.0 * t + (-2.0 * y1 + 2.0 * sy1);
\r
663 //SESSEN NI SUICHOKU NA CHOKUSEN NO KEISAN
\r
664 if(kage.kShotai == kage.kMincho){ //always false ?
\r
665 if(ix != 0 && iy != 0){
\r
666 ir = Math.atan(iy / ix * -1.0);
\r
667 ia = Math.sin(ir) * kage.kMinWidthT;
\r
668 ib = Math.cos(ir) * kage.kMinWidthT;
\r
671 ia = kage.kMinWidthT;
\r
676 ib = kage.kMinWidthT;
\r
678 ia = ia * Math.sqrt(1.0 - t);
\r
679 ib = ib * Math.sqrt(1.0 - t);
\r
682 if(ix != 0 && iy != 0){
\r
683 ir = Math.atan(iy / ix * -1.0);
\r
684 ia = Math.sin(ir) * kage.kWidth;
\r
685 ib = Math.cos(ir) * kage.kWidth;
\r
697 //reverse if vector is going 2nd/3rd quadrants
\r
704 poly.push(x - ia, y - ib);
\r
705 poly2.push(x + ia, y + ib);
\r
709 poly.concat(poly2);
\r
710 polygons.push(poly);
\r
714 function cdDrawBezier(kage, polygons, x1, y1, x2, y2, x3, y3, x4, y4, a1, a2){
\r
715 cdDrawCurveU(kage, polygons, x1, y1, x2, y2, x3, y3, x4, y4, a1, a2);
\r
718 function cdDrawCurve(kage, polygons, x1, y1, x2, y2, x3, y3, a1, a2){
\r
719 cdDrawCurveU(kage, polygons, x1, y1, x2, y2, x2, y2, x3, y3, a1, a2);
\r
722 function cdDrawLine(kage, polygons, tx1, ty1, tx2, ty2, ta1, ta2){
\r
724 var v, x1, y1, x2, y2;
\r
725 var a1, a2, opt1, opt2;
\r
726 var XX, XY, YX, YY;
\r
730 if(kage.kShotai == kage.kMincho){ //mincho
\r
737 opt1 = Math.floor(ta1 / 1000);
\r
738 opt2 = Math.floor(ta2 / 100);
\r
740 kMinWidthT = kage.kMinWidthT - opt1 / 2;
\r
742 if(x1 == x2){ //if TATE stroke, use y-axis
\r
743 poly = new Polygon(4);
\r
746 poly.set(3, x1 - kMinWidthT, y1 - kage.kMinWidthY / 2);
\r
747 poly.set(0, x1 + kMinWidthT, y1 + kage.kMinWidthY / 2);
\r
750 case 6: //... no need
\r
752 poly.set(3, x1 - kMinWidthT, y1);
\r
753 poly.set(0, x1 + kMinWidthT, y1);
\r
756 poly.set(3, x1 - kMinWidthT, y1 - kage.kMinWidthY - kMinWidthT);
\r
757 poly.set(0, x1 + kMinWidthT, y1 - kage.kMinWidthY);
\r
760 poly.set(3, x1 - kMinWidthT, y1 - kage.kMinWidthY);
\r
761 poly.set(0, x1 + kMinWidthT, y1 - kage.kMinWidthY);
\r
767 if(a1 == 6){ //KAGI's tail ... no need
\r
768 poly.set(2, x2 - kMinWidthT, y2);
\r
769 poly.set(1, x2 + kMinWidthT, y2);
\r
772 poly.set(2, x2 - kMinWidthT, y2 + kMinWidthT / 2);
\r
773 poly.set(1, x2 + kMinWidthT, y2 - kMinWidthT / 2);
\r
777 poly.set(2, x2 - kMinWidthT, y2);
\r
778 poly.set(1, x2 + kMinWidthT, y2);
\r
781 poly.set(2, x2 - kMinWidthT, y2 + kage.kAdjustKakatoL[opt2] + kMinWidthT);
\r
782 poly.set(1, x2 + kMinWidthT, y2 + kage.kAdjustKakatoL[opt2]);
\r
785 poly.set(2, x2 - kMinWidthT, y2 + kage.kAdjustKakatoR[opt2] + kMinWidthT);
\r
786 poly.set(1, x2 + kMinWidthT, y2 + kage.kAdjustKakatoR[opt2]);
\r
789 poly.set(2, x2 - kMinWidthT, y2 + kage.kMinWidthY);
\r
790 poly.set(1, x2 + kMinWidthT, y2 + kage.kMinWidthY);
\r
794 polygons.push(poly);
\r
796 if(a1 == 22){ //box's right top corner
\r
797 poly = new Polygon();
\r
798 poly.push(x1 - kMinWidthT, y1 - kage.kMinWidthY);
\r
799 poly.push(x1, y1 - kage.kMinWidthY - kage.kWidth);
\r
800 poly.push(x1 + kMinWidthT + kage.kWidth, y1 + kage.kMinWidthY);
\r
801 poly.push(x1 + kMinWidthT, y1 + kMinWidthT);
\r
802 poly.push(x1 - kMinWidthT, y1);
\r
803 polygons.push(poly);
\r
806 if(a1 == 0){ //beginning of the stroke
\r
807 poly = new Polygon();
\r
808 poly.push(x1 + kMinWidthT, y1 + kage.kMinWidthY * 0.5);
\r
809 poly.push(x1 + kMinWidthT + kMinWidthT * 0.5, y1 + kage.kMinWidthY * 0.5 + kage.kMinWidthY);
\r
810 poly.push(x1 + kMinWidthT, y1 + kage.kMinWidthY * 0.5 + kage.kMinWidthY * 2);
\r
811 polygons.push(poly);
\r
814 if((a1 == 6 && a2 == 0) || a2 == 1){ //KAGI NO YOKO BOU NO SAIGO NO MARU ... no need only used at 1st=yoko
\r
815 poly = new Polygon();
\r
816 if(kage.kUseCurve){
\r
817 poly.push(x2 - kMinWidthT, y2);
\r
818 poly.push(x2 - kMinWidthT * 0.9, y2 + kMinWidthT * 0.9, 1);
\r
819 poly.push(x2, y2 + kMinWidthT);
\r
820 poly.push(x2 + kMinWidthT * 0.9, y2 + kMinWidthT * 0.9, 1);
\r
821 poly.push(x2 + kMinWidthT, y2);
\r
823 poly.push(x2 - kMinWidthT, y2);
\r
824 poly.push(x2 - kMinWidthT * 0.6, y2 + kMinWidthT * 0.6);
\r
825 poly.push(x2, y2 + kMinWidthT);
\r
826 poly.push(x2 + kMinWidthT * 0.6, y2 + kMinWidthT * 0.6);
\r
827 poly.push(x2 + kMinWidthT, y2);
\r
829 poly.reverse(); // for fill-rule
\r
830 polygons.push(poly);
\r
833 else if(y1 == y2){ //if it is YOKO stroke, use x-axis
\r
834 if(a1 == 6){ //if it is KAGI's YOKO stroke, get bold
\r
835 poly = new Polygon();
\r
836 poly.push(x1, y1 - kMinWidthT);
\r
837 poly.push(x2, y2 - kMinWidthT);
\r
838 poly.push(x2, y2 + kMinWidthT);
\r
839 poly.push(x1, y1 + kMinWidthT);
\r
840 polygons.push(poly);
\r
842 if(a2 == 1 || a2 == 0 || a2 == 5){ // no need a2=1
\r
843 //KAGI NO YOKO BOU NO SAIGO NO MARU
\r
844 poly = new Polygon();
\r
845 if(kage.kUseCurve){
\r
846 poly.push(x2, y2 - kMinWidthT);
\r
847 poly.push(x2 + kMinWidthT * 0.9, y2 - kMinWidthT * 0.9, 1);
\r
848 poly.push(x2 + kMinWidthT, y2);
\r
849 poly.push(x2 + kMinWidthT * 0.9, y2 + kMinWidthT * 0.9, 1);
\r
850 poly.push(x2, y2 + kMinWidthT);
\r
852 poly.push(x2, y2 - kMinWidthT);
\r
853 poly.push(x2 + kMinWidthT * 0.6, y2 - kMinWidthT * 0.6);
\r
854 poly.push(x2 + kMinWidthT, y2);
\r
855 poly.push(x2 + kMinWidthT * 0.6, y2 + kMinWidthT * 0.6);
\r
856 poly.push(x2, y2 + kMinWidthT);
\r
858 polygons.push(poly);
\r
862 //KAGI NO YOKO BOU NO HANE
\r
863 poly = new Polygon();
\r
864 poly.push(x2, y2 - kMinWidthT + 1);
\r
865 poly.push(x2 + 2, y2 - kMinWidthT - kage.kWidth * 5);
\r
866 poly.push(x2, y2 - kMinWidthT - kage.kWidth * 5);
\r
867 poly.push(x2 - kMinWidthT, y2 - kMinWidthT + 1);
\r
868 poly.reverse(); // for fill-rule
\r
869 polygons.push(poly);
\r
874 poly = new Polygon(4);
\r
875 poly.set(0, x1, y1 - kage.kMinWidthY);
\r
876 poly.set(1, x2, y2 - kage.kMinWidthY);
\r
877 poly.set(2, x2, y2 + kage.kMinWidthY);
\r
878 poly.set(3, x1, y1 + kage.kMinWidthY);
\r
879 polygons.push(poly);
\r
883 poly = new Polygon();
\r
884 poly.push(x2, y2 - kage.kMinWidthY);
\r
885 poly.push(x2 - kage.kAdjustUrokoX[opt2], y2);
\r
886 poly.push(x2 - kage.kAdjustUrokoX[opt2] / 2, y2 - kage.kAdjustUrokoY[opt2]);
\r
887 polygons.push(poly);
\r
891 else{ //for others, use x-axis
\r
892 rad = Math.atan((y2 - y1) / (x2 - x1));
\r
893 if((Math.abs(y2 - y1) < Math.abs(x2 - x1)) && (a1 != 6) && (a2 != 6) && !(x1 > x2)){ //ASAI KAUDO
\r
895 poly = new Polygon(4);
\r
896 poly.set(0, x1 + Math.sin(rad) * kage.kMinWidthY, y1 - Math.cos(rad) * kage.kMinWidthY);
\r
897 poly.set(1, x2 + Math.sin(rad) * kage.kMinWidthY, y2 - Math.cos(rad) * kage.kMinWidthY);
\r
898 poly.set(2, x2 - Math.sin(rad) * kage.kMinWidthY, y2 + Math.cos(rad) * kage.kMinWidthY);
\r
899 poly.set(3, x1 - Math.sin(rad) * kage.kMinWidthY, y1 + Math.cos(rad) * kage.kMinWidthY);
\r
900 polygons.push(poly);
\r
904 poly = new Polygon();
\r
905 poly.push(x2 + Math.sin(rad) * kage.kMinWidthY, y2 - Math.cos(rad) * kage.kMinWidthY);
\r
906 poly.push(x2 - Math.cos(rad) * kage.kAdjustUrokoX[opt2], y2 - Math.sin(rad) * kage.kAdjustUrokoX[opt2]);
\r
907 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
908 polygons.push(poly);
\r
912 else{ //KAKUDO GA FUKAI or KAGI NO YOKO BOU
\r
913 if(x1 > x2){ v = -1; } else{ v = 1; }
\r
914 poly = new Polygon(4);
\r
917 poly.set(0, x1 + Math.sin(rad) * kMinWidthT * v + kage.kMinWidthY * Math.cos(rad) * 0.5 * v,
\r
918 y1 - Math.cos(rad) * kMinWidthT * v + kage.kMinWidthY * Math.sin(rad) * 0.5 * v);
\r
919 poly.set(3, x1 - Math.sin(rad) * kMinWidthT * v - kage.kMinWidthY * Math.cos(rad) * 0.5 * v,
\r
920 y1 + Math.cos(rad) * kMinWidthT * v - kage.kMinWidthY * Math.sin(rad) * 0.5 * v);
\r
925 poly.set(0, x1 + Math.sin(rad) * kMinWidthT * v, y1 - Math.cos(rad) * kMinWidthT * v);
\r
926 poly.set(3, x1 - Math.sin(rad) * kMinWidthT * v, y1 + Math.cos(rad) * kMinWidthT * v);
\r
929 poly.set(0, x1 + Math.sin(rad) * kMinWidthT * v - kage.kMinWidthY * Math.cos(rad) * v,
\r
930 y1 - Math.cos(rad) * kMinWidthT * v - kage.kMinWidthY * Math.sin(rad) * v);
\r
931 poly.set(3, x1 - Math.sin(rad) * kMinWidthT * v - (kMinWidthT + kage.kMinWidthY) * Math.cos(rad) * v,
\r
932 y1 + Math.cos(rad) * kMinWidthT * v - (kMinWidthT + kage.kMinWidthY) * Math.sin(rad) * v);
\r
935 poly.set(0, x1 + Math.sin(rad) * kMinWidthT * v - kage.kMinWidthY * Math.cos(rad) * v,
\r
936 y1 - Math.cos(rad) * kMinWidthT * v - kage.kMinWidthY * Math.sin(rad) * v);
\r
937 poly.set(3, x1 - Math.sin(rad) * kMinWidthT * v - kage.kMinWidthY * Math.cos(rad) * v,
\r
938 y1 + Math.cos(rad) * kMinWidthT * v - kage.kMinWidthY * Math.sin(rad) * v);
\r
945 poly.set(1, x2 + Math.sin(rad) * kMinWidthT * v, y2 - Math.cos(rad) * kMinWidthT * v);
\r
946 poly.set(2, x2 - Math.sin(rad) * kMinWidthT * v, y2 + Math.cos(rad) * kMinWidthT * v);
\r
949 poly.set(1, x2 + Math.sin(rad) * kMinWidthT * v - kMinWidthT * 0.5 * Math.cos(rad) * v,
\r
950 y2 - Math.cos(rad) * kMinWidthT * v - kMinWidthT * 0.5 * Math.sin(rad) * v);
\r
951 poly.set(2, x2 - Math.sin(rad) * kMinWidthT * v + kMinWidthT * 0.5 * Math.cos(rad) * v,
\r
952 y2 + Math.cos(rad) * kMinWidthT * v + kMinWidthT * 0.5 * Math.sin(rad) * v);
\r
955 case 1: // is needed?
\r
957 poly.set(1, x2 + Math.sin(rad) * kMinWidthT * v, y2 - Math.cos(rad) * kMinWidthT * v);
\r
958 poly.set(2, x2 - Math.sin(rad) * kMinWidthT * v, y2 + Math.cos(rad) * kMinWidthT * v);
\r
961 poly.set(1, x2 + Math.sin(rad) * kMinWidthT * v + kage.kAdjustKakatoL[opt2] * Math.cos(rad) * v,
\r
962 y2 - Math.cos(rad) * kMinWidthT * v + kage.kAdjustKakatoL[opt2] * Math.sin(rad) * v);
\r
963 poly.set(2, x2 - Math.sin(rad) * kMinWidthT * v + (kage.kAdjustKakatoL[opt2] + kMinWidthT) * Math.cos(rad) * v,
\r
964 y2 + Math.cos(rad) * kMinWidthT * v + (kage.kAdjustKakatoL[opt2] + kMinWidthT) * Math.sin(rad) * v);
\r
967 poly.set(1, x2 + Math.sin(rad) * kMinWidthT * v + kage.kAdjustKakatoR[opt2] * Math.cos(rad) * v,
\r
968 y2 - Math.cos(rad) * kMinWidthT * v + kage.kAdjustKakatoR[opt2] * Math.sin(rad) * v);
\r
970 x2 - Math.sin(rad) * kMinWidthT * v + (kage.kAdjustKakatoR[opt2] + kMinWidthT) * Math.cos(rad) * v,
\r
971 y2 + Math.cos(rad) * kMinWidthT * v + (kage.kAdjustKakatoR[opt2] + kMinWidthT) * Math.sin(rad) * v);
\r
974 poly.set(1, x2 + Math.sin(rad) * kMinWidthT * v + kage.kMinWidthY * Math.cos(rad) * v,
\r
975 y2 - Math.cos(rad) * kMinWidthT * v + kage.kMinWidthY * Math.sin(rad) * v);
\r
976 poly.set(2, x2 - Math.sin(rad) * kMinWidthT * v + kage.kMinWidthY * Math.cos(rad) * v,
\r
977 y2 + Math.cos(rad) * kMinWidthT * v + kage.kMinWidthY * Math.sin(rad) * v);
\r
981 polygons.push(poly);
\r
983 if((a1 == 6) && (a2 == 0 || a2 == 5)){ //KAGI NO YOKO BOU NO SAIGO NO MARU
\r
984 poly = new Polygon();
\r
985 if(kage.kUseCurve){
\r
986 poly.push(x2 + Math.sin(rad) * kMinWidthT * v, y2 - Math.cos(rad) * kMinWidthT * v);
\r
987 poly.push(x2 + Math.cos(rad) * kMinWidthT * 0.9 * v + Math.sin(rad) * kMinWidthT * 0.9 * v,
\r
988 y2 + Math.sin(rad) * kMinWidthT * 0.9 * v - Math.cos(rad) * kMinWidthT * 0.9 * v, 1);
\r
989 poly.push(x2 + Math.cos(rad) * kMinWidthT * v, y2 + Math.sin(rad) * kMinWidthT * v);
\r
990 poly.push(x2 + Math.cos(rad) * kMinWidthT * 0.9 * v - Math.sin(rad) * kMinWidthT * 0.9 * v,
\r
991 y2 + Math.sin(rad) * kMinWidthT * 0.9 * v + Math.cos(rad) * kMinWidthT * 0.9 * v, 1);
\r
992 poly.push(x2 - Math.sin(rad) * kMinWidthT * v, y2 + Math.cos(rad) * kMinWidthT * v);
\r
994 poly.push(x2 + Math.sin(rad) * kMinWidthT * v, y2 - Math.cos(rad) * kMinWidthT * v);
\r
995 poly.push(x2 + Math.cos(rad) * kMinWidthT * 0.8 * v + Math.sin(rad) * kMinWidthT * 0.6 * v,
\r
996 y2 + Math.sin(rad) * kMinWidthT * 0.8 * v - Math.cos(rad) * kMinWidthT * 0.6 * v);
\r
997 poly.push(x2 + Math.cos(rad) * kMinWidthT * v, y2 + Math.sin(rad) * kMinWidthT * v);
\r
998 poly.push(x2 + Math.cos(rad) * kMinWidthT * 0.8 * v - Math.sin(rad) * kMinWidthT * 0.6 * v,
\r
999 y2 + Math.sin(rad) * kMinWidthT * 0.8 * v + Math.cos(rad) * kMinWidthT * 0.6 * v);
\r
1000 poly.push(x2 - Math.sin(rad) * kMinWidthT * v, y2 + Math.cos(rad) * kMinWidthT * v);
\r
1002 polygons.push(poly);
\r
1005 if(a1 == 6 && a2 == 5){
\r
1006 //KAGI NO YOKO BOU NO HANE
\r
1007 poly = new Polygon();
\r
1008 poly.push(x2 + (kMinWidthT - 1) * Math.sin(rad) * v, y2 - (kMinWidthT - 1) * Math.cos(rad) * v);
\r
1009 poly.push(x2 + 2 * Math.cos(rad) * v + (kMinWidthT + kage.kWidth * 5) * Math.sin(rad) * v,
\r
1010 y2 + 2 * Math.sin(rad) * v - (kMinWidthT + kage.kWidth * 5) * Math.cos(rad) * v);
\r
1011 poly.push(x2 + (kMinWidthT + kage.kWidth * 5) * Math.sin(rad) * v,
\r
1012 y2 - (kMinWidthT + kage.kWidth * 5) * Math.cos(rad) * v);
\r
1013 poly.push(x2 + (kMinWidthT - 1) * Math.sin(rad) * v - kMinWidthT * Math.cos(rad) * v,
\r
1014 y2 - (kMinWidthT - 1) * Math.cos(rad) * v - kMinWidthT * Math.sin(rad) * v);
\r
1015 polygons.push(poly);
\r
1018 if(a1 == 22){ //SHIKAKU MIGIUE UROKO NANAME DEMO MASSUGU MUKI
\r
1019 poly = new Polygon();
\r
1020 poly.push(x1 - kMinWidthT, y1 - kage.kMinWidthY);
\r
1021 poly.push(x1, y1 - kage.kMinWidthY - kage.kWidth);
\r
1022 poly.push(x1 + kMinWidthT + kage.kWidth, y1 + kage.kMinWidthY);
\r
1023 poly.push(x1 + kMinWidthT, y1 + kMinWidthT);
\r
1024 poly.push(x1 - kMinWidthT, y1);
\r
1025 polygons.push(poly);
\r
1028 XX = Math.sin(rad) * v;
\r
1029 XY = Math.cos(rad) * v * -1;
\r
1030 YX = Math.cos(rad) * v;
\r
1031 YY = Math.sin(rad) * v;
\r
1033 if(a1 == 0){ //beginning of the storke
\r
1034 poly = new Polygon();
\r
1035 poly.push(x1 + kMinWidthT * XX + (kage.kMinWidthY * 0.5) * YX,
\r
1036 y1 + kMinWidthT * XY + (kage.kMinWidthY * 0.5) * YY);
\r
1037 poly.push(x1 + (kMinWidthT + kMinWidthT * 0.5) * XX + (kage.kMinWidthY * 0.5 + kage.kMinWidthY) * YX,
\r
1038 y1 + (kMinWidthT + kMinWidthT * 0.5) * XY + (kage.kMinWidthY * 0.5 + kage.kMinWidthY) * YY);
\r
1039 poly.push(x1 + kMinWidthT * XX + (kage.kMinWidthY * 0.5 + kage.kMinWidthY * 2) * YX,
\r
1040 y1 + kMinWidthT * XY + (kage.kMinWidthY * 0.5 + kage.kMinWidthY * 2) * YY);
\r
1041 polygons.push(poly);
\r
1047 if(tx1 == tx2){ //if TATE stroke, use y-axis
\r
1065 if(a1 % 10 == 2){ y1 = y1 - kage.kWidth; }
\r
1066 if(a2 % 10 == 2){ y2 = y2 + kage.kWidth; }
\r
1067 if(a1 % 10 == 3){ y1 = y1 - kage.kWidth * kage.kKakato; }
\r
1068 if(a2 % 10 == 3){ y2 = y2 + kage.kWidth * kage.kKakato; }
\r
1070 poly = new Polygon();
\r
1071 poly.push(x1 - kage.kWidth, y1);
\r
1072 poly.push(x2 - kage.kWidth, y2);
\r
1073 poly.push(x2 + kage.kWidth, y2);
\r
1074 poly.push(x1 + kage.kWidth, y1);
\r
1075 poly.reverse(); // for fill-rule
\r
1077 polygons.push(poly);
\r
1079 else if(ty1 == ty2){ //if YOKO stroke, use x-axis
\r
1096 if(a1 % 10 == 2){ x1 = x1 - kage.kWidth; }
\r
1097 if(a2 % 10 == 2){ x2 = x2 + kage.kWidth; }
\r
1098 if(a1 % 10 == 3){ x1 = x1 - kage.kWidth * kage.kKakato; }
\r
1099 if(a2 % 10 == 3){ x2 = x2 + kage.kWidth * kage.kKakato; }
\r
1101 poly = new Polygon();
\r
1102 poly.push(x1, y1 - kage.kWidth);
\r
1103 poly.push(x2, y2 - kage.kWidth);
\r
1104 poly.push(x2, y2 + kage.kWidth);
\r
1105 poly.push(x1, y1 + kage.kWidth);
\r
1107 polygons.push(poly);
\r
1109 else{ //for others, use x-axis
\r
1126 rad = Math.atan((y2 - y1) / (x2 - x1));
\r
1128 x1 = x1 - kage.kWidth * Math.cos(rad);
\r
1129 y1 = y1 - kage.kWidth * Math.sin(rad);
\r
1132 x2 = x2 + kage.kWidth * Math.cos(rad);
\r
1133 y2 = y2 + kage.kWidth * Math.sin(rad);
\r
1136 x1 = x1 - kage.kWidth * Math.cos(rad) * kage.kKakato;
\r
1137 y1 = y1 - kage.kWidth * Math.sin(rad) * kage.kKakato;
\r
1140 x2 = x2 + kage.kWidth * Math.cos(rad) * kage.kKakato;
\r
1141 y2 = y2 + kage.kWidth * Math.sin(rad) * kage.kKakato;
\r
1144 //SUICHOKU NO ICHI ZURASHI HA Math.sin TO Math.cos NO IREKAE + x-axis MAINASU KA
\r
1145 poly = new Polygon();
\r
1146 poly.push(x1 + Math.sin(rad) * kage.kWidth, y1 - Math.cos(rad) * kage.kWidth);
\r
1147 poly.push(x2 + Math.sin(rad) * kage.kWidth, y2 - Math.cos(rad) * kage.kWidth);
\r
1148 poly.push(x2 - Math.sin(rad) * kage.kWidth, y2 + Math.cos(rad) * kage.kWidth);
\r
1149 poly.push(x1 - Math.sin(rad) * kage.kWidth, y1 + Math.cos(rad) * kage.kWidth);
\r
1151 polygons.push(poly);
\r