// All material copyright ESRI, All Rights Reserved, unless otherwise specified.
// See http://js.arcgis.com/3.23/esri/copyright.txt for details.
//>>built
define("esri/layers/vectorTiles/views/vectorTiles/SignedDistanceFunctions",["require","exports"],function(v,n){function p(a){return a-Math.floor(a)}function q(a,d,e){0>a?a=0:.9999991<a&&(a=.9999991);var f=p(a*r[0]),h=p(a*r[1]),b=p(a*r[2]);a=p(a*r[3]);d[e+0]=256*(f-f*t[0]);d[e+1]=256*(h-f*t[1]);d[e+2]=256*(b-h*t[2]);d[e+3]=256*(a-b*t[3])}Object.defineProperty(n,"__esModule",{value:!0});var r=[16777216,65536,256,1],t=[0,1/256,1/256,1/256],u=[1/16777216,1/65536,1/256,1];n.packFloat=q;n.unpackFloat=function(a,
d){var e=a[d+1]/256,f=a[d+2]/256,h=a[d+3]/256,b;b=0+a[d+0]/256*u[0];b+=e*u[1];b+=f*u[2];return b+=h*u[3]};n.computeSignedDistancefieldCicle=function(a,d){for(var e=new Uint8Array(4*a*a),f=a/2-.5,h=d/2,b,c,l,k=0;k<a;k++)for(var g=0;g<a;g++)b=g+a*k,c=g-f,l=k-f,c=Math.sqrt(c*c+l*l)-h,c=c/a+.5,q(c,e,4*b);return e};n.computeSignedDistancefieldSquare=function(a,d,e){e&&(d/=Math.SQRT2);for(var f=1/Math.SQRT2,h=new Uint8Array(4*a*a),b,c,l,k,g=0;g<a;g++)for(var m=0;m<a;m++)b=m-.5*(a-.5),c=g-.5*(a-.5),l=g*
a+m,e&&(k=(b+c)*f,c=(c-b)*f,b=k),b=Math.max(Math.abs(b),Math.abs(c))-.5*d,b=b/a+.5,q(b,h,4*l);return h};n.computeSignedDistancefieldCrossAndX=function(a,d,e){e&&(d*=Math.SQRT2);var f=1/Math.SQRT2;d*=.5;for(var h=new Uint8Array(4*a*a),b,c,l,k,g=0;g<a;g++)for(var m=0;m<a;m++)b=m-.5*a+0,c=g-.5*a+0,l=g*a+m,e&&(k=(b+c)*f,c=(c-b)*f,b=k),b=Math.abs(b),c=Math.abs(c),b=b>c?b>d?Math.sqrt((b-d)*(b-d)+c*c):c:c>d?Math.sqrt(b*b+(c-d)*(c-d)):b,b=b/a+.5,q(b,h,4*l);return h}});