394 if (result.length!=160)
397 var canv = document.getElementById(
"canvas");
400 var ch = canv.height;
402 var ctx = canv.getContext(
"2d");
404 ctx.clearRect(0, 0, cw, ch);
417 drawPix(0, 0, result.charCodeAt(0));
419 var gsSin60 = Math.sqrt(3)/2;
422 for (
var ring=1; ring<=30; ring++)
424 for (
var s=0; s<6; s++)
426 for (
var i=1;
i<=ring;
i++)
433 case 0: x = ring-
i*0.5; y =
i*gsSin60;
break;
434 case 1: x = ring*0.5-
i; y = ring*gsSin60;
break;
435 case 2: x = -(ring+
i)*0.5; y = (ring-
i)*gsSin60;
break;
436 case 3: x = 0.5*
i-ring; y = -
i*gsSin60;
break;
437 case 4: x =
i-ring*0.5; y = -ring*gsSin60;
break;
438 case 5: x = (ring+
i)*0.5; y = (-ring+
i)*gsSin60;
break;
441 if (Math.sqrt(x*x+y*y)>6.7)
443 if (ring==7 &&
i==6 && s==0)
445 if (ring==7 &&
i==1 && s==1)
447 if (ring==7 &&
i==6 && s==3)
449 if (ring==7 &&
i==1 && s==4)
453 var px = Math.sin(Math.PI/3)*x - Math.cos(Math.PI/3)*y;
454 var py = Math.cos(Math.PI/3)*x + Math.sin(Math.PI/3)*y;
456 drawPix(px, py, result.charCodeAt(cnt));
469 ctx.font =
"8pt Arial";
470 ctx.textAlign =
"right";
471 ctx.textBaseline =
"top";
473 ctx.strokeStyle =
"#"+
color(0);
474 ctx.strokeText(
"-2.0V", cw-5, 135);
476 ctx.strokeStyle =
"#"+
color(16);
477 ctx.strokeText(
"-1.5V", cw-5, 120);
479 ctx.strokeStyle =
"#"+
color(32);
480 ctx.strokeText(
"-1.0V", cw-5, 105);
482 ctx.strokeStyle =
"#"+
color(48);
483 ctx.strokeText(
"-0.5V", cw-5, 90);
485 ctx.strokeStyle =
"#"+
color(64);
486 ctx.strokeText(
"0V", cw-5, 70);
488 ctx.strokeStyle =
"#"+
color(80);
489 ctx.strokeText(
"0.5V", cw-5, 50);
491 ctx.strokeStyle =
"#"+
color(86);
492 ctx.strokeText(
"1.0V", cw-5, 35);
494 ctx.strokeStyle =
"#"+
color(102);
495 ctx.strokeText(
"1.5V", cw-5, 20);
497 ctx.strokeStyle =
"#"+
color(127);
498 ctx.strokeText(
"2.0V", cw-5, 5);
po::typed_value< T > * var(T *ptr=0)
function drawPix(x, y, col)