/*
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
See https://js.arcgis.com/4.24/esri/copyright.txt for details.
*/
define(["exports","../../../core/mathUtils","../../../chunks/vec3","../../../chunks/vec3f64"],(function(t,n,e,a){"use strict";function r(t,n){return t>n?Math.cos(n):Math.cos(t)}function o(t,n,e){return 2*Math.atan(e*Math.tan(.5*t)/n)}function c(t,n,e){return 2*Math.atan(n*Math.tan(.5*t)/e)}function s(t){const n=t[0]*t[0]+t[4]*t[4]+t[8]*t[8],e=t[1]*t[1]+t[5]*t[5]+t[9]*t[9],a=t[2]*t[2]+t[6]*t[6]+t[10]*t[10];return Math.sqrt(Math.max(n,e,a))}function i(t,n){const a=Math.sqrt(n[0]*n[0]+n[4]*n[4]+n[8]*n[8]),r=Math.sqrt(n[1]*n[1]+n[5]*n[5]+n[9]*n[9]),o=Math.sqrt(n[2]*n[2]+n[6]*n[6]+n[10]*n[10]);return e.set(t,a,r,o),t}function u(t,n,a){a=a||t;const r=e.dot(t,n);e.set(a,t[0]-r*n[0],t[1]-r*n[1],t[2]-r*n[2]),e.normalize(a,a)}function l(t,n,a){Math.abs(t[0])>Math.abs(t[1])?e.set(n,0,1,0):e.set(n,1,0,0),e.cross(a,t,n),e.normalize(n,n),e.cross(n,a,t),e.normalize(a,a)}function h(t,n){return(t%n+n)%n}function f(t,n,e,a,r,o){const c=t+(n-t)*r;return c+(e+(a-e)*r-c)*o}function M(t,n,r,o=a.create()){const c=e.length(t),s=e.length(n),i=e.dot(t,n)/(c*s);if(i<.9999999999999999){const a=Math.acos(i),u=((1-r)*c+r*s)/Math.sin(a),l=u/c*Math.sin((1-r)*a),h=u/s*Math.sin(r*a);return e.scale(x,t,l),e.scale(k,n,h),e.add(o,x,k)}return e.lerp(o,t,n,r)}function d(t,n,r,o=a.create(),c=a.create()){const s=e.length(t),i=e.length(n),u=e.dot(t,n)/(s*i);if(u<.9999999999999999){const a=Math.acos(u),l=Math.sin(a),h=Math.sin(r*a),f=Math.sin((1-r)*a),M=(1-r)*s+r*i;{const a=M/l,r=a/s*f,c=a/i*h;e.scale(x,t,r),e.scale(k,n,c),e.add(o,x,k)}{const o=1/s*(-Math.cos((1-r)*a)*a*M+f*(-s+i));e.scale(x,t,o);const u=1/i*(Math.cos(r*a)*a*M+h*(-s+i));e.scale(k,n,u),e.add(c,x,k),e.scale(c,c,1/l)}return c}return e.lerp(o,t,n,r),e.subtract(c,n,t),e.normalize(c,c),c}function m(t,a,r){t=e.normalize(x,t),a=e.normalize(k,a);const o=n.acosClamped(e.dot(t,a));if(r){const n=e.cross(z,t,a);if(e.dot(n,r)<0)return-o}return o}function p(t){const n=t.length;return e=>{if(e<=t[0][0])return t[0][1];if(e>=t[n-1][0])return t[n-1][1];let a=1;for(;e>t[a][0];)a++;const r=t[a-1][0],o=t[a][0],c=(o-e)/(o-r);return c*t[a-1][1]+(1-c)*t[a][1]}}function g(t,n,a,r){e.subtract(v,n,t),e.subtract(b,a,t),e.cross(r,v,b),e.normalize(r,r),r[3]=-e.dot(t,r)}const v=a.create(),b=a.create(),z=a.create(),x=a.create(),k=a.create();t.angle=m,t.bilerp=f,t.cosCapped=r,t.fovx2fovy=o,t.fovy2fovx=c,t.makeOrthonormal=u,t.makePiecewiseLinearFunction=p,t.maxScale=s,t.moduloPositive=h,t.planeFromPoints=g,t.scaleFromMatrix=i,t.slerp=M,t.slerpTangent=d,t.tangentFrame=l,Object.defineProperties(t,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}));
