define(["exports","./defaultValue-865ac579","./Math-76ce6367"],(function(e,t,n){"use strict";var i={ellipsoidCoordinates:null};function r(e,n,i){this.x=t.defaultValue(e,0),this.y=t.defaultValue(n,0),this.z=t.defaultValue(i,0)}r.fromSpherical=function(e,n){t.defined(n)||(n=new r);const i=e.clock,a=e.cone,o=t.defaultValue(e.magnitude,1),u=o*Math.sin(a);return n.x=u*Math.cos(i),n.y=u*Math.sin(i),n.z=o*Math.cos(a),n},r.fromElements=function(e,n,i,a){return t.defined(a)?(a.x=e,a.y=n,a.z=i,a):new r(e,n,i)},r.clone=function(e,n){if(t.defined(e))return t.defined(n)?(n.x=e.x,n.y=e.y,n.z=e.z,n):new r(e.x,e.y,e.z)},r.fromCartesian4=r.clone,r.packedLength=3,r.pack=function(e,n,i){return i=t.defaultValue(i,0),n[i++]=e.x,n[i++]=e.y,n[i]=e.z,n},r.unpack=function(e,n,i){return n=t.defaultValue(n,0),t.defined(i)||(i=new r),i.x=e[n++],i.y=e[n++],i.z=e[n],i},r.packArray=function(e,n){const i=e.length,a=3*i;t.defined(n)?(Array.isArray(n)||n.length===a)&&n.length!==a&&(n.length=a):n=new Array(a);for(let t=0;tn.CesiumMath.EPSILON12);return t.defined(u)?(u.x=s*b,u.y=c*E,u.z=d*T,u):new r(s*b,c*E,d*T)}function x(e,n,i){this.longitude=t.defaultValue(e,0),this.latitude=t.defaultValue(n,0),this.height=t.defaultValue(i,0)}x.fromRadians=function(e,n,i,r){return i=t.defaultValue(i,0),t.defined(r)?(r.longitude=e,r.latitude=n,r.height=i,r):new x(e,n,i)},x.fromDegrees=function(e,t,i,r){return e=n.CesiumMath.toRadians(e),t=n.CesiumMath.toRadians(t),x.fromRadians(e,t,i,r)};const z=new r,M=new r,w=new r,S=new r(1/6378137,1/6378137,1/6356752.314245179),C=new r(1/40680631590769,1/40680631590769,1/40408299984661.445),O=new r(1/1737400,1/1737400,1/1737400),R=new r(1/301855876e4,1/301855876e4,1/301855876e4),q=new r(1/6378137,1/6378137,1/6356752.314140356),_=new r(1/40680631590769,1/40680631590769,1/40408299983328.77),b=n.CesiumMath.EPSILON1;function E(e,i,a,o){i=t.defaultValue(i,0),a=t.defaultValue(a,0),o=t.defaultValue(o,0),e._radii=new r(i,a,o),e._radiiSquared=new r(i*i,a*a,o*o),e._radiiToTheFourth=new r(i*i*i*i,a*a*a*a,o*o*o*o),e._oneOverRadii=new r(0===i?0:1/i,0===a?0:1/a,0===o?0:1/o),e._oneOverRadiiSquared=new r(0===i?0:1/(i*i),0===a?0:1/(a*a),0===o?0:1/(o*o)),e._minimumRadius=Math.min(i,a,o),e._maximumRadius=Math.max(i,a,o),e._centerToleranceSquared=n.CesiumMath.EPSILON1,0!==e._radiiSquared.z&&(e._squaredXOverSquaredZ=e._radiiSquared.x/e._radiiSquared.z)}function T(e,t,n){this._radii=void 0,this._radiiSquared=void 0,this._radiiToTheFourth=void 0,this._oneOverRadii=void 0,this._oneOverRadiiSquared=void 0,this._minimumRadius=void 0,this._maximumRadius=void 0,this._centerToleranceSquared=void 0,this._squaredXOverSquaredZ=void 0,E(this,e,t,n)}x.fromCartesian=function(e,a,o){let u=null,s=null;const c=t.defined(a)?a._centerToleranceSquared:b;"CGCS2000"===i.ellipsoidCoordinates?(u=q,s=_):"MOON"===i.ellipsoidCoordinates||"MOON2000"===i.ellipsoidCoordinates?(u=O,s=R):(u=t.defined(a)?a.oneOverRadii:S,s=t.defined(a)?a.oneOverRadiiSquared:C);const d=g(e,u,s,c,M);if(!t.defined(d))return;let l=r.multiplyComponents(d,s,z);l=r.normalize(l,l);const f=r.subtract(e,d,w),h=Math.atan2(l.y,l.x),m=Math.asin(l.z),y=n.CesiumMath.sign(r.dot(f,e))*r.magnitude(f);return t.defined(o)?(o.longitude=h,o.latitude=m,o.height=y,o):new x(h,m,y)},x.toCartesian=function(e,t,n){return r.fromRadians(e.longitude,e.latitude,e.height,t,n)},x.clone=function(e,n){if(t.defined(e))return t.defined(n)?(n.longitude=e.longitude,n.latitude=e.latitude,n.height=e.height,n):new x(e.longitude,e.latitude,e.height)},x.equals=function(e,n){return e===n||t.defined(e)&&t.defined(n)&&e.longitude===n.longitude&&e.latitude===n.latitude&&e.height===n.height},x.equalsEpsilon=function(e,n,i){return i=t.defaultValue(i,0),e===n||t.defined(e)&&t.defined(n)&&Math.abs(e.longitude-n.longitude)<=i&&Math.abs(e.latitude-n.latitude)<=i&&Math.abs(e.height-n.height)<=i},x.ZERO=Object.freeze(new x(0,0,0)),x.prototype.clone=function(e){return x.clone(this,e)},x.prototype.equals=function(e){return x.equals(this,e)},x.prototype.equalsEpsilon=function(e,t){return x.equalsEpsilon(this,e,t)},x.prototype.toString=function(){return`(${this.longitude}, ${this.latitude}, ${this.height})`},Object.defineProperties(T.prototype,{radii:{get:function(){return this._radii}},radiiSquared:{get:function(){return this._radiiSquared}},radiiToTheFourth:{get:function(){return this._radiiToTheFourth}},oneOverRadii:{get:function(){return this._oneOverRadii}},oneOverRadiiSquared:{get:function(){return this._oneOverRadiiSquared}},minimumRadius:{get:function(){return this._minimumRadius}},maximumRadius:{get:function(){return this._maximumRadius}}}),T.clone=function(e,n){if(!t.defined(e))return;const i=e._radii;return t.defined(n)?(r.clone(i,n._radii),r.clone(e._radiiSquared,n._radiiSquared),r.clone(e._radiiToTheFourth,n._radiiToTheFourth),r.clone(e._oneOverRadii,n._oneOverRadii),r.clone(e._oneOverRadiiSquared,n._oneOverRadiiSquared),n._minimumRadius=e._minimumRadius,n._maximumRadius=e._maximumRadius,n._centerToleranceSquared=e._centerToleranceSquared,n):new T(i.x,i.y,i.z)},T.fromCartesian3=function(e,n){return t.defined(n)||(n=new T),t.defined(e)?(E(n,e.x,e.y,e.z),n):n},T.WGS84=Object.freeze(new T(6378137,6378137,6356752.314245179)),T.CGCS2000=Object.freeze(new T(6378137,6378137,6356752.314140356)),T.MOON2000=Object.freeze(new T(1737400,1737400,1737400)),T.UNIT_SPHERE=Object.freeze(new T(1,1,1)),T.MOON=Object.freeze(new T(n.CesiumMath.LUNAR_RADIUS,n.CesiumMath.LUNAR_RADIUS,n.CesiumMath.LUNAR_RADIUS)),T.prototype.clone=function(e){return T.clone(this,e)},T.packedLength=r.packedLength,T.pack=function(e,n,i){return i=t.defaultValue(i,0),r.pack(e._radii,n,i),n},T.unpack=function(e,n,i){n=t.defaultValue(n,0);const a=r.unpack(e,n);return T.fromCartesian3(a,i)},T.prototype.geocentricSurfaceNormal=r.normalize,T.prototype.geodeticSurfaceNormalCartographic=function(e,n){const i=e.longitude,a=e.latitude,o=Math.cos(a),u=o*Math.cos(i),s=o*Math.sin(i),c=Math.sin(a);return t.defined(n)||(n=new r),n.x=u,n.y=s,n.z=c,r.normalize(n,n)},T.prototype.geodeticSurfaceNormal=function(e,i){if(!r.equalsEpsilon(e,r.ZERO,n.CesiumMath.EPSILON14))return t.defined(i)||(i=new r),i=r.multiplyComponents(e,this._oneOverRadiiSquared,i),r.normalize(i,i)};const A=new r,N=new r;T.prototype.cartographicToCartesian=function(e,n){const i=A,a=N;this.geodeticSurfaceNormalCartographic(e,i),r.multiplyComponents(this._radiiSquared,i,a);const o=Math.sqrt(r.dot(i,a));return r.divideByScalar(a,o,a),r.multiplyByScalar(i,e.height,i),t.defined(n)||(n=new r),r.add(a,i,n)},T.prototype.cartographicArrayToCartesianArray=function(e,n){const i=e.length;t.defined(n)?n.length=i:n=new Array(i);for(let t=0;t=this._radii.z-n))return i};const U=[.14887433898163,.43339539412925,.67940956829902,.86506336668898,.97390652851717,0],k=[.29552422471475,.26926671930999,.21908636251598,.14945134915058,.066671344308684,0];function L(e,t,n){const i=.5*(t+e),r=.5*(t-e);let a=0;for(let e=0;e<5;e++){const t=r*U[e];a+=k[e]*(n(i+t)+n(i-t))}return a*=r,a}function B(e,n,i,r,a,o,u,s,c){this[0]=t.defaultValue(e,0),this[1]=t.defaultValue(r,0),this[2]=t.defaultValue(u,0),this[3]=t.defaultValue(n,0),this[4]=t.defaultValue(a,0),this[5]=t.defaultValue(s,0),this[6]=t.defaultValue(i,0),this[7]=t.defaultValue(o,0),this[8]=t.defaultValue(c,0)}T.prototype.surfaceArea=function(e){const t=e.west;let i=e.east;const r=e.south,a=e.north;for(;ir&&(a=t,r=n)}let o=1,u=0;const s=F[a],c=G[a];if(Math.abs(e[B.getElementIndex(c,s)])>i){const t=(e[B.getElementIndex(c,c)]-e[B.getElementIndex(s,s)])/2/e[B.getElementIndex(c,s)];let n;n=t<0?-1/(-t+Math.sqrt(1+t*t)):1/(t+Math.sqrt(1+t*t)),o=1/Math.sqrt(1+n*n),u=n*o}return(t=B.clone(B.IDENTITY,t))[B.getElementIndex(s,s)]=t[B.getElementIndex(c,c)]=o,t[B.getElementIndex(c,s)]=u,t[B.getElementIndex(s,c)]=-u,t}const H=new B,Q=new B;B.computeEigenDecomposition=function(e,i){const r=n.CesiumMath.EPSILON20;let a=0,o=0;t.defined(i)||(i={});const u=i.unitary=B.clone(B.IDENTITY,i.unitary),s=i.diagonal=B.clone(e,i.diagonal),c=r*function(e){let t=0;for(let n=0;n<9;++n){const i=e[n];t+=i*i}return Math.sqrt(t)}(s);for(;o<10&&X(s)>c;)Y(s,H),B.transpose(H,Q),B.multiply(s,H,s),B.multiply(Q,s,s),B.multiply(u,H,u),++a>2&&(++o,a=0);return i},B.abs=function(e,t){return t[0]=Math.abs(e[0]),t[1]=Math.abs(e[1]),t[2]=Math.abs(e[2]),t[3]=Math.abs(e[3]),t[4]=Math.abs(e[4]),t[5]=Math.abs(e[5]),t[6]=Math.abs(e[6]),t[7]=Math.abs(e[7]),t[8]=Math.abs(e[8]),t},B.determinant=function(e){const t=e[0],n=e[3],i=e[6],r=e[1],a=e[4],o=e[7],u=e[2],s=e[5],c=e[8];return t*(a*c-s*o)+r*(s*i-n*c)+u*(n*o-a*i)},B.inverse=function(e,t){const n=e[0],i=e[1],r=e[2],a=e[3],o=e[4],u=e[5],s=e[6],c=e[7],d=e[8],l=B.determinant(e);t[0]=o*d-c*u,t[1]=c*r-i*d,t[2]=i*u-o*r,t[3]=s*u-a*d,t[4]=n*d-s*r,t[5]=a*r-n*u,t[6]=a*c-s*o,t[7]=s*i-n*c,t[8]=n*o-a*i;const f=1/l;return B.multiplyByScalar(t,f,t)};const J=new B;B.inverseTranspose=function(e,t){return B.inverse(B.transpose(e,J),t)},B.equals=function(e,n){return e===n||t.defined(e)&&t.defined(n)&&e[0]===n[0]&&e[1]===n[1]&&e[2]===n[2]&&e[3]===n[3]&&e[4]===n[4]&&e[5]===n[5]&&e[6]===n[6]&&e[7]===n[7]&&e[8]===n[8]},B.equalsEpsilon=function(e,n,i){return i=t.defaultValue(i,0),e===n||t.defined(e)&&t.defined(n)&&Math.abs(e[0]-n[0])<=i&&Math.abs(e[1]-n[1])<=i&&Math.abs(e[2]-n[2])<=i&&Math.abs(e[3]-n[3])<=i&&Math.abs(e[4]-n[4])<=i&&Math.abs(e[5]-n[5])<=i&&Math.abs(e[6]-n[6])<=i&&Math.abs(e[7]-n[7])<=i&&Math.abs(e[8]-n[8])<=i},B.IDENTITY=Object.freeze(new B(1,0,0,0,1,0,0,0,1)),B.ZERO=Object.freeze(new B(0,0,0,0,0,0,0,0,0)),B.COLUMN0ROW0=0,B.COLUMN0ROW1=1,B.COLUMN0ROW2=2,B.COLUMN1ROW0=3,B.COLUMN1ROW1=4,B.COLUMN1ROW2=5,B.COLUMN2ROW0=6,B.COLUMN2ROW1=7,B.COLUMN2ROW2=8,Object.defineProperties(B.prototype,{length:{get:function(){return B.packedLength}}}),B.prototype.clone=function(e){return B.clone(this,e)},B.prototype.equals=function(e){return B.equals(this,e)},B.equalsArray=function(e,t,n){return e[0]===t[n]&&e[1]===t[n+1]&&e[2]===t[n+2]&&e[3]===t[n+3]&&e[4]===t[n+4]&&e[5]===t[n+5]&&e[6]===t[n+6]&&e[7]===t[n+7]&&e[8]===t[n+8]},B.prototype.equalsEpsilon=function(e,t){return B.equalsEpsilon(this,e,t)},B.prototype.toString=function(){return`(${this[0]}, ${this[3]}, ${this[6]})\n(${this[1]}, ${this[4]}, ${this[7]})\n(${this[2]}, ${this[5]}, ${this[8]})`},e.Cartesian3=r,e.Cartographic=x,e.Ellipsoid=T,e.Matrix3=B}));