text: // All material copyright ESRI, All Rights Reserved, unless otherwise specified.
  // See https://js.arcgis.com/3.38/esri/copyright.txt for details.
  //>>built
  define("esri/layers/vectorTiles/views/3d/support/mathUtils",["require","exports","../lib/glMatrix"],function(l,e,f){function q(a){return Math.asin(1<a?1:-1>a?-1:a)}function r(a){return Math.acos(1<a?1:-1>a?-1:a)}function t(a,c,b){return a<c?c:a>b?b:a}function m(a){for(var c in a){var b=a[c];b instanceof Function&&(a[c]=b.bind(a))}return a}Object.defineProperty(e,"__esModule",{value:!0});e.deg2rad=function(a){return a*Math.PI/180};e.rad2deg=function(a){return 180*a/Math.PI};e.asin=q;e.acos=r;e.sign=
  Math.sign||function(a){return+(0<a)-+(0>a)||+a};e.log2=Math.log2||function(a){return Math.log(a)/Math.LN2};e.fovx2fovy=function(a,c,b){return 2*Math.atan(b*Math.tan(.5*a)/c)};e.fovy2fovx=function(a,c,b){return 2*Math.atan(c*Math.tan(.5*a)/b)};e.makeOrthonormal=function(a,c,b){b=b||a;var d=f.vec3d.dot(a,c);f.vec3d.set3(a[0]-d*c[0],a[1]-d*c[1],a[2]-d*c[2],b);f.vec3d.normalize(b)};e.tangentFrame=function(a,c,b){Math.abs(a[0])>Math.abs(a[1])?f.vec3d.set3(0,1,0,c):f.vec3d.set3(1,0,0,c);f.vec3d.cross(a,
  c,b);f.vec3d.normalize(c);f.vec3d.cross(b,a,c);f.vec3d.normalize(b)};e.cartesianToSpherical=function(a,c){var b=f.vec3d.length(a),d=q(a[2]/b);f.vec3d.set3(b,d,Math.atan2(a[1]/b,a[0]/b),c)};e.sphericalToCartesian=function(a,c){var b=a[0],d=a[1];a=a[2];var g=Math.cos(d);f.vec3d.set3(b*g*Math.cos(a),b*g*Math.sin(a),b*Math.sin(d),c)};e.lerp=function(a,c,b){return a+(c-a)*b};e.bilerp=function(a,c,b,d,g,h){a+=(c-a)*g;return a+(b+(d-b)*g-a)*h};e.slerp=function(a,c,b,d){void 0===d&&(d=a);var g=f.vec3d.length(a),
  h=f.vec3d.length(c),k=f.vec3d.dot(a,c)/(g*h);if(.9999999999999999>k){k=Math.acos(k);var u=((1-b)*g+b*h)/Math.sin(k);h=u/h*Math.sin(b*k);f.vec3d.scale(a,u/g*Math.sin((1-b)*k),n);f.vec3d.scale(c,h,p);return f.vec3d.add(n,p,d)}return f.vec3d.lerp(a,c,b,d)};e.angle=function(a,c,b){a=f.vec3d.normalize(a,n);c=f.vec3d.normalize(c,p);var d=r(f.vec3d.dot(a,c));return b&&(a=f.vec3d.cross(a,c,v),0>f.vec3d.dot(a,b))?-d:d};e.clamp=t;e.isFinite=Number.isFinite||function(a){return"number"===typeof a&&window.isFinite(a)};
  e.isNaN=Number.isNaN||function(a){return a!==a};e.makePiecewiseLinearFunction=function(a){var c=a.length;return function(b){var d=0;if(b<=a[0][0])return a[0][1];if(b>=a[c-1][0])return a[c-1][1];for(;b>a[d][0];)d++;var g=a[d][0];b=(g-b)/(g-a[d-1][0]);return b*a[d-1][1]+(1-b)*a[d][1]}};e.vectorEquals=function(a,c){if(null==a||null==c)return a!==c;if(a.length!==c.length)return!1;for(var b=0;b<a.length;b++)if(a[b]!==c[b])return!1;return!0};e.floatEqualRelative=function(a,c,b){void 0===b&&(b=1E-6);if(e.isNaN(a)||
  e.isNaN(c))return!1;if(a===c)return!0;var d=Math.abs(a-c),g=Math.abs(a),h=Math.abs(c);if(0===a||0===c||1E-12>g&&1E-12>h){if(d>.01*b)return!1}else if(d/(g+h)>b)return!1;return!0};e.floatEqualAbsolute=function(a,c,b){void 0===b&&(b=1E-6);return e.isNaN(a)||e.isNaN(c)?!1:(a>c?a-c:c-a)<=b};l=function(){function a(c,b){this.min=c;this.max=b;this.range=b-c}a.prototype.ndiff=function(c,b){void 0===b&&(b=0);return Math.ceil((c-b)/this.range)*this.range+b};a.prototype._normalize=function(c,b,d,g){void 0===
  g&&(g=0);d-=g;d<c?d+=this.ndiff(c-d):d>b&&(d-=this.ndiff(d-b));return d+g};a.prototype.normalize=function(c,b){return this._normalize(this.min,this.max,c,b)};a.prototype.clamp=function(c,b){void 0===b&&(b=0);return t(c-b,this.min,this.max)+b};a.prototype.monotonic=function(c,b,d){return c<b?b:b+this.ndiff(c-b,d)};a.prototype.minimalMonotonic=function(c,b,d){return this._normalize(c,c+this.range,b,d)};a.prototype.center=function(c,b,d){b=this.monotonic(c,b,d);return this.normalize((c+b)/2,d)};a.prototype.diff=
  function(c,b,d){return this.monotonic(c,b,d)-c};a.prototype.contains=function(c,b,d){b=this.minimalMonotonic(c,b);d=this.minimalMonotonic(c,d);return d>c&&d<b};return a}();e.Cyclical=l;e.cyclical2PI=m(new l(0,2*Math.PI));e.cyclicalPI=m(new l(-Math.PI,Math.PI));e.cyclicalDeg=m(new l(0,360));var v=f.vec3d.create(),n=f.vec3d.create(),p=f.vec3d.create()});