Changeset 13565
- Timestamp:
- 05/04/12 21:16:02 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/FACT++/www/index.js
r13564 r13565 759 759 } 760 760 761 function position(s, ring, i) 762 { 763 switch (s) 764 { 765 case 0: this.x = ring - i*0.5; this.y = + i; break; 766 case 1: this.x = ring*0.5 - i; this.y = ring ; break; 767 case 2: this.x = -ring*0.5 - i*0.5; this.y = ring - i; break; 768 case 3: this.x = -ring + i*0.5; this.y = - i; break; 769 case 4: this.x = -ring*0.5 + i; this.y = -ring ; break; 770 case 5: this.x = ring*0.5 + i*0.5; this.y = -ring + i; break; 771 } 772 773 this.d = function() { return this.x*this.x + this.y*this.y*3/4; } 774 } 775 761 776 function drawFullCam(data) 762 777 { 763 var ctx = beginDrawCam(80 );778 var ctx = beginDrawCam(80.5); 764 779 ctx.rotate(Math.PI/2); 765 780 ctx.scale(1, Math.sqrt(3)/2); … … 774 789 for (var i=1; i<=ring; i++) 775 790 { 776 var x=0.; 777 var y=0.; 778 779 switch (s) 780 { 781 case 0: x = ring - i*0.5; y = + i; break; 782 case 1: x = ring*0.5 - i; y = ring ; break; 783 case 2: x = -ring*0.5 - i*0.5; y = ring - i; break; 784 case 3: x = -ring + i*0.5; y = - i; break; 785 case 4: x = -ring*0.5 + i; y = -ring ; break; 786 case 5: x = ring*0.5 + i*0.5; y = -ring + i; break; 787 } 788 789 if (x*x + y*y*3/4 - x < 395.75) 790 drawHex(ctx, x-0.5, -y, data.charCodeAt(cnt++)); 791 var pos = new position(s, ring, i); 792 if (pos.d() - pos.x > 395.75) 793 continue; 794 795 drawHex(ctx, pos.x-0.5, -pos.y, data.charCodeAt(cnt++)); 791 796 } 792 797 } … … 814 819 for (var i=1; i<=ring; i++) 815 820 { 816 var x=0.; 817 var y=0.; 818 819 switch (s) 821 var pos = new position(s, ring, i); 822 if (pos.d() > 44) 823 continue; 824 825 if (ring==7) 820 826 { 821 case 0: x = ring - i*0.5; y = + i; break; 822 case 1: x = ring*0.5 - i; y = ring ; break; 823 case 2: x = -ring*0.5 - i*0.5; y = ring - i; break; 824 case 3: x = -ring + i*0.5; y = - i; break; 825 case 4: x = -ring*0.5 + i; y = -ring ; break; 826 case 5: x = ring*0.5 + i*0.5; y = -ring + i; break; 827 if (i==6 && (s==0 || s==3)) 828 continue; 829 if (i==1 && (s==1 || s==4)) 830 continue; 827 831 } 828 832 829 if (x*x + y*y*3/4 > 44) 830 continue; 831 832 if (ring==7 && i==6 && s==0) 833 continue; 834 if (ring==7 && i==1 && s==1) 835 continue; 836 if (ring==7 && i==6 && s==3) 837 continue; 838 if (ring==7 && i==1 && s==4) 839 continue; 840 841 drawHex(ctx, x, y, data.charCodeAt(cnt++)); 833 drawHex(ctx, pos.x, pos.y, data.charCodeAt(cnt++)); 842 834 } 843 835 }
Note:
See TracChangeset
for help on using the changeset viewer.