H3Index
* [.greatCircleDistance(latLng1, latLng2, unit)](#module_h3.greatCircleDistance) ⇒ number
* [.cellArea(h3Index, unit)](#module_h3.cellArea) ⇒ number
- * [.exactEdgeLength(edge, unit)](#module_h3.exactEdgeLength) ⇒ number
+ * [.edgeLength(edge, unit)](#module_h3.edgeLength) ⇒ number
* [.getHexagonAreaAvg(res, unit)](#module_h3.getHexagonAreaAvg) ⇒ number
* [.getHexagonEdgeLengthAvg(res, unit)](#module_h3.getHexagonEdgeLengthAvg) ⇒ number
* [.cellToVertex(h3Index, vertexNum)](#module_h3.cellToVertex) ⇒ H3Index
@@ -851,10 +851,10 @@ Exact area of a given cell
* * *
-
+
-### h3.exactEdgeLength(edge, unit) ⇒ number
-Exact length of a given unidirectional edge
+### h3.edgeLength(edge, unit) ⇒ number
+Calculate length of a given unidirectional edge
**Returns**: number
- Cell area
**Throws**:
diff --git a/lib/bindings.js b/lib/bindings.js
index b9f2e80..34d4e3c 100644
--- a/lib/bindings.js
+++ b/lib/bindings.js
@@ -87,9 +87,9 @@ export default [
['cellAreaM2', H3_ERROR, [H3_LOWER, H3_UPPER, POINTER]],
['cellAreaKm2', H3_ERROR, [H3_LOWER, H3_UPPER, POINTER]],
['cellAreaRads2', H3_ERROR, [H3_LOWER, H3_UPPER, POINTER]],
- ['exactEdgeLengthM', H3_ERROR, [H3_LOWER, H3_UPPER, POINTER]],
- ['exactEdgeLengthKm', H3_ERROR, [H3_LOWER, H3_UPPER, POINTER]],
- ['exactEdgeLengthRads', H3_ERROR, [H3_LOWER, H3_UPPER, POINTER]],
+ ['edgeLengthM', H3_ERROR, [H3_LOWER, H3_UPPER, POINTER]],
+ ['edgeLengthKm', H3_ERROR, [H3_LOWER, H3_UPPER, POINTER]],
+ ['edgeLengthRads', H3_ERROR, [H3_LOWER, H3_UPPER, POINTER]],
['getNumCells', H3_ERROR, [RESOLUTION, POINTER]],
['getRes0Cells', H3_ERROR, [POINTER]],
['res0CellCount', NUMBER],
diff --git a/lib/h3core.js b/lib/h3core.js
index f9d8b1f..33dbdaa 100644
--- a/lib/h3core.js
+++ b/lib/h3core.js
@@ -1384,26 +1384,26 @@ export function cellArea(h3Index, unit) {
}
/**
- * Exact length of a given unidirectional edge
+ * Calculate length of a given unidirectional edge
* @static
* @param {H3Index} edge H3 index of the edge to measure
* @param {string} unit Distance unit (either UNITS.m, UNITS.km, or UNITS.rads)
* @return {number} Cell area
* @throws {H3Error} If the input is invalid
*/
-export function exactEdgeLength(edge, unit) {
+export function edgeLength(edge, unit) {
const [lower, upper] = h3IndexToSplitLong(edge);
const out = C._malloc(SZ_DBL);
try {
switch (unit) {
case UNITS.m:
- throwIfError(H3.exactEdgeLengthM(lower, upper, out));
+ throwIfError(H3.edgeLengthM(lower, upper, out));
break;
case UNITS.km:
- throwIfError(H3.exactEdgeLengthKm(lower, upper, out));
+ throwIfError(H3.edgeLengthKm(lower, upper, out));
break;
case UNITS.rads:
- throwIfError(H3.exactEdgeLengthRads(lower, upper, out));
+ throwIfError(H3.edgeLengthRads(lower, upper, out));
break;
default:
throw JSBindingError(E_UNKNOWN_UNIT, unit);
diff --git a/lib/legacy-mapping.js b/lib/legacy-mapping.js
index 65c68e7..51576c2 100644
--- a/lib/legacy-mapping.js
+++ b/lib/legacy-mapping.js
@@ -51,7 +51,7 @@ module.exports = {
experimentalLocalIjToH3: 'localIjToCell',
pointDist: 'greatCircleDistance',
cellArea: 'cellArea',
- exactEdgeLength: 'exactEdgeLength',
+ exactEdgeLength: 'edgeLength',
hexArea: 'getHexagonAreaAvg',
edgeLength: 'getHexagonEdgeLengthAvg',
numHexagons: 'getNumCells',
diff --git a/out/binding-functions b/out/binding-functions
index f5cc53d..9247fe4 100644
--- a/out/binding-functions
+++ b/out/binding-functions
@@ -12,7 +12,7 @@ greatCircleDistance
getHexagonAreaAvg
cellArea
getHexagonEdgeLengthAvg
-exactEdgeLength
+edgeLength
getNumCells
getRes0Cells
getPentagons
diff --git a/out/libh3.js b/out/libh3.js
index 1ae04e0..3140f43 100644
--- a/out/libh3.js
+++ b/out/libh3.js
@@ -7,14 +7,14 @@ var Module=typeof libh3!=="undefined"?libh3:{};var moduleOverrides={};var key;fo
var asm=(/** @suppress {uselessCode} */ function(global,env,buffer) {
"almost asm";var a=new global.Int8Array(buffer),b=new global.Int32Array(buffer),c=new global.Uint8Array(buffer),d=new global.Float32Array(buffer),e=new global.Float64Array(buffer),f=env.o|0,g=env.p|0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0.0,p=global.Math.floor,q=global.Math.abs,r=global.Math.sqrt,s=global.Math.pow,t=global.Math.cos,u=global.Math.sin,v=global.Math.tan,w=global.Math.acos,x=global.Math.asin,y=global.Math.atan,z=global.Math.atan2,A=global.Math.ceil,B=global.Math.imul,C=global.Math.min,D=global.Math.clz32,E=env.a,F=env.b,G=env.c,H=env.d,I=env.e,J=env.f,K=env.g,L=env.h,M=env.i,N=env.j,O=env.k,P=env.l,Q=env.m,R=env.n,S=23920,T=5266800,U=0.0;function V(newBuffer){a=new Int8Array(newBuffer);c=new Uint8Array(newBuffer);b=new Int32Array(newBuffer);d=new Float32Array(newBuffer);e=new Float64Array(newBuffer);buffer=newBuffer;return true}
// EMSCRIPTEN_START_FUNCS
-function W(a){a=a|0;var b=0;b=S;S=S+a|0;S=S+15&-16;return b|0}function X(){return S|0}function Y(a){a=a|0;S=a}function Z(a,b){a=a|0;b=b|0;S=a;T=b}function _(a,c){a=a|0;c=c|0;var d=0,e=0,f=0,g=0;d=((a|0)<0)<<31>>31;if((a|0)<0){d=2;return d|0}g=md(a|0,d|0,3,0)|0;f=G()|0;e=gd(a|0,d|0,1,0)|0;e=md(g|0,f|0,e|0,G()|0)|0;e=gd(e|0,G()|0,1,0)|0;a=G()|0;d=c;b[d>>2]=e;b[d+4>>2]=a;d=0;return d|0}function $(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;var e=0,f=0,g=0;if(!(ba(a,b,c,d,0)|0)){d=0;return d|0}e=((c|0)<0)<<31>>31;g=md(c|0,e|0,3,0)|0;f=G()|0;e=gd(c|0,e|0,1,0)|0;e=md(g|0,f|0,e|0,G()|0)|0;e=gd(e|0,G()|0,1,0)|0;f=G()|0;if((c|0)<0){d=2;return d|0}vd(d|0,0,e<<3|0)|0;g=fd(e,4)|0;if(!g){d=13;return d|0}d=ca(a,b,c,d,g,e,f,0)|0;ed(g);return d|0}function aa(a,b,c,d,e){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;var f=0,g=0,h=0;if(!(ba(a,b,c,d,e)|0)){d=0;return d|0}f=((c|0)<0)<<31>>31;h=md(c|0,f|0,3,0)|0;g=G()|0;f=gd(c|0,f|0,1,0)|0;f=md(h|0,g|0,f|0,G()|0)|0;f=gd(f|0,G()|0,1,0)|0;g=G()|0;if((c|0)<0){h=2;return h|0}vd(d|0,0,f<<3|0)|0;if(e|0){vd(e|0,0,f<<2|0)|0;h=ca(a,b,c,d,e,f,g,0)|0;return h|0}e=fd(f,4)|0;if(!e){h=13;return h|0}h=ca(a,b,c,d,e,f,g,0)|0;ed(e);return h|0}function ba(a,c,d,e,f){a=a|0;c=c|0;d=d|0;e=e|0;f=f|0;var g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0;q=S;S=S+16|0;o=q;p=q+8|0;n=o;b[n>>2]=a;b[n+4>>2]=c;if((d|0)<0){p=2;S=q;return p|0}g=e;b[g>>2]=a;b[g+4>>2]=c;g=(f|0)!=0;if(g)b[f>>2]=0;if(ub(a,c)|0){p=9;S=q;return p|0}b[p>>2]=0;a:do if((d|0)>=1)if(g){l=1;k=0;m=0;n=1;g=a;while(1){if(!(k|m)){g=da(g,c,4,p,o)|0;if(g|0)break a;c=o;g=b[c>>2]|0;c=b[c+4>>2]|0;if(ub(g,c)|0){g=9;break a}}g=da(g,c,b[22384+(m<<2)>>2]|0,p,o)|0;if(g|0)break a;c=o;g=b[c>>2]|0;c=b[c+4>>2]|0;a=e+(l<<3)|0;b[a>>2]=g;b[a+4>>2]=c;b[f+(l<<2)>>2]=n;a=k+1|0;h=(a|0)==(n|0);i=m+1|0;j=(i|0)==6;if(ub(g,c)|0){g=9;break a}n=n+(j&h&1)|0;if((n|0)>(d|0)){g=0;break}else{l=l+1|0;k=h?0:a;m=h?(j?0:i):m}}}else{l=1;k=0;m=0;n=1;g=a;while(1){if(!(k|m)){g=da(g,c,4,p,o)|0;if(g|0)break a;c=o;g=b[c>>2]|0;c=b[c+4>>2]|0;if(ub(g,c)|0){g=9;break a}}g=da(g,c,b[22384+(m<<2)>>2]|0,p,o)|0;if(g|0)break a;c=o;g=b[c>>2]|0;c=b[c+4>>2]|0;a=e+(l<<3)|0;b[a>>2]=g;b[a+4>>2]=c;a=k+1|0;h=(a|0)==(n|0);i=m+1|0;j=(i|0)==6;if(ub(g,c)|0){g=9;break a}n=n+(j&h&1)|0;if((n|0)>(d|0)){g=0;break}else{l=l+1|0;k=h?0:a;m=h?(j?0:i):m}}}else g=0;while(0);p=g;S=q;return p|0}function ca(a,c,d,e,f,g,h,i){a=a|0;c=c|0;d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;i=i|0;var j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0;q=S;S=S+16|0;o=q+8|0;p=q;j=od(a|0,c|0,g|0,h|0)|0;l=G()|0;m=e+(j<<3)|0;r=m;s=b[r>>2]|0;r=b[r+4>>2]|0;k=(s|0)==(a|0)&(r|0)==(c|0);if(!((s|0)==0&(r|0)==0|k))do{j=gd(j|0,l|0,1,0)|0;j=nd(j|0,G()|0,g|0,h|0)|0;l=G()|0;m=e+(j<<3)|0;s=m;r=b[s>>2]|0;s=b[s+4>>2]|0;k=(r|0)==(a|0)&(s|0)==(c|0)}while(!((r|0)==0&(s|0)==0|k));j=f+(j<<2)|0;if(k?(b[j>>2]|0)<=(i|0):0){s=0;S=q;return s|0}s=m;b[s>>2]=a;b[s+4>>2]=c;b[j>>2]=i;if((i|0)>=(d|0)){s=0;S=q;return s|0}k=i+1|0;b[o>>2]=0;j=da(a,c,2,o,p)|0;switch(j|0){case 9:{n=9;break}case 0:{j=p;j=ca(b[j>>2]|0,b[j+4>>2]|0,d,e,f,g,h,k)|0;if(!j)n=9;break}default:{}}a:do if((n|0)==9){b[o>>2]=0;j=da(a,c,3,o,p)|0;switch(j|0){case 9:break;case 0:{j=p;j=ca(b[j>>2]|0,b[j+4>>2]|0,d,e,f,g,h,k)|0;if(j|0)break a;break}default:break a}b[o>>2]=0;j=da(a,c,1,o,p)|0;switch(j|0){case 9:break;case 0:{j=p;j=ca(b[j>>2]|0,b[j+4>>2]|0,d,e,f,g,h,k)|0;if(j|0)break a;break}default:break a}b[o>>2]=0;j=da(a,c,5,o,p)|0;switch(j|0){case 9:break;case 0:{j=p;j=ca(b[j>>2]|0,b[j+4>>2]|0,d,e,f,g,h,k)|0;if(j|0)break a;break}default:break a}b[o>>2]=0;j=da(a,c,4,o,p)|0;switch(j|0){case 9:break;case 0:{j=p;j=ca(b[j>>2]|0,b[j+4>>2]|0,d,e,f,g,h,k)|0;if(j|0)break a;break}default:break a}b[o>>2]=0;j=da(a,c,6,o,p)|0;switch(j|0){case 9:break;case 0:{j=p;j=ca(b[j>>2]|0,b[j+4>>2]|0,d,e,f,g,h,k)|0;if(j|0)break a;break}default:break a}s=0;S=q;return s|0}while(0);s=j;S=q;return s|0}function da(a,c,d,e,f){a=a|0;c=c|0;d=d|0;e=e|0;f=f|0;var g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0;if(d>>>0>6){f=1;return f|0}if((b[e>>2]|0)>0){g=0;do{d=Pa(d)|0;g=g+1|0}while((g|0)<(b[e>>2]|0))}m=qd(a|0,c|0,45)|0;G()|0;l=m&127;if(l>>>0>121){f=5;return f|0}j=Cb(a,c)|0;g=qd(a|0,c|0,52)|0;G()|0;g=g&15;a:do if(!g)k=8;else{while(1){h=(15-g|0)*3|0;i=qd(a|0,c|0,h|0)|0;G()|0;i=i&7;if((i|0)==7){c=5;break}p=(Ib(g)|0)==0;g=g+-1|0;n=rd(7,0,h|0)|0;c=c&~(G()|0);o=rd(b[(p?432:16)+(i*28|0)+(d<<2)>>2]|0,0,h|0)|0;h=G()|0;d=b[(p?640:224)+(i*28|0)+(d<<2)>>2]|0;a=o|a&~n;c=h|c;if(!d){d=0;break a}if(!g){k=8;break a}}return c|0}while(0);if((k|0)==8){p=b[848+(l*28|0)+(d<<2)>>2]|0;o=rd(p|0,0,45)|0;a=o|a;c=G()|0|c&-1040385;d=b[4272+(l*28|0)+(d<<2)>>2]|0;if((p&127|0)==127){p=rd(b[848+(l*28|0)+20>>2]|0,0,45)|0;c=G()|0|c&-1040385;d=b[4272+(l*28|0)+20>>2]|0;a=Eb(p|a,c)|0;c=G()|0;b[e>>2]=(b[e>>2]|0)+1}}i=qd(a|0,c|0,45)|0;G()|0;i=i&127;b:do if(!(la(i)|0)){if((d|0)>0){g=0;do{a=Eb(a,c)|0;c=G()|0;g=g+1|0}while((g|0)!=(d|0))}}else{c:do if((Cb(a,c)|0)==1){if((l|0)!=(i|0))if(ra(i,b[7696+(l*28|0)>>2]|0)|0){a=Gb(a,c)|0;h=1;c=G()|0;break}else{a=Eb(a,c)|0;h=1;c=G()|0;break}switch(j|0){case 3:{a=Eb(a,c)|0;c=G()|0;b[e>>2]=(b[e>>2]|0)+1;h=0;break c}case 5:{a=Gb(a,c)|0;c=G()|0;b[e>>2]=(b[e>>2]|0)+5;h=0;break c}case 0:{p=9;return p|0}default:{p=1;return p|0}}}else h=0;while(0);if((d|0)>0){g=0;do{a=Db(a,c)|0;c=G()|0;g=g+1|0}while((g|0)!=(d|0))}if((l|0)!=(i|0)){if(!(ma(i)|0)){if((h|0)!=0|(Cb(a,c)|0)!=5)break;b[e>>2]=(b[e>>2]|0)+1;break}switch(m&127){case 8:case 118:break b;default:{}}if((Cb(a,c)|0)!=3)b[e>>2]=(b[e>>2]|0)+1}}while(0);b[e>>2]=((b[e>>2]|0)+d|0)%6|0;p=f;b[p>>2]=a;b[p+4>>2]=c;p=0;return p|0}function ea(a,c,d,e){a=a|0;c=c|0;d=d|0;e=e|0;var f=0,g=0,h=0,i=0,j=0,k=0;i=S;S=S+16|0;g=i;h=i+8|0;f=(ub(a,c)|0)==0;f=f?1:2;while(1){b[h>>2]=0;k=(da(a,c,f,h,g)|0)==0;j=g;if(k&((b[j>>2]|0)==(d|0)?(b[j+4>>2]|0)==(e|0):0)){a=4;break}f=f+1|0;if(f>>>0>=7){f=7;a=4;break}}if((a|0)==4){S=i;return f|0}return 0}function fa(a,c,d,e){a=a|0;c=c|0;d=d|0;e=e|0;var f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0;p=S;S=S+16|0;n=p;o=p+8|0;m=n;b[m>>2]=a;b[m+4>>2]=c;if(!d){o=e;b[o>>2]=a;b[o+4>>2]=c;o=0;S=p;return o|0}b[o>>2]=0;a:do if(!(ub(a,c)|0)){g=(d|0)>0;if(g){f=0;m=a;do{a=da(m,c,4,o,n)|0;if(a|0)break a;c=n;m=b[c>>2]|0;c=b[c+4>>2]|0;f=f+1|0;if(ub(m,c)|0){a=9;break a}}while((f|0)<(d|0));l=e;b[l>>2]=m;b[l+4>>2]=c;l=d+-1|0;if(g){k=0;a=1;do{f=22384+(k<<2)|0;if((k|0)==5){h=b[f>>2]|0;g=0;f=a;while(1){a=n;a=da(b[a>>2]|0,b[a+4>>2]|0,h,o,n)|0;if(a|0)break a;if((g|0)!=(l|0)){j=n;i=b[j>>2]|0;j=b[j+4>>2]|0;a=e+(f<<3)|0;b[a>>2]=i;b[a+4>>2]=j;if(!(ub(i,j)|0))a=f+1|0;else{a=9;break a}}else a=f;g=g+1|0;if((g|0)>=(d|0))break;else f=a}}else{h=n;j=b[f>>2]|0;i=0;f=a;g=b[h>>2]|0;h=b[h+4>>2]|0;while(1){a=da(g,h,j,o,n)|0;if(a|0)break a;h=n;g=b[h>>2]|0;h=b[h+4>>2]|0;a=e+(f<<3)|0;b[a>>2]=g;b[a+4>>2]=h;a=f+1|0;if(ub(g,h)|0){a=9;break a}i=i+1|0;if((i|0)>=(d|0))break;else f=a}}k=k+1|0}while(k>>>0<6);a=n;h=m;f=b[a>>2]|0;g=c;a=b[a+4>>2]|0}else{h=m;f=m;g=c;a=c}}else{h=e;b[h>>2]=a;b[h+4>>2]=c;h=a;f=a;g=c;a=c}a=(h|0)==(f|0)&(g|0)==(a|0)?0:9}else a=9;while(0);o=a;S=p;return o|0}function ga(a,c,d,e){a=a|0;c=c|0;d=d|0;e=e|0;var f=0,g=0,h=0,i=0,j=0;j=S;S=S+48|0;f=j+8|0;g=j;if(d|0){e=15;S=j;return e|0}d=a;i=b[d+4>>2]|0;h=g;b[h>>2]=b[d>>2];b[h+4>>2]=i;zc(g,f);h=ya(f,c)|0;i=G()|0;c=b[g>>2]|0;g=b[a+8>>2]|0;if((g|0)>0){f=b[a+12>>2]|0;d=0;do{c=(b[f+(d<<3)>>2]|0)+c|0;d=d+1|0}while((d|0)<(g|0))}a=((c|0)<0)<<31>>31;g=(i|0)<(a|0)|(i|0)==(a|0)&h>>>0>>0&((t|0)!=(-1|0)&(p|0)!=(-1|0))^1)):0){h=s?r:c;g=t;q=145}if((q|0)==145){c=(b[5905]|0)+h|0;b[5905]=c;if(c>>>0>(b[5906]|0)>>>0)b[5906]=c;j=b[5803]|0;f:do if(j){c=23636;while(1){a=b[c>>2]|0;d=b[c+4>>2]|0;if((g|0)==(a+d|0)){q=154;break}e=b[c+8>>2]|0;if(!e)break;else c=e}if(((q|0)==154?(u=c+4|0,(b[c+12>>2]&8|0)==0):0)?g>>>0>j>>>0&a>>>0<=j>>>0:0){b[u>>2]=d+h;v=(b[5800]|0)+h|0;t=j+8|0;t=(t&7|0)==0?0:0-t&7;u=j+t|0;t=v-t|0;b[5803]=u;b[5800]=t;b[u+4>>2]=t|1;b[j+v+4>>2]=40;b[5804]=b[5919];break}if(g>>>0<(b[5801]|0)>>>0)b[5801]=g;d=g+h|0;c=23636;while(1){if((b[c>>2]|0)==(d|0)){q=162;break}a=b[c+8>>2]|0;if(!a)break;else c=a}if((q|0)==162?(b[c+12>>2]&8|0)==0:0){b[c>>2]=g;l=c+4|0;b[l>>2]=(b[l>>2]|0)+h;l=g+8|0;l=g+((l&7|0)==0?0:0-l&7)|0;c=d+8|0;c=d+((c&7|0)==0?0:0-c&7)|0;k=l+m|0;i=c-l-m|0;b[l+4>>2]=m|3;g:do if((j|0)==(c|0)){v=(b[5800]|0)+i|0;b[5800]=v;b[5803]=k;b[k+4>>2]=v|1}else{if((b[5802]|0)==(c|0)){v=(b[5799]|0)+i|0;b[5799]=v;b[5802]=k;b[k+4>>2]=v|1;b[k+v>>2]=v;break}a=b[c+4>>2]|0;if((a&3|0)==1){h=a&-8;e=a>>>3;h:do if(a>>>0<256){a=b[c+8>>2]|0;d=b[c+12>>2]|0;if((d|0)==(a|0)){b[5797]=b[5797]&~(1< >>(o>>>0))&j|l< >>0&((t|0)!=(-1|0)&(p|0)!=(-1|0))^1)):0){h=s?r:c;g=t;q=145}if((q|0)==145){c=(b[5905]|0)+h|0;b[5905]=c;if(c>>>0>(b[5906]|0)>>>0)b[5906]=c;j=b[5803]|0;f:do if(j){c=23636;while(1){a=b[c>>2]|0;d=b[c+4>>2]|0;if((g|0)==(a+d|0)){q=154;break}e=b[c+8>>2]|0;if(!e)break;else c=e}if(((q|0)==154?(u=c+4|0,(b[c+12>>2]&8|0)==0):0)?g>>>0>j>>>0&a>>>0<=j>>>0:0){b[u>>2]=d+h;v=(b[5800]|0)+h|0;t=j+8|0;t=(t&7|0)==0?0:0-t&7;u=j+t|0;t=v-t|0;b[5803]=u;b[5800]=t;b[u+4>>2]=t|1;b[j+v+4>>2]=40;b[5804]=b[5919];break}if(g>>>0<(b[5801]|0)>>>0)b[5801]=g;d=g+h|0;c=23636;while(1){if((b[c>>2]|0)==(d|0)){q=162;break}a=b[c+8>>2]|0;if(!a)break;else c=a}if((q|0)==162?(b[c+12>>2]&8|0)==0:0){b[c>>2]=g;l=c+4|0;b[l>>2]=(b[l>>2]|0)+h;l=g+8|0;l=g+((l&7|0)==0?0:0-l&7)|0;c=d+8|0;c=d+((c&7|0)==0?0:0-c&7)|0;k=l+m|0;i=c-l-m|0;b[l+4>>2]=m|3;g:do if((j|0)==(c|0)){v=(b[5800]|0)+i|0;b[5800]=v;b[5803]=k;b[k+4>>2]=v|1}else{if((b[5802]|0)==(c|0)){v=(b[5799]|0)+i|0;b[5799]=v;b[5802]=k;b[k+4>>2]=v|1;b[k+v>>2]=v;break}a=b[c+4>>2]|0;if((a&3|0)==1){h=a&-8;e=a>>>3;h:do if(a>>>0<256){a=b[c+8>>2]|0;d=b[c+12>>2]|0;if((d|0)==(a|0)){b[5797]=b[5797]&~(1< >>(o>>>0))&j|l<>3]=x;s=x}if(h>t)e[i>>3]=h;else h=t;if(x>j){e[o>>3]=x;j=x}u=x>0.0&xv?x:v;g=g|+q(+(x-w))>3.141592653589793;if(r)break;else t=h}if(g){e[o>>3]=v;e[n>>3]=u}}else{b[i>>2]=0;b[i+4>>2]=0;b[i+8>>2]=0;b[i+12>>2]=0;b[i+16>>2]=0;b[i+20>>2]=0;b[i+24>>2]=0;b[i+28>>2]=0}g=y+1|0}E=f+8|0;f=b[E>>2]|0;b[E>>2]=0;if(!f){K=45;break}else{y=g;n=c}}if((K|0)==21)H(22568,22590,35,22602);else if((K|0)==23)H(22622,22590,37,22602);else if((K|0)==27)H(22665,22590,61,22688);else if((K|0)==45){b:do if((F|0)>0){E=(g|0)==0;C=g<<2;D=(a|0)==0;B=0;c=0;while(1){A=b[I+(B<<2)>>2]|0;if(!E){y=dd(C)|0;if(!y){K=50;break}z=dd(C)|0;if(!z){K=52;break}c:do if(!D){g=0;d=0;i=a;while(1){f=G+(g<<5)|0;if(pc(b[i>>2]|0,f,b[A>>2]|0)|0){b[y+(d<<2)>>2]=i;b[z+(d<<2)>>2]=f;r=d+1|0}else r=d;i=b[i+8>>2]|0;if(!i)break;else{g=g+1|0;d=r}}if((r|0)>0){f=b[y>>2]|0;if((r|0)==1)d=f;else{o=0;p=-1;d=f;n=f;while(1){l=b[n>>2]|0;f=0;i=0;while(1){g=b[b[y+(i<<2)>>2]>>2]|0;if((g|0)==(l|0))m=f;else m=f+((pc(g,b[z+(i<<2)>>2]|0,b[l>>2]|0)|0)&1)|0;i=i+1|0;if((i|0)==(r|0))break;else f=m}g=(m|0)>(p|0);d=g?n:d;f=o+1|0;if((f|0)==(r|0))break c;o=f;p=g?m:p;n=b[y+(f<<2)>>2]|0}}}else d=0}else d=0;while(0);ed(y);ed(z);if(d){g=d+4|0;f=b[g>>2]|0;if(!f){if(b[d>>2]|0){K=70;break}}else d=f+8|0;b[d>>2]=A;b[g>>2]=A}else K=73}else K=73;if((K|0)==73){K=0;c=b[A>>2]|0;if(c|0)do{z=c;c=b[c+16>>2]|0;ed(z)}while((c|0)!=0);ed(A);c=2}B=B+1|0;if((B|0)>=(F|0)){J=c;break b}}if((K|0)==50)H(22807,22590,249,22826);else if((K|0)==52)H(22845,22590,252,22826);else if((K|0)==70)H(22665,22590,61,22688)}else J=0;while(0);ed(I);ed(G);K=J;return K|0}return 0}function pc(a,c,d){a=a|0;c=c|0;d=d|0;var f=0.0,g=0.0,h=0.0,i=0.0,j=0.0,k=0.0,l=0.0,m=0;if(!(xa(c,d)|0)){a=0;return a|0}c=wa(c)|0;f=+e[d>>3];g=+e[d+8>>3];g=c&g<0.0?g+6.283185307179586:g;a=b[a>>2]|0;if(!a){a=0;return a|0}if(c){c=0;l=g;d=a;a:while(1){while(1){i=+e[d>>3];g=+e[d+8>>3];d=d+16|0;m=b[d>>2]|0;m=(m|0)==0?a:m;h=+e[m>>3];j=+e[m+8>>3];if(i>h){k=i;i=j}else{k=h;h=i;i=g;g=j}f=f==h|f==k?f+2.220446049250313e-16:f;if(!(f