-
Notifications
You must be signed in to change notification settings - Fork 5
/
marchingsquares-isobands.min.js
63 lines (63 loc) · 31 KB
/
marchingsquares-isobands.min.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
var MarchingSquaresJS=function(na){function a(a,c,d){return(a-c)/(d-c)}function oa(a){return-1<a.constructor.toString().indexOf("Array")}function ya(a){for(var c=[],d=a.rows,l=a.cols,m=[],n=0;n<d;n++)for(var q=0;q<l;q++)if("undefined"!==typeof a.cells[n][q]&&0<a.cells[n][q].edges.length){var p=za(a.cells[n][q]),b=null,e=q,f=n;null!==p&&m.push([p.p[0]+e,p.p[1]+f]);do{b=Aa(a.cells[f][e],p.x,p.y,p.o);if(null!==b)m.push([b.p[0]+e,b.p[1]+f]),e+=b.x,f+=b.y,p=b;else break;if(0>f||f>=d||0>e||e>=l||"undefined"===
typeof a.cells[f][e])if(e-=b.x,f-=b.y,p=Ba(a,e,f,b.x,b.y,b.o),null!==p)p.path.forEach(function(a){m.push(a)}),e=p.i,f=p.j;else break}while("undefined"!==typeof a.cells[f][e]&&0<a.cells[f][e].edges.length);c.push(m);m=[];0<a.cells[n][q].edges.length&&q--}return c}function Ba(a,c,d,l,m,n){for(var q=a.cells[d][c],p=q.cval_real,b=c+l,e=d+m,f=[];;){if("undefined"===typeof a.cells[e]||"undefined"===typeof a.cells[e][b])if(e-=m,b-=l,q=a.cells[e][b],p=q.cval_real,-1===m)if(0===n)if(p&fa)f.push([b,e]),l=-1,
n=m=0;else if(p&ea)f.push([b+1,e]),l=1,n=m=0;else{f.push([b+q.bottomright,e]);l=0;n=m=1;break}else if(p&fa)f.push([b,e]),l=-1,n=m=0;else{p&ea?(f.push([b+q.bottomright,e]),l=0,n=m=1):(f.push([b+q.bottomleft,e]),l=0,m=1,n=0);break}else if(1===m)if(0===n)if(p&ka)f.push([b+1,e+1]),l=1,m=0,n=1;else{p&ga?(f.push([b+q.topleft,e+1]),l=0,m=-1,n=0):(f.push([b+q.topright,e+1]),l=0,m=-1,n=1);break}else f.push([b+1,e+1]),l=1,m=0,n=1;else if(-1===l)if(0===n)if(p&ga)f.push([b,e+1]),l=0,m=1,n=0;else{p&fa?(f.push([b,
e+q.leftbottom]),l=1,n=m=0):(f.push([b,e+q.lefttop]),l=1,m=0,n=1);break}else if(p&ga)f.push([b,e+1]),l=0,m=1,n=0;else{console.log("wtf");break}else if(1===l)if(0===n)if(p&ea)f.push([b+1,e]),l=0,m=-1,n=1;else{f.push([b+1,e+q.rightbottom]);l=-1;n=m=0;break}else if(p&ea)f.push([b+1,e]),l=0,m=-1,n=1;else{p&ka?(f.push([b+1,e+q.righttop]),l=-1,m=0,n=1):(f.push([b+1,e+q.rightbottom]),l=-1,n=m=0);break}else{console.log("we came from nowhere!");break}else if(q=a.cells[e][b],p=q.cval_real,-1===l)if(0===n)if("undefined"!==
typeof a.cells[e-1]&&"undefined"!==typeof a.cells[e-1][b])l=0,m=-1,n=1;else if(p&fa)f.push([b,e]);else{f.push([b+q.bottomright,e]);l=0;n=m=1;break}else if(p&ga)console.log("proceeding in x-direction!");else{console.log("found entry from top at "+b+","+e);break}else if(1===l)if(0===n){console.log("wtf");break}else if("undefined"!==typeof a.cells[e+1]&&"undefined"!==typeof a.cells[e+1][b])l=0,m=1,n=0;else if(p&ka)f.push([b+1,e+1]),l=1,m=0,n=1;else{f.push([b+q.topleft,e+1]);l=0;m=-1;n=0;break}else if(-1===
m)if(1===n)if("undefined"!==typeof a.cells[e][b+1])l=1,m=0,n=1;else if(p&ea)f.push([b+1,e]),l=0,m=-1,n=1;else{f.push([b+1,e+q.righttop]);l=-1;m=0;n=1;break}else{console.log("wtf");break}else if(1===m)if(0===n)if("undefined"!==typeof a.cells[e][b-1])l=-1,n=m=0;else if(p&ga)f.push([b,e+1]),l=0,m=1,n=0;else{f.push([b,e+q.leftbottom]);l=1;n=m=0;break}else{console.log("wtf");break}else{console.log("where did we came from???");break}b+=l;e+=m;if(b===c&&e===d)break}return{path:f,i:b,j:e,x:l,y:m,o:n}}function za(a){if(0<
a.edges.length){var c=a.cval_real;switch(a.edges[a.edges.length-1]){case 0:return c&ka?{p:[1,a.righttop],x:-1,y:0,o:1}:{p:[a.topleft,1],x:0,y:-1,o:0};case 1:return c&ea?{p:[a.topleft,1],x:0,y:-1,o:0}:{p:[1,a.rightbottom],x:-1,y:0,o:0};case 2:return c&ea?{p:[a.bottomright,0],x:0,y:1,o:1}:{p:[a.topleft,1],x:0,y:-1,o:0};case 3:return c&fa?{p:[a.topleft,1],x:0,y:-1,o:0}:{p:[a.bottomleft,0],x:0,y:1,o:0};case 4:return c&ka?{p:[1,a.righttop],x:-1,y:0,o:1}:{p:[a.topright,1],x:0,y:-1,o:1};case 5:return c&
ea?{p:[a.topright,1],x:0,y:-1,o:1}:{p:[1,a.rightbottom],x:-1,y:0,o:0};case 6:return c&ea?{p:[a.bottomright,0],x:0,y:1,o:1}:{p:[a.topright,1],x:0,y:-1,o:1};case 7:return c&fa?{p:[a.topright,1],x:0,y:-1,o:1}:{p:[a.bottomleft,0],x:0,y:1,o:0};case 8:return c&ea?{p:[a.bottomright],x:0,y:1,o:1}:{p:[1,a.righttop],x:-1,y:0,o:1};case 9:return c&fa?{p:[1,a.righttop],x:-1,y:0,o:1}:{p:[a.bottomleft,0],x:0,y:1,o:0};case 10:return c&fa?{p:[0,a.leftbottom],x:1,y:0,o:0}:{p:[1,a.righttop],x:-1,y:0,o:1};case 11:return c&
ga?{p:[1,a.righttop],x:-1,y:0,o:1}:{p:[0,a.lefttop],x:1,y:0,o:1};case 12:return c&ea?{p:[a.bottomright,0],x:0,y:1,o:1}:{p:[1,a.rightbottom],x:-1,y:0,o:0};case 13:return c&fa?{p:[1,a.rightbottom],x:-1,y:0,o:0}:{p:[a.bottomleft,0],x:0,y:1,o:0};case 14:return c&fa?{p:[0,a.leftbottom],x:1,y:0,o:0}:{p:[1,a.rightbottom],x:-1,y:0,o:0};case 15:return c&ga?{p:[1,a.rightbottom],x:-1,y:0,o:0}:{p:[0,a.lefttop],x:1,y:0,o:1};case 16:return c&ea?{p:[a.bottomright,0],x:0,y:1,o:1}:{p:[0,a.leftbottom],x:1,y:0,o:0};
case 17:return c&ga?{p:[a.bottomright,0],x:0,y:1,o:1}:{p:[0,a.lefttop],x:1,y:0,o:1};case 18:return c&fa?{p:[0,a.leftbottom],x:1,y:0,o:0}:{p:[a.bottomleft,0],x:0,y:1,o:0};case 19:return c&ga?{p:[a.bottomleft,0],x:0,y:1,o:0}:{p:[0,a.lefttop],x:1,y:0,o:1};case 20:return c&ga?{p:[a.topleft,1],x:0,y:-1,o:0}:{p:[0,a.leftbottom],x:1,y:0,o:0};case 21:return c&ka?{p:[0,a.leftbottom],x:1,y:0,o:0}:{p:[a.topright,1],x:0,y:-1,o:1};case 22:return c&ga?{p:[a.topleft,1],x:0,y:-1,o:0}:{p:[0,a.lefttop],x:1,y:0,o:1};
case 23:return c&ka?{p:[0,a.lefttop],x:1,y:0,o:1}:{p:[a.topright,1],x:0,y:-1,o:1};default:console.log("edge index out of range!"),console.log(a)}}return null}function Aa(a,c,d,l){var la,ia,ja,p=a.cval,b;switch(c){case -1:switch(l){case 0:la=m[p];ia=G[p];ja=F[p];b=B[p];break;default:la=n[p],ia=H[p],ja=I[p],b=J[p]}break;case 1:switch(l){case 0:la=A[p];ia=K[p];ja=L[p];b=M[p];break;default:la=t[p],ia=N[p],ja=O[p],b=P[p]}break;default:switch(d){case -1:switch(l){case 0:la=Q[p];ia=R[p];ja=S[p];b=T[p];break;
default:la=da[p],ia=U[p],ja=V[p],b=W[p]}break;case 1:switch(l){case 0:la=q[p];ia=X[p];ja=Y[p];b=Z[p];break;default:la=r[p],ia=aa[p],ja=ba[p],b=ca[p]}}}c=a.edges.indexOf(la);if("undefined"!==typeof a.edges[c]){delete a.edges[c];for(c+=1;c<a.edges.length;c++)a.edges[c-1]=a.edges[c];a.edges.pop()}else return null;p=a.cval_real;switch(la){case 0:p&ka?(c=a.topleft,d=1):(c=1,d=a.righttop);break;case 1:p&ea?(c=1,d=a.rightbottom):(c=a.topleft,d=1);break;case 2:p&ea?(c=a.topleft,d=1):(c=a.bottomright,d=0);
break;case 3:p&fa?(c=a.bottomleft,d=0):(c=a.topleft,d=1);break;case 4:p&ka?(c=a.topright,d=1):(c=1,d=a.righttop);break;case 5:p&ea?(c=1,d=a.rightbottom):(c=a.topright,d=1);break;case 6:p&ea?(c=a.topright,d=1):(c=a.bottomright,d=0);break;case 7:p&fa?(c=a.bottomleft,d=0):(c=a.topright,d=1);break;case 8:p&ea?(c=1,d=a.righttop):(c=a.bottomright,d=0);break;case 9:p&fa?(c=a.bottomleft,d=0):(c=1,d=a.righttop);break;case 10:p&fa?(c=1,d=a.righttop):(c=0,d=a.leftbottom);break;case 11:p&ga?(c=0,d=a.lefttop):
(c=1,d=a.righttop);break;case 12:p&ea?(c=1,d=a.rightbottom):(c=a.bottomright,d=0);break;case 13:p&fa?(c=a.bottomleft,d=0):(c=1,d=a.rightbottom);break;case 14:p&fa?(c=1,d=a.rightbottom):(c=0,d=a.leftbottom);break;case 15:p&ga?(c=0,d=a.lefttop):(c=1,d=a.rightbottom);break;case 16:p&ea?(c=0,d=a.leftbottom):(c=a.bottomright,d=0);break;case 17:p&ga?(c=0,d=a.lefttop):(c=a.bottomright,d=0);break;case 18:p&fa?(c=a.bottomleft,d=0):(c=0,d=a.leftbottom);break;case 19:p&ga?(c=0,d=a.lefttop):(c=a.bottomleft,d=
0);break;case 20:p&ga?(c=0,d=a.leftbottom):(c=a.topleft,d=1);break;case 21:p&ka?(c=a.topright,d=1):(c=0,d=a.leftbottom);break;case 22:p&ga?(c=0,d=a.lefttop):(c=a.topleft,d=1);break;case 23:p&ka?(c=a.topright,d=1):(c=0,d=a.lefttop);break;default:return console.log("edge index out of range!"),console.log(a),null}if("undefined"===typeof c||"undefined"===typeof d||"undefined"===typeof ia||"undefined"===typeof ja||"undefined"===typeof b)console.log("undefined value!"),console.log(a),console.log(c+" "+
d+" "+ia+" "+ja+" "+b);return{p:[c,d],x:ia,y:ja,o:b}}function Ca(a){var c=[],d=0;a.cells.forEach(function(a,ha){a.forEach(function(a,n){if("undefined"!==typeof a){var m=l[a.cval](a);"object"===typeof m&&oa(m)?"object"===typeof m[0]&&oa(m[0])?"object"===typeof m[0][0]&&oa(m[0][0])?m.forEach(function(a,e){a.forEach(function(a){a[0]+=n;a[1]+=ha});c[d++]=a}):(m.forEach(function(a,c){a[0]+=n;a[1]+=ha}),c[d++]=m):console.log("bandcell polygon with malformed coordinates"):console.log("bandcell polygon with null coordinates")}})});
return c}var xa={successCallback:null,progressCallback:null,verbose:!1,polygons:!1},ma={};na.IsoBands=function(ha,c,d,l){l=l?l:{};for(var G=Object.keys(xa),F=0;F<G.length;F++){var B=G[F],p=l[B],p="undefined"!==typeof p&&null!==p?p:xa[B];ma[B]=p}ma.verbose&&console.log("computing isobands for ["+c+":"+(c+d)+"]");l=ha.length-1;G=ha[0].length-1;F={rows:l,cols:G,cells:[]};d=c+Math.abs(d);for(B=0;B<l;++B)for(F.cells[B]=[],p=0;p<G;++p){var b=0,e=ha[B+1][p],f=ha[B+1][p+1],g=ha[B][p+1],h=ha[B][p];if(!(isNaN(e)||
isNaN(f)||isNaN(g)||isNaN(h))){var b=b|(e<c?0:e>d?128:64),b=b|(f<c?0:f>d?32:16),b=b|(g<c?0:g>d?8:4),b=b|(h<c?0:h>d?2:1),H=+b,E=0;if(17==b||18==b||33==b||34==b||38==b||68==b||72==b||98==b||102==b||132==b||136==b||137==b||152==b||153==b)E=(e+f+g+h)/4,E=E>d?2:E<c?0:1,34===b?1===E?b=35:0===E&&(b=136):136===b?1===E?(b=35,E=4):0===E&&(b=34):17===b?1===E?(b=155,E=4):0===E&&(b=153):68===b?1===E?(b=103,E=4):0===E&&(b=102):153===b?1===E&&(b=155):102===b?1===E&&(b=103):152===b?2>E&&(b=156,E=1):137===b?2>E&&
(b=139,E=1):98===b?2>E&&(b=99,E=1):38===b?2>E&&(b=39,E=1):18===b?0<E?(b=156,E=4):b=152:33===b?0<E?(b=139,E=4):b=137:72===b?0<E?(b=99,E=4):b=98:132===b&&(0<E?(b=39,E=4):b=38);if(0!=b&&170!=b){var u,v,C,w,x,D,y,z;u=v=C=w=x=D=y=z=.5;var k=[];1===b?(C=1-a(c,g,h),z=1-a(c,e,h),k.push(q[b])):169===b?(C=a(d,h,g),z=a(d,h,e),k.push(q[b])):4===b?(D=1-a(c,f,g),w=a(c,h,g),k.push(m[b])):166===b?(D=a(d,g,f),w=1-a(d,g,h),k.push(m[b])):16===b?(x=a(c,g,f),v=a(c,e,f),k.push(n[b])):154===b?(x=1-a(d,f,g),v=1-a(d,f,e),
k.push(n[b])):64===b?(y=a(c,h,e),u=1-a(c,f,e),k.push(t[b])):106===b?(y=1-a(d,e,h),u=a(d,e,f),k.push(t[b])):168===b?(w=a(d,h,g),C=a(c,h,g),z=a(c,h,e),y=a(d,h,e),k.push(r[b]),k.push(q[b])):2===b?(w=1-a(c,g,h),C=1-a(d,g,h),z=1-a(d,e,h),y=1-a(c,e,h),k.push(r[b]),k.push(q[b])):162===b?(x=a(d,g,f),D=a(c,g,f),w=1-a(c,g,h),C=1-a(d,g,h),k.push(r[b]),k.push(q[b])):8===b?(x=1-a(c,f,g),D=1-a(d,f,g),w=a(d,h,g),C=a(c,h,g),k.push(n[b]),k.push(m[b])):138===b?(x=1-a(c,f,g),D=1-a(d,f,g),u=1-a(d,f,e),v=1-a(c,f,e),k.push(n[b]),
k.push(m[b])):32===b?(x=a(d,g,f),D=a(c,g,f),u=a(c,e,f),v=a(d,e,f),k.push(n[b]),k.push(m[b])):42===b?(z=1-a(d,e,h),y=1-a(c,e,h),u=a(c,e,f),v=a(d,e,f),k.push(A[b]),k.push(t[b])):128===b&&(z=a(c,h,e),y=a(d,h,e),u=1-a(d,f,e),v=1-a(c,f,e),k.push(A[b]),k.push(t[b]));5===b?(D=1-a(c,f,g),z=1-a(c,e,h),k.push(m[b])):165===b?(D=a(d,g,f),z=a(d,h,e),k.push(m[b])):20===b?(w=a(c,h,g),v=a(c,e,f),k.push(r[b])):150===b?(w=1-a(d,g,h),v=1-a(d,f,e),k.push(r[b])):80===b?(x=a(c,g,f),y=a(c,h,e),k.push(n[b])):90===b?(x=1-
a(d,f,g),y=1-a(d,e,h),k.push(n[b])):65===b?(C=1-a(c,g,h),u=1-a(c,f,e),k.push(q[b])):105===b?(C=a(d,h,g),u=a(d,e,f),k.push(q[b])):160===b?(x=a(d,g,f),D=a(c,g,f),z=a(c,h,e),y=a(d,h,e),k.push(n[b]),k.push(m[b])):10===b?(x=1-a(c,f,g),D=1-a(d,f,g),z=1-a(d,e,h),y=1-a(c,e,h),k.push(n[b]),k.push(m[b])):130===b?(w=1-a(c,g,h),C=1-a(d,g,h),u=1-a(d,f,e),v=1-a(c,f,e),k.push(r[b]),k.push(q[b])):40===b?(w=a(d,h,g),C=a(c,h,g),u=a(c,e,f),v=a(d,e,f),k.push(r[b]),k.push(q[b])):101===b?(D=a(d,g,f),u=a(d,e,f),k.push(m[b])):
69===b?(D=1-a(c,f,g),u=1-a(c,f,e),k.push(m[b])):149===b?(z=a(d,h,e),v=1-a(d,f,e),k.push(A[b])):21===b?(z=1-a(c,e,h),v=a(c,e,f),k.push(A[b])):86===b?(w=1-a(d,g,h),y=1-a(d,e,h),k.push(r[b])):84===b?(w=a(c,h,g),y=a(c,h,e),k.push(r[b])):89===b?(x=1-a(d,f,g),C=a(d,h,g),k.push(q[b])):81===b?(x=a(c,g,f),C=1-a(c,g,h),k.push(q[b])):96===b?(x=a(d,g,f),D=a(c,g,f),y=a(c,h,e),u=a(d,e,f),k.push(n[b]),k.push(m[b])):74===b?(x=1-a(c,f,g),D=1-a(d,f,g),y=1-a(d,e,h),u=1-a(c,f,e),k.push(n[b]),k.push(m[b])):24===b?(x=
1-a(d,f,g),w=a(d,h,g),C=a(c,h,g),v=a(c,e,f),k.push(n[b]),k.push(q[b])):146===b?(x=a(c,g,f),w=1-a(c,g,h),C=1-a(d,g,h),v=1-a(d,f,e),k.push(n[b]),k.push(q[b])):6===b?(D=1-a(c,f,g),w=1-a(d,g,h),z=1-a(d,e,h),y=1-a(c,e,h),k.push(m[b]),k.push(r[b])):164===b?(D=a(d,g,f),w=a(c,h,g),z=a(c,h,e),y=a(d,h,e),k.push(m[b]),k.push(r[b])):129===b?(C=1-a(c,g,h),z=a(d,h,e),u=1-a(d,f,e),v=1-a(c,f,e),k.push(q[b]),k.push(A[b])):41===b?(C=a(d,h,g),z=1-a(c,e,h),u=a(c,e,f),v=a(d,e,f),k.push(q[b]),k.push(A[b])):66===b?(w=1-
a(c,g,h),C=1-a(d,g,h),y=1-a(d,e,h),u=1-a(c,f,e),k.push(r[b]),k.push(q[b])):104===b?(w=a(d,h,g),C=a(c,h,g),y=a(c,h,e),u=a(d,e,f),k.push(q[b]),k.push(Q[b])):144===b?(x=a(c,g,f),z=a(c,h,e),y=a(d,h,e),v=1-a(d,f,e),k.push(n[b]),k.push(t[b])):26===b?(x=1-a(d,f,g),z=1-a(d,e,h),y=1-a(c,e,h),v=a(c,e,f),k.push(n[b]),k.push(t[b])):36===b?(D=a(d,g,f),w=a(c,h,g),u=a(c,e,f),v=a(d,e,f),k.push(m[b]),k.push(r[b])):134===b?(D=1-a(c,f,g),w=1-a(d,g,h),u=1-a(d,f,e),v=1-a(c,f,e),k.push(m[b]),k.push(r[b])):9===b?(x=1-a(c,
f,g),D=1-a(d,f,g),C=a(d,h,g),z=1-a(c,e,h),k.push(n[b]),k.push(m[b])):161===b?(x=a(d,g,f),D=a(c,g,f),C=1-a(c,g,h),z=a(d,h,e),k.push(n[b]),k.push(m[b])):37===b?(D=a(d,g,f),z=1-a(c,e,h),u=a(c,e,f),v=a(d,e,f),k.push(m[b]),k.push(A[b])):133===b?(D=1-a(c,f,g),z=a(d,h,e),u=1-a(d,f,e),v=1-a(c,f,e),k.push(m[b]),k.push(A[b])):148===b?(w=a(c,h,g),z=a(c,h,e),y=a(d,h,e),v=1-a(d,f,e),k.push(r[b]),k.push(t[b])):22===b?(w=1-a(d,g,h),z=1-a(d,e,h),y=1-a(c,e,h),v=a(c,e,f),k.push(r[b]),k.push(t[b])):82===b?(x=a(c,g,
f),w=1-a(c,g,h),C=1-a(d,g,h),y=1-a(d,e,h),k.push(n[b]),k.push(q[b])):88===b?(x=1-a(d,f,g),w=a(d,h,g),C=a(c,h,g),y=a(c,h,e),k.push(n[b]),k.push(q[b])):73===b?(x=1-a(c,f,g),D=1-a(d,f,g),C=a(d,h,g),u=1-a(c,f,e),k.push(n[b]),k.push(m[b])):97===b?(x=a(d,g,f),D=a(c,g,f),C=1-a(c,g,h),u=a(d,e,f),k.push(n[b]),k.push(m[b])):145===b?(x=a(c,g,f),C=1-a(c,g,h),z=a(d,h,e),v=1-a(d,f,e),k.push(n[b]),k.push(A[b])):25===b?(x=1-a(d,f,g),C=a(d,h,g),z=1-a(c,e,h),v=a(c,e,f),k.push(n[b]),k.push(A[b])):70===b?(D=1-a(c,f,
g),w=1-a(d,g,h),y=1-a(d,e,h),u=1-a(c,f,e),k.push(m[b]),k.push(r[b])):100===b?(D=a(d,g,f),w=a(c,h,g),y=a(c,h,e),u=a(d,e,f),k.push(m[b]),k.push(r[b])):34===b?(0===E?(x=1-a(c,f,g),D=1-a(d,f,g),w=a(d,h,g),C=a(c,h,g),z=a(c,h,e),y=a(d,h,e),u=1-a(d,f,e),v=1-a(c,f,e)):(x=a(d,g,f),D=a(c,g,f),w=1-a(c,g,h),C=1-a(d,g,h),z=1-a(d,e,h),y=1-a(c,e,h),u=a(c,e,f),v=a(d,e,f)),k.push(n[b]),k.push(m[b]),k.push(A[b]),k.push(t[b])):35===b?(4===E?(x=1-a(c,f,g),D=1-a(d,f,g),w=a(d,h,g),C=a(c,h,g),z=a(c,h,e),y=a(d,h,e),u=1-
a(d,f,e),v=1-a(c,f,e)):(x=a(d,g,f),D=a(c,g,f),w=1-a(c,g,h),C=1-a(d,g,h),z=1-a(d,e,h),y=1-a(c,e,h),u=a(c,e,f),v=a(d,e,f)),k.push(n[b]),k.push(m[b]),k.push(q[b]),k.push(t[b])):136===b?(0===E?(x=a(d,g,f),D=a(c,g,f),w=1-a(c,g,h),C=1-a(d,g,h),z=1-a(d,e,h),y=1-a(c,e,h),u=a(c,e,f),v=a(d,e,f)):(x=1-a(c,f,g),D=1-a(d,f,g),w=a(d,h,g),C=a(c,h,g),z=a(c,h,e),y=a(d,h,e),u=1-a(d,f,e),v=1-a(c,f,e)),k.push(n[b]),k.push(m[b]),k.push(A[b]),k.push(t[b])):153===b?(0===E?(x=a(c,g,f),C=1-a(c,g,h),z=1-a(c,e,h),v=a(c,e,f)):
(x=1-a(d,f,g),C=a(d,h,g),z=a(d,h,e),v=1-a(d,f,e)),k.push(n[b]),k.push(q[b])):102===b?(0===E?(D=1-a(c,f,g),w=a(c,h,g),y=a(c,h,e),u=1-a(c,f,e)):(D=a(d,g,f),w=1-a(d,g,h),y=1-a(d,e,h),u=a(d,e,f)),k.push(m[b]),k.push(t[b])):155===b?(4===E?(x=a(c,g,f),C=1-a(c,g,h),z=1-a(c,e,h),v=a(c,e,f)):(x=1-a(d,f,g),C=a(d,h,g),z=a(d,h,e),v=1-a(d,f,e)),k.push(n[b]),k.push(A[b])):103===b?(4===E?(D=1-a(c,f,g),w=a(c,h,g),y=a(c,h,e),u=1-a(c,f,e)):(D=a(d,g,f),w=1-a(d,g,h),y=1-a(d,e,h),u=a(d,e,f)),k.push(m[b]),k.push(r[b])):
152===b?(0===E?(x=a(c,g,f),w=1-a(c,g,h),C=1-a(d,g,h),z=1-a(d,e,h),y=1-a(c,e,h),v=a(c,e,f)):(x=1-a(d,f,g),w=a(d,h,g),C=a(c,h,g),z=a(c,h,e),y=a(d,h,e),v=1-a(d,f,e)),k.push(n[b]),k.push(r[b]),k.push(q[b])):156===b?(4===E?(x=a(c,g,f),w=1-a(c,g,h),C=1-a(d,g,h),z=1-a(d,e,h),y=1-a(c,e,h),v=a(c,e,f)):(x=1-a(d,f,g),w=a(d,h,g),C=a(c,h,g),z=a(c,h,e),y=a(d,h,e),v=1-a(d,f,e)),k.push(n[b]),k.push(q[b]),k.push(t[b])):137===b?(0===E?(x=a(d,g,f),D=a(c,g,f),C=1-a(c,g,h),z=1-a(c,e,h),u=a(c,e,f),v=a(d,e,f)):(x=1-a(c,
f,g),D=1-a(d,f,g),C=a(d,h,g),z=a(d,h,e),u=1-a(d,f,e),v=1-a(c,f,e)),k.push(n[b]),k.push(m[b]),k.push(q[b])):139===b?(4===E?(x=a(d,g,f),D=a(c,g,f),C=1-a(c,g,h),z=1-a(c,e,h),u=a(c,e,f),v=a(d,e,f)):(x=1-a(c,f,g),D=1-a(d,f,g),C=a(d,h,g),z=a(d,h,e),u=1-a(d,f,e),v=1-a(c,f,e)),k.push(n[b]),k.push(m[b]),k.push(A[b])):98===b?(0===E?(x=1-a(c,f,g),D=1-a(d,f,g),w=a(d,h,g),C=a(c,h,g),y=a(c,h,e),u=1-a(c,f,e)):(x=a(d,g,f),D=a(c,g,f),w=1-a(c,g,h),C=1-a(d,g,h),y=1-a(d,e,h),u=a(d,e,f)),k.push(n[b]),k.push(m[b]),k.push(t[b])):
99===b?(4===E?(x=1-a(c,f,g),D=1-a(d,f,g),w=a(d,h,g),C=a(c,h,g),y=a(c,h,e),u=1-a(c,f,e)):(x=a(d,g,f),D=a(c,g,f),w=1-a(c,g,h),C=1-a(d,g,h),y=1-a(d,e,h),u=a(d,e,f)),k.push(n[b]),k.push(m[b]),k.push(q[b])):38===b?(0===E?(D=1-a(c,f,g),w=a(c,h,g),z=a(c,h,e),y=a(d,h,e),u=1-a(d,f,e),v=1-a(c,f,e)):(D=a(d,g,f),w=1-a(d,g,h),z=1-a(d,e,h),y=1-a(c,e,h),u=a(c,e,f),v=a(d,e,f)),k.push(m[b]),k.push(A[b]),k.push(t[b])):39===b?(4===E?(D=1-a(c,f,g),w=a(c,h,g),z=a(c,h,e),y=a(d,h,e),u=1-a(d,f,e),v=1-a(c,f,e)):(D=a(d,g,
f),w=1-a(d,g,h),z=1-a(d,e,h),y=1-a(c,e,h),u=a(c,e,f),v=a(d,e,f)),k.push(m[b]),k.push(r[b]),k.push(t[b])):85===b&&(x=1,D=0,w=1,z=C=0,y=1,u=0,v=1);(0>u||1<u||0>v||1<v||0>x||1<x||0>w||1<w||0>z||1<z||0>y||1<y)&&console.log(b+" "+H+" "+e+","+f+","+g+","+h+" "+E+" "+u+" "+v+" "+x+" "+D+" "+w+" "+C+" "+z+" "+y);F.cells[B][p]={cval:b,cval_real:H,flipped:E,topleft:u,topright:v,righttop:x,rightbottom:D,bottomright:w,bottomleft:C,leftbottom:z,lefttop:y,edges:k}}}}grid=F;ma.verbose&&(ma.polygons?console.log("returning single polygons for each grid cell"):
console.log("returning polygon paths for entire data grid"));ha=ma.polygons?Ca(grid):ya(grid);"function"===typeof ma.successCallback&&ma.successCallback(ha);return ha};var ga=64,ka=16,ea=4,fa=1,R=[],S=[],T=[],U=[],V=[],W=[],H=[],I=[],J=[],G=[],F=[],B=[],X=[],Y=[],Z=[],aa=[],ba=[],ca=[],N=[],O=[],P=[],K=[],L=[],M=[];H[85]=G[85]=-1;I[85]=F[85]=0;J[85]=B[85]=1;N[85]=K[85]=1;O[85]=L[85]=0;P[85]=M[85]=1;R[85]=U[85]=0;S[85]=V[85]=-1;T[85]=Z[85]=0;aa[85]=X[85]=0;ba[85]=Y[85]=1;W[85]=ca[85]=1;K[1]=K[169]=
0;L[1]=L[169]=-1;M[1]=M[169]=0;X[1]=X[169]=-1;Y[1]=Y[169]=0;Z[1]=Z[169]=0;G[4]=G[166]=0;F[4]=F[166]=-1;B[4]=B[166]=1;aa[4]=aa[166]=1;ba[4]=ba[166]=0;ca[4]=ca[166]=0;H[16]=H[154]=0;I[16]=I[154]=1;J[16]=J[154]=1;U[16]=U[154]=1;V[16]=V[154]=0;W[16]=W[154]=1;N[64]=N[106]=0;O[64]=O[106]=1;P[64]=P[106]=0;R[64]=R[106]=-1;S[64]=S[106]=0;T[64]=T[106]=1;N[2]=N[168]=0;O[2]=O[168]=-1;P[2]=P[168]=1;K[2]=K[168]=0;L[2]=L[168]=-1;M[2]=M[168]=0;X[2]=X[168]=-1;Y[2]=Y[168]=0;Z[2]=Z[168]=0;aa[2]=aa[168]=-1;ba[2]=ba[168]=
0;ca[2]=ca[168]=1;H[8]=H[162]=0;I[8]=I[162]=-1;J[8]=J[162]=0;G[8]=G[162]=0;F[8]=F[162]=-1;B[8]=B[162]=1;X[8]=X[162]=1;Y[8]=Y[162]=0;Z[8]=Z[162]=1;aa[8]=aa[162]=1;ba[8]=ba[162]=0;ca[8]=ca[162]=0;H[32]=H[138]=0;I[32]=I[138]=1;J[32]=J[138]=1;G[32]=G[138]=0;F[32]=F[138]=1;B[32]=B[138]=0;R[32]=R[138]=1;S[32]=S[138]=0;T[32]=T[138]=0;U[32]=U[138]=1;V[32]=V[138]=0;W[32]=W[138]=1;K[128]=K[42]=0;L[128]=L[42]=1;M[128]=M[42]=1;N[128]=N[42]=0;O[128]=O[42]=1;P[128]=P[42]=0;R[128]=R[42]=-1;S[128]=S[42]=0;T[128]=
T[42]=1;U[128]=U[42]=-1;V[128]=V[42]=0;W[128]=W[42]=0;G[5]=G[165]=-1;F[5]=F[165]=0;B[5]=B[165]=0;K[5]=K[165]=1;L[5]=L[165]=0;M[5]=M[165]=0;aa[20]=aa[150]=0;ba[20]=ba[150]=1;ca[20]=ca[150]=1;U[20]=U[150]=0;V[20]=V[150]=-1;W[20]=W[150]=1;H[80]=H[90]=-1;I[80]=I[90]=0;J[80]=J[90]=1;N[80]=N[90]=1;O[80]=O[90]=0;P[80]=P[90]=1;X[65]=X[105]=0;Y[65]=Y[105]=1;Z[65]=Z[105]=0;R[65]=R[105]=0;S[65]=S[105]=-1;T[65]=T[105]=0;H[160]=H[10]=-1;I[160]=I[10]=0;J[160]=J[10]=1;G[160]=G[10]=-1;F[160]=F[10]=0;B[160]=B[10]=
0;K[160]=K[10]=1;L[160]=L[10]=0;M[160]=M[10]=0;N[160]=N[10]=1;O[160]=O[10]=0;P[160]=P[10]=1;aa[130]=aa[40]=0;ba[130]=ba[40]=1;ca[130]=ca[40]=1;X[130]=X[40]=0;Y[130]=Y[40]=1;Z[130]=Z[40]=0;R[130]=R[40]=0;S[130]=S[40]=-1;T[130]=T[40]=0;U[130]=U[40]=0;V[130]=V[40]=-1;W[130]=W[40]=1;G[37]=G[133]=0;F[37]=F[133]=1;B[37]=B[133]=1;K[37]=K[133]=0;L[37]=L[133]=1;M[37]=M[133]=0;R[37]=R[133]=-1;S[37]=S[133]=0;T[37]=T[133]=0;U[37]=U[133]=1;V[37]=V[133]=0;W[37]=W[133]=0;aa[148]=aa[22]=-1;ba[148]=ba[22]=0;ca[148]=
ca[22]=0;K[148]=K[22]=0;L[148]=L[22]=-1;M[148]=M[22]=1;N[148]=N[22]=0;O[148]=O[22]=1;P[148]=P[22]=1;U[148]=U[22]=-1;V[148]=V[22]=0;W[148]=W[22]=1;H[82]=H[88]=0;I[82]=I[88]=-1;J[82]=J[88]=1;aa[82]=aa[88]=1;ba[82]=ba[88]=0;ca[82]=ca[88]=1;X[82]=X[88]=-1;Y[82]=Y[88]=0;Z[82]=Z[88]=1;N[82]=N[88]=0;O[82]=O[88]=-1;P[82]=P[88]=0;H[73]=H[97]=0;I[73]=I[97]=1;J[73]=J[97]=0;G[73]=G[97]=0;F[73]=F[97]=-1;B[73]=B[97]=0;X[73]=X[97]=1;Y[73]=Y[97]=0;Z[73]=Z[97]=0;R[73]=R[97]=1;S[73]=S[97]=0;T[73]=T[97]=1;H[145]=H[25]=
0;I[145]=I[25]=-1;J[145]=J[25]=0;X[145]=X[25]=1;Y[145]=Y[25]=0;Z[145]=Z[25]=1;K[145]=K[25]=0;L[145]=L[25]=1;M[145]=M[25]=1;U[145]=U[25]=-1;V[145]=V[25]=0;W[145]=W[25]=0;G[70]=G[100]=0;F[70]=F[100]=1;B[70]=B[100]=0;aa[70]=aa[100]=-1;ba[70]=ba[100]=0;ca[70]=ca[100]=1;N[70]=N[100]=0;O[70]=O[100]=-1;P[70]=P[100]=1;R[70]=R[100]=1;S[70]=S[100]=0;T[70]=T[100]=0;G[101]=G[69]=0;F[101]=F[69]=1;B[101]=B[69]=0;R[101]=R[69]=1;S[101]=S[69]=0;T[101]=T[69]=0;K[149]=K[21]=0;L[149]=L[21]=1;M[149]=M[21]=1;U[149]=U[21]=
-1;V[149]=V[21]=0;W[149]=W[21]=0;aa[86]=aa[84]=-1;ba[86]=ba[84]=0;ca[86]=ca[84]=1;N[86]=N[84]=0;O[86]=O[84]=-1;P[86]=P[84]=1;H[89]=H[81]=0;I[89]=I[81]=-1;J[89]=J[81]=0;X[89]=X[81]=1;Y[89]=Y[81]=0;Z[89]=Z[81]=1;H[96]=H[74]=0;I[96]=I[74]=1;J[96]=J[74]=0;G[96]=G[74]=-1;F[96]=F[74]=0;B[96]=B[74]=1;N[96]=N[74]=1;O[96]=O[74]=0;P[96]=P[74]=0;R[96]=R[74]=1;S[96]=S[74]=0;T[96]=T[74]=1;H[24]=H[146]=0;I[24]=I[146]=-1;J[24]=J[146]=1;aa[24]=aa[146]=1;ba[24]=ba[146]=0;ca[24]=ca[146]=1;X[24]=X[146]=0;Y[24]=Y[146]=
1;Z[24]=Z[146]=1;U[24]=U[146]=0;V[24]=V[146]=-1;W[24]=W[146]=0;G[6]=G[164]=-1;F[6]=F[164]=0;B[6]=B[164]=1;aa[6]=aa[164]=-1;ba[6]=ba[164]=0;ca[6]=ca[164]=0;K[6]=K[164]=0;L[6]=L[164]=-1;M[6]=M[164]=1;N[6]=N[164]=1;O[6]=O[164]=0;P[6]=P[164]=0;X[129]=X[41]=0;Y[129]=Y[41]=1;Z[129]=Z[41]=1;K[129]=K[41]=0;L[129]=L[41]=1;M[129]=M[41]=0;R[129]=R[41]=-1;S[129]=S[41]=0;T[129]=T[41]=0;U[129]=U[41]=0;V[129]=V[41]=-1;W[129]=W[41]=0;aa[66]=aa[104]=0;ba[66]=ba[104]=1;ca[66]=ca[104]=0;X[66]=X[104]=-1;Y[66]=Y[104]=
0;Z[66]=Z[104]=1;N[66]=N[104]=0;O[66]=O[104]=-1;P[66]=P[104]=0;R[66]=R[104]=0;S[66]=S[104]=-1;T[66]=T[104]=1;H[144]=H[26]=-1;I[144]=I[26]=0;J[144]=J[26]=0;K[144]=K[26]=1;L[144]=L[26]=0;M[144]=M[26]=1;N[144]=N[26]=0;O[144]=O[26]=1;P[144]=P[26]=1;U[144]=U[26]=-1;V[144]=V[26]=0;W[144]=W[26]=1;G[36]=G[134]=0;F[36]=F[134]=1;B[36]=B[134]=1;aa[36]=aa[134]=0;ba[36]=ba[134]=1;ca[36]=ca[134]=0;R[36]=R[134]=0;S[36]=S[134]=-1;T[36]=T[134]=1;U[36]=U[134]=1;V[36]=V[134]=0;W[36]=W[134]=0;H[9]=H[161]=-1;I[9]=I[161]=
0;J[9]=J[161]=0;G[9]=G[161]=0;F[9]=F[161]=-1;B[9]=B[161]=0;X[9]=X[161]=1;Y[9]=Y[161]=0;Z[9]=Z[161]=0;K[9]=K[161]=1;L[9]=L[161]=0;M[9]=M[161]=1;H[136]=0;I[136]=1;J[136]=1;G[136]=0;F[136]=1;B[136]=0;aa[136]=-1;ba[136]=0;ca[136]=1;X[136]=-1;Y[136]=0;Z[136]=0;K[136]=0;L[136]=-1;M[136]=0;N[136]=0;O[136]=-1;P[136]=1;R[136]=1;S[136]=0;T[136]=0;U[136]=1;V[136]=0;W[136]=1;H[34]=0;I[34]=-1;J[34]=0;G[34]=0;F[34]=-1;B[34]=1;aa[34]=1;ba[34]=0;ca[34]=0;X[34]=1;Y[34]=0;Z[34]=1;K[34]=0;L[34]=1;M[34]=1;N[34]=0;O[34]=
1;P[34]=0;R[34]=-1;S[34]=0;T[34]=1;U[34]=-1;V[34]=0;W[34]=0;H[35]=0;I[35]=1;J[35]=1;G[35]=0;F[35]=-1;B[35]=1;aa[35]=1;ba[35]=0;ca[35]=0;X[35]=-1;Y[35]=0;Z[35]=0;K[35]=0;L[35]=-1;M[35]=0;N[35]=0;O[35]=1;P[35]=0;R[35]=-1;S[35]=0;T[35]=1;U[35]=1;V[35]=0;W[35]=1;H[153]=0;I[153]=1;J[153]=1;X[153]=-1;Y[153]=0;Z[153]=0;K[153]=0;L[153]=-1;M[153]=0;U[153]=1;V[153]=0;W[153]=1;G[102]=0;F[102]=-1;B[102]=1;aa[102]=1;ba[102]=0;ca[102]=0;N[102]=0;O[102]=1;P[102]=0;R[102]=-1;S[102]=0;T[102]=1;H[155]=0;I[155]=-1;
J[155]=0;X[155]=1;Y[155]=0;Z[155]=1;K[155]=0;L[155]=1;M[155]=1;U[155]=-1;V[155]=0;W[155]=0;G[103]=0;F[103]=1;B[103]=0;aa[103]=-1;ba[103]=0;ca[103]=1;N[103]=0;O[103]=-1;P[103]=1;R[103]=1;S[103]=0;T[103]=0;H[152]=0;I[152]=1;J[152]=1;aa[152]=-1;ba[152]=0;ca[152]=1;X[152]=-1;Y[152]=0;Z[152]=0;K[152]=0;L[152]=-1;M[152]=0;N[152]=0;O[152]=-1;P[152]=1;U[152]=1;V[152]=0;W[152]=1;H[156]=0;I[156]=-1;J[156]=1;aa[156]=1;ba[156]=0;ca[156]=1;X[156]=-1;Y[156]=0;Z[156]=0;K[156]=0;L[156]=-1;M[156]=0;N[156]=0;O[156]=
1;P[156]=1;U[156]=-1;V[156]=0;W[156]=1;H[137]=0;I[137]=1;J[137]=1;G[137]=0;F[137]=1;B[137]=0;X[137]=-1;Y[137]=0;Z[137]=0;K[137]=0;L[137]=-1;M[137]=0;R[137]=1;S[137]=0;T[137]=0;U[137]=1;V[137]=0;W[137]=1;H[139]=0;I[139]=1;J[139]=1;G[139]=0;F[139]=-1;B[139]=0;X[139]=1;Y[139]=0;Z[139]=0;K[139]=0;L[139]=1;M[139]=0;R[139]=-1;S[139]=0;T[139]=0;U[139]=1;V[139]=0;W[139]=1;H[98]=0;I[98]=-1;J[98]=0;G[98]=0;F[98]=-1;B[98]=1;aa[98]=1;ba[98]=0;ca[98]=0;X[98]=1;Y[98]=0;Z[98]=1;N[98]=0;O[98]=1;P[98]=0;R[98]=-1;
S[98]=0;T[98]=1;H[99]=0;I[99]=1;J[99]=0;G[99]=0;F[99]=-1;B[99]=1;aa[99]=1;ba[99]=0;ca[99]=0;X[99]=-1;Y[99]=0;Z[99]=1;N[99]=0;O[99]=-1;P[99]=0;R[99]=1;S[99]=0;T[99]=1;G[38]=0;F[38]=-1;B[38]=1;aa[38]=1;ba[38]=0;ca[38]=0;K[38]=0;L[38]=1;M[38]=1;N[38]=0;O[38]=1;P[38]=0;R[38]=-1;S[38]=0;T[38]=1;U[38]=-1;V[38]=0;W[38]=0;G[39]=0;F[39]=1;B[39]=1;aa[39]=-1;ba[39]=0;ca[39]=0;K[39]=0;L[39]=-1;M[39]=1;N[39]=0;O[39]=1;P[39]=0;R[39]=-1;S[39]=0;T[39]=1;U[39]=1;V[39]=0;W[39]=0;var n=[],m=[],r=[],q=[],A=[],t=[],Q=
[],da=[];q[1]=A[1]=18;q[169]=A[169]=18;r[4]=m[4]=12;r[166]=m[166]=12;n[16]=da[16]=4;n[154]=da[154]=4;t[64]=Q[64]=22;t[106]=Q[106]=22;r[2]=t[2]=17;q[2]=A[2]=18;r[168]=t[168]=17;q[168]=A[168]=18;n[8]=q[8]=9;m[8]=r[8]=12;n[162]=q[162]=9;m[162]=r[162]=12;n[32]=da[32]=4;m[32]=Q[32]=1;n[138]=da[138]=4;m[138]=Q[138]=1;A[128]=da[128]=21;t[128]=Q[128]=22;A[42]=da[42]=21;t[42]=Q[42]=22;m[5]=A[5]=14;m[165]=A[165]=14;r[20]=da[20]=6;r[150]=da[150]=6;n[80]=t[80]=11;n[90]=t[90]=11;q[65]=Q[65]=3;q[105]=Q[105]=3;
n[160]=t[160]=11;m[160]=A[160]=14;n[10]=t[10]=11;m[10]=A[10]=14;r[130]=da[130]=6;q[130]=Q[130]=3;r[40]=da[40]=6;q[40]=Q[40]=3;m[101]=Q[101]=1;m[69]=Q[69]=1;A[149]=da[149]=21;A[21]=da[21]=21;r[86]=t[86]=17;r[84]=t[84]=17;n[89]=q[89]=9;n[81]=q[81]=9;n[96]=Q[96]=0;m[96]=t[96]=15;n[74]=Q[74]=0;m[74]=t[74]=15;n[24]=r[24]=8;q[24]=da[24]=7;n[146]=r[146]=8;q[146]=da[146]=7;m[6]=t[6]=15;r[6]=A[6]=16;m[164]=t[164]=15;r[164]=A[164]=16;q[129]=da[129]=7;A[129]=Q[129]=20;q[41]=da[41]=7;A[41]=Q[41]=20;r[66]=Q[66]=
2;q[66]=t[66]=19;r[104]=Q[104]=2;q[104]=t[104]=19;n[144]=A[144]=10;t[144]=da[144]=23;n[26]=A[26]=10;t[26]=da[26]=23;m[36]=da[36]=5;r[36]=Q[36]=2;m[134]=da[134]=5;r[134]=Q[134]=2;n[9]=A[9]=10;m[9]=q[9]=13;n[161]=A[161]=10;m[161]=q[161]=13;m[37]=da[37]=5;A[37]=Q[37]=20;m[133]=da[133]=5;A[133]=Q[133]=20;r[148]=A[148]=16;t[148]=da[148]=23;r[22]=A[22]=16;t[22]=da[22]=23;n[82]=r[82]=8;q[82]=t[82]=19;n[88]=r[88]=8;q[88]=t[88]=19;n[73]=Q[73]=0;m[73]=q[73]=13;n[97]=Q[97]=0;m[97]=q[97]=13;n[145]=q[145]=9;A[145]=
da[145]=21;n[25]=q[25]=9;A[25]=da[25]=21;m[70]=Q[70]=1;r[70]=t[70]=17;m[100]=Q[100]=1;r[100]=t[100]=17;n[34]=q[34]=9;m[34]=r[34]=12;A[34]=da[34]=21;t[34]=Q[34]=22;n[136]=da[136]=4;m[136]=Q[136]=1;r[136]=t[136]=17;q[136]=A[136]=18;n[35]=da[35]=4;m[35]=r[35]=12;q[35]=A[35]=18;t[35]=Q[35]=22;n[153]=da[153]=4;q[153]=A[153]=18;m[102]=r[102]=12;t[102]=Q[102]=22;n[155]=q[155]=9;A[155]=da[155]=23;m[103]=Q[103]=1;r[103]=t[103]=17;n[152]=da[152]=4;r[152]=t[152]=17;q[152]=A[152]=18;n[156]=r[156]=8;q[156]=A[156]=
18;t[156]=da[156]=23;n[137]=da[137]=4;m[137]=Q[137]=1;q[137]=A[137]=18;n[139]=da[139]=4;m[139]=q[139]=13;A[139]=Q[139]=20;n[98]=q[98]=9;m[98]=r[98]=12;t[98]=Q[98]=22;n[99]=Q[99]=0;m[99]=r[99]=12;q[99]=t[99]=19;m[38]=r[38]=12;A[38]=da[38]=21;t[38]=Q[38]=22;m[39]=da[39]=5;r[39]=A[39]=16;t[39]=Q[39]=22;var l=[];l[1]=l[169]=pa;l[4]=l[166]=qa;l[16]=l[154]=ra;l[64]=l[106]=sa;l[168]=l[2]=ta;l[162]=l[8]=ua;l[138]=l[32]=va;l[42]=l[128]=wa;l[5]=l[165]=Da;l[20]=l[150]=Ea;l[80]=l[90]=Fa;l[65]=l[105]=Ga;l[160]=
l[10]=Ha;l[130]=l[40]=Ia;l[85]=Ja;l[101]=l[69]=Ka;l[149]=l[21]=La;l[86]=l[84]=Ma;l[89]=l[81]=Na;l[96]=l[74]=Oa;l[24]=l[146]=Pa;l[6]=l[164]=Qa;l[129]=l[41]=Ra;l[66]=l[104]=Sa;l[144]=l[26]=Ta;l[36]=l[134]=Ua;l[9]=l[161]=Va;l[37]=l[133]=Wa;l[148]=l[22]=Xa;l[82]=l[88]=Ya;l[73]=l[97]=Za;l[145]=l[25]=$a;l[70]=l[100]=ab;l[34]=function(a){return[wa(a),ua(a)]};l[35]=bb;l[136]=function(a){return[va(a),ta(a)]};l[153]=function(a){return[ra(a),pa(a)]};l[102]=function(a){return[qa(a),sa(a)]};l[155]=cb;l[103]=db;
l[152]=function(a){return[ra(a),ta(a)]};l[156]=eb;l[137]=function(a){return[va(a),pa(a)]};l[139]=fb;l[98]=function(a){return[ua(a),sa(a)]};l[99]=gb;l[38]=function(a){return[qa(a),wa(a)]};l[39]=hb;var pa=function(a){return[[a.bottomleft,0],[0,0],[0,a.leftbottom]]},qa=function(a){return[[1,a.rightbottom],[1,0],[a.bottomright,0]]},ra=function(a){return[[a.topright,1],[1,1],[1,a.righttop]]},sa=function(a){return[[0,a.lefttop],[0,1],[a.topleft,1]]},ta=function(a){return[[a.bottomright,0],[a.bottomleft,
0],[0,a.leftbottom],[0,a.lefttop]]},ua=function(a){return[[a.bottomright,0],[a.bottomleft,0],[1,a.righttop],[1,a.rightbottom]]},va=function(a){return[[1,a.righttop],[1,a.rightbottom],[a.topleft,1],[a.topright,1]]},wa=function(a){return[[0,a.leftbottom],[0,a.lefttop],[a.topleft,1],[a.topright,1]]},Da=function(a){return[[0,0],[0,a.leftbottom],[1,a.rightbottom],[1,0]]},Ea=function(a){return[[1,0],[a.bottomright,0],[a.topright,1],[1,1]]},Fa=function(a){return[[1,1],[1,a.righttop],[0,a.lefttop],[0,1]]},
Ga=function(a){return[[a.bottomleft,0],[0,0],[0,1],[a.topleft,1]]},Ha=function(a){return[[1,a.righttop],[1,a.rightbottom],[0,a.leftbottom],[0,a.lefttop]]},Ia=function(a){return[[a.topleft,1],[a.topright,1],[a.bottomright,0],[a.bottomleft,0]]},Ja=function(a){return[[0,0],[0,1],[1,1],[1,0]]},Ka=function(a){return[[1,a.rightbottom],[1,0],[0,0],[0,1],[a.topleft,1]]},La=function(a){return[[a.topright,1],[1,1],[1,0],[0,0],[0,a.leftbottom]]},Ma=function(a){return[[1,0],[a.bottomright,0],[0,a.lefttop],[0,
1],[1,1]]},Na=function(a){return[[1,1],[1,a.righttop],[a.bottomleft,0],[0,0],[0,1]]},Oa=function(a){return[[1,a.righttop],[1,a.rightbottom],[0,a.lefttop],[0,1],[a.topleft,1]]},Pa=function(a){return[[1,1],[1,a.righttop],[a.bottomright,0],[a.bottomleft,0],[a.topright,1]]},Qa=function(a){return[[1,a.rightbottom],[1,0],[a.bottomright,0],[0,a.leftbottom],[0,a.lefttop]]},Ra=function(a){return[[a.topright,1],[a.bottomleft,0],[0,0],[0,a.leftbottom],[a.topleft,1]]},Sa=function(a){return[[a.bottomright,0],
[a.bottomleft,0],[0,a.lefttop],[0,1],[a.topleft,1]]},Ta=function(a){return[[1,1],[1,a.righttop],[0,a.leftbottom],[0,a.lefttop],[a.topright,1]]},Ua=function(a){return[[1,a.rightbottom],[1,0],[a.bottomright,0],[a.topleft,1],[a.topright,1]]},Va=function(a){return[[1,a.righttop],[1,a.rightbottom],[a.bottomleft,0],[0,0],[0,a.leftbottom]]},Wa=function(a){return[[1,a.rightbottom],[1,0],[0,0],[0,a.leftbottom],[a.topleft,1],[a.topright,1]]},Xa=function(a){return[[1,1],[1,0],[a.bottomright,0],[0,a.leftbottom],
[0,a.lefttop],[a.topright,1]]},Ya=function(a){return[[1,1],[1,a.righttop],[a.bottomright,0],[a.bottomleft,0],[0,a.lefttop],[0,1]]},Za=function(a){return[[1,a.righttop],[1,a.rightbottom],[a.bottomleft,0],[0,0],[0,1],[a.topleft,1]]},$a=function(a){return[[1,1],[1,a.righttop],[a.bottomleft,0],[0,0],[0,a.leftbottom],[a.topright,1]]},ab=function(a){return[[1,a.rightbottom],[1,0],[a.bottomright,0],[0,a.lefttop],[0,1],[a.topleft,1]]},bb=function(a){return[[1,a.righttop],[1,a.rightbottom],[a.bottomright,
0],[a.bottomleft,0],[0,a.leftbottom],[0,a.lefttop],[a.topleft,1],[a.topright,1]]},cb=function(a){return[[1,1],[1,a.righttop],[a.bottomleft,0],[0,0],[0,a.leftbottom],[a.topright,1]]},db=function(a){return[[1,a.rightbottom],[1,0],[a.bottomright,0],[0,a.lefttop],[0,1],[a.topleft,1]]},eb=function(a){return[[1,1],[1,a.righttop],[a.bottomright,0],[a.bottomleft,0],[0,a.leftbottom],[0,a.lefttop],[a.topright,1]]},fb=function(a){return[[1,a.righttop],[1,a.rightbottom],[a.bottomleft,0],[0,0],[0,a.leftbottom],
[a.topleft,1],[a.topright,1]]},gb=function(a){return[[1,a.righttop],[1,a.rightbottom],[a.bottomright,0],[a.bottomleft,0],[0,a.lefttop],[0,1],[a.topleft,1]]},hb=function(a){return[[1,a.rightbottom],[1,0],[a.bottomright,0],[0,a.leftbottom],[0,a.lefttop],[a.topleft,1],[a.topright,1]]};"function"===typeof define&&define.amd&&define(na);return na}(MarchingSquaresJS||{});module.exports=MarchingSquaresJS;