Matrix2-e3fb4559.js 23 KB

1
  1. define(["exports","./Cartesian3-7e9cc2ff","./Check-741c5f3c","./defaultValue-81eec7ed","./Math-5f585871"],(function(t,e,n,i,a){"use strict";const r=new e.Cartesian3,u=new e.Cartesian3;function o(t,n,o,s,d){const c=t.x,h=t.y,l=t.z,f=n.x,m=n.y,y=n.z,p=c*c*f*f,C=h*h*m*m,g=l*l*y*y,M=p+C+g,w=Math.sqrt(1/M),x=e.Cartesian3.multiplyByScalar(t,w,r);if(M<s)return isFinite(w)?e.Cartesian3.clone(x,d):void 0;const _=o.x,S=o.y,O=o.z,q=u;q.x=x.x*_*2,q.y=x.y*S*2,q.z=x.z*O*2;let T,R,A,V,b,P,E,I,v,z,N,W=(1-w)*e.Cartesian3.magnitude(t)/(.5*e.Cartesian3.magnitude(q)),L=0;do{W-=L,A=1/(1+W*_),V=1/(1+W*S),b=1/(1+W*O),P=A*A,E=V*V,I=b*b,v=P*A,z=E*V,N=I*b,T=p*P+C*E+g*I-1,R=p*v*_+C*z*S+g*N*O;L=T/(-2*R)}while(Math.abs(T)>a.CesiumMath.EPSILON12);return i.defined(d)?(d.x=c*A,d.y=h*V,d.z=l*b,d):new e.Cartesian3(c*A,h*V,l*b)}function s(t,e,n){this.longitude=i.defaultValue(t,0),this.latitude=i.defaultValue(e,0),this.height=i.defaultValue(n,0)}s.fromRadians=function(t,e,n,a){return n=i.defaultValue(n,0),i.defined(a)?(a.longitude=t,a.latitude=e,a.height=n,a):new s(t,e,n)},s.fromDegrees=function(t,e,n,i){return t=a.CesiumMath.toRadians(t),e=a.CesiumMath.toRadians(e),s.fromRadians(t,e,n,i)};const d=new e.Cartesian3,c=new e.Cartesian3,h=new e.Cartesian3,l=new e.Cartesian3(1/6378137,1/6378137,1/6356752.314245179),f=new e.Cartesian3(1/40680631590769,1/40680631590769,1/40408299984661.445),m=a.CesiumMath.EPSILON1;function y(t,n,r,u){n=i.defaultValue(n,0),r=i.defaultValue(r,0),u=i.defaultValue(u,0),t._radii=new e.Cartesian3(n,r,u),t._radiiSquared=new e.Cartesian3(n*n,r*r,u*u),t._radiiToTheFourth=new e.Cartesian3(n*n*n*n,r*r*r*r,u*u*u*u),t._oneOverRadii=new e.Cartesian3(0===n?0:1/n,0===r?0:1/r,0===u?0:1/u),t._oneOverRadiiSquared=new e.Cartesian3(0===n?0:1/(n*n),0===r?0:1/(r*r),0===u?0:1/(u*u)),t._minimumRadius=Math.min(n,r,u),t._maximumRadius=Math.max(n,r,u),t._centerToleranceSquared=a.CesiumMath.EPSILON1,0!==t._radiiSquared.z&&(t._squaredXOverSquaredZ=t._radiiSquared.x/t._radiiSquared.z)}function p(t,e,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,y(this,t,e,n)}s.fromCartesian=function(t,n,r){const u=i.defined(n)?n.oneOverRadii:l,y=i.defined(n)?n.oneOverRadiiSquared:f,p=o(t,u,y,i.defined(n)?n._centerToleranceSquared:m,c);if(!i.defined(p))return;let C=e.Cartesian3.multiplyComponents(p,y,d);C=e.Cartesian3.normalize(C,C);const g=e.Cartesian3.subtract(t,p,h),M=Math.atan2(C.y,C.x),w=Math.asin(C.z),x=a.CesiumMath.sign(e.Cartesian3.dot(g,t))*e.Cartesian3.magnitude(g);return i.defined(r)?(r.longitude=M,r.latitude=w,r.height=x,r):new s(M,w,x)},s.toCartesian=function(t,n,i){return e.Cartesian3.fromRadians(t.longitude,t.latitude,t.height,n,i)},s.clone=function(t,e){if(i.defined(t))return i.defined(e)?(e.longitude=t.longitude,e.latitude=t.latitude,e.height=t.height,e):new s(t.longitude,t.latitude,t.height)},s.equals=function(t,e){return t===e||i.defined(t)&&i.defined(e)&&t.longitude===e.longitude&&t.latitude===e.latitude&&t.height===e.height},s.equalsEpsilon=function(t,e,n){return n=i.defaultValue(n,0),t===e||i.defined(t)&&i.defined(e)&&Math.abs(t.longitude-e.longitude)<=n&&Math.abs(t.latitude-e.latitude)<=n&&Math.abs(t.height-e.height)<=n},s.ZERO=Object.freeze(new s(0,0,0)),s.prototype.clone=function(t){return s.clone(this,t)},s.prototype.equals=function(t){return s.equals(this,t)},s.prototype.equalsEpsilon=function(t,e){return s.equalsEpsilon(this,t,e)},s.prototype.toString=function(){return`(${this.longitude}, ${this.latitude}, ${this.height})`},Object.defineProperties(p.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}}}),p.clone=function(t,n){if(!i.defined(t))return;const a=t._radii;return i.defined(n)?(e.Cartesian3.clone(a,n._radii),e.Cartesian3.clone(t._radiiSquared,n._radiiSquared),e.Cartesian3.clone(t._radiiToTheFourth,n._radiiToTheFourth),e.Cartesian3.clone(t._oneOverRadii,n._oneOverRadii),e.Cartesian3.clone(t._oneOverRadiiSquared,n._oneOverRadiiSquared),n._minimumRadius=t._minimumRadius,n._maximumRadius=t._maximumRadius,n._centerToleranceSquared=t._centerToleranceSquared,n):new p(a.x,a.y,a.z)},p.fromCartesian3=function(t,e){return i.defined(e)||(e=new p),i.defined(t)?(y(e,t.x,t.y,t.z),e):e},p.WGS84=Object.freeze(new p(6378137,6378137,6356752.314245179)),p.UNIT_SPHERE=Object.freeze(new p(1,1,1)),p.MOON=Object.freeze(new p(a.CesiumMath.LUNAR_RADIUS,a.CesiumMath.LUNAR_RADIUS,a.CesiumMath.LUNAR_RADIUS)),p.prototype.clone=function(t){return p.clone(this,t)},p.packedLength=e.Cartesian3.packedLength,p.pack=function(t,n,a){return a=i.defaultValue(a,0),e.Cartesian3.pack(t._radii,n,a),n},p.unpack=function(t,n,a){n=i.defaultValue(n,0);const r=e.Cartesian3.unpack(t,n);return p.fromCartesian3(r,a)},p.prototype.geocentricSurfaceNormal=e.Cartesian3.normalize,p.prototype.geodeticSurfaceNormalCartographic=function(t,n){const a=t.longitude,r=t.latitude,u=Math.cos(r),o=u*Math.cos(a),s=u*Math.sin(a),d=Math.sin(r);return i.defined(n)||(n=new e.Cartesian3),n.x=o,n.y=s,n.z=d,e.Cartesian3.normalize(n,n)},p.prototype.geodeticSurfaceNormal=function(t,n){if(!e.Cartesian3.equalsEpsilon(t,e.Cartesian3.ZERO,a.CesiumMath.EPSILON14))return i.defined(n)||(n=new e.Cartesian3),n=e.Cartesian3.multiplyComponents(t,this._oneOverRadiiSquared,n),e.Cartesian3.normalize(n,n)};const C=new e.Cartesian3,g=new e.Cartesian3;p.prototype.cartographicToCartesian=function(t,n){const a=C,r=g;this.geodeticSurfaceNormalCartographic(t,a),e.Cartesian3.multiplyComponents(this._radiiSquared,a,r);const u=Math.sqrt(e.Cartesian3.dot(a,r));return e.Cartesian3.divideByScalar(r,u,r),e.Cartesian3.multiplyByScalar(a,t.height,a),i.defined(n)||(n=new e.Cartesian3),e.Cartesian3.add(r,a,n)},p.prototype.cartographicArrayToCartesianArray=function(t,e){const n=t.length;i.defined(e)?e.length=n:e=new Array(n);for(let i=0;i<n;i++)e[i]=this.cartographicToCartesian(t[i],e[i]);return e};const M=new e.Cartesian3,w=new e.Cartesian3,x=new e.Cartesian3;p.prototype.cartesianToCartographic=function(t,n){const r=this.scaleToGeodeticSurface(t,w);if(!i.defined(r))return;const u=this.geodeticSurfaceNormal(r,M),o=e.Cartesian3.subtract(t,r,x),d=Math.atan2(u.y,u.x),c=Math.asin(u.z),h=a.CesiumMath.sign(e.Cartesian3.dot(o,t))*e.Cartesian3.magnitude(o);return i.defined(n)?(n.longitude=d,n.latitude=c,n.height=h,n):new s(d,c,h)},p.prototype.cartesianArrayToCartographicArray=function(t,e){const n=t.length;i.defined(e)?e.length=n:e=new Array(n);for(let i=0;i<n;++i)e[i]=this.cartesianToCartographic(t[i],e[i]);return e},p.prototype.scaleToGeodeticSurface=function(t,e){return o(t,this._oneOverRadii,this._oneOverRadiiSquared,this._centerToleranceSquared,e)},p.prototype.scaleToGeocentricSurface=function(t,n){i.defined(n)||(n=new e.Cartesian3);const a=t.x,r=t.y,u=t.z,o=this._oneOverRadiiSquared,s=1/Math.sqrt(a*a*o.x+r*r*o.y+u*u*o.z);return e.Cartesian3.multiplyByScalar(t,s,n)},p.prototype.transformPositionToScaledSpace=function(t,n){return i.defined(n)||(n=new e.Cartesian3),e.Cartesian3.multiplyComponents(t,this._oneOverRadii,n)},p.prototype.transformPositionFromScaledSpace=function(t,n){return i.defined(n)||(n=new e.Cartesian3),e.Cartesian3.multiplyComponents(t,this._radii,n)},p.prototype.equals=function(t){return this===t||i.defined(t)&&e.Cartesian3.equals(this._radii,t._radii)},p.prototype.toString=function(){return this._radii.toString()},p.prototype.getSurfaceNormalIntersectionWithZAxis=function(t,n,a){n=i.defaultValue(n,0);const r=this._squaredXOverSquaredZ;if(i.defined(a)||(a=new e.Cartesian3),a.x=0,a.y=0,a.z=t.z*(1-r),!(Math.abs(a.z)>=this._radii.z-n))return a};const _=[.14887433898163,.43339539412925,.67940956829902,.86506336668898,.97390652851717,0],S=[.29552422471475,.26926671930999,.21908636251598,.14945134915058,.066671344308684,0];function O(t,e,n){const i=.5*(e+t),a=.5*(e-t);let r=0;for(let t=0;t<5;t++){const e=a*_[t];r+=S[t]*(n(i+e)+n(i-e))}return r*=a,r}function q(t,e,n,a){this.west=i.defaultValue(t,0),this.south=i.defaultValue(e,0),this.east=i.defaultValue(n,0),this.north=i.defaultValue(a,0)}p.prototype.surfaceArea=function(t){const e=t.west;let n=t.east;const i=t.south,r=t.north;for(;n<e;)n+=a.CesiumMath.TWO_PI;const u=this._radiiSquared,o=u.x,s=u.y,d=u.z,c=o*s;return O(i,r,(function(t){const i=Math.cos(t),a=Math.sin(t);return Math.cos(t)*O(e,n,(function(t){const e=Math.cos(t),n=Math.sin(t);return Math.sqrt(c*a*a+d*(s*e*e+o*n*n)*i*i)}))}))},Object.defineProperties(q.prototype,{width:{get:function(){return q.computeWidth(this)}},height:{get:function(){return q.computeHeight(this)}}}),q.packedLength=4,q.pack=function(t,e,n){return n=i.defaultValue(n,0),e[n++]=t.west,e[n++]=t.south,e[n++]=t.east,e[n]=t.north,e},q.unpack=function(t,e,n){return e=i.defaultValue(e,0),i.defined(n)||(n=new q),n.west=t[e++],n.south=t[e++],n.east=t[e++],n.north=t[e],n},q.computeWidth=function(t){let e=t.east;const n=t.west;return e<n&&(e+=a.CesiumMath.TWO_PI),e-n},q.computeHeight=function(t){return t.north-t.south},q.fromDegrees=function(t,e,n,r,u){return t=a.CesiumMath.toRadians(i.defaultValue(t,0)),e=a.CesiumMath.toRadians(i.defaultValue(e,0)),n=a.CesiumMath.toRadians(i.defaultValue(n,0)),r=a.CesiumMath.toRadians(i.defaultValue(r,0)),i.defined(u)?(u.west=t,u.south=e,u.east=n,u.north=r,u):new q(t,e,n,r)},q.fromRadians=function(t,e,n,a,r){return i.defined(r)?(r.west=i.defaultValue(t,0),r.south=i.defaultValue(e,0),r.east=i.defaultValue(n,0),r.north=i.defaultValue(a,0),r):new q(t,e,n,a)},q.fromCartographicArray=function(t,e){let n=Number.MAX_VALUE,r=-Number.MAX_VALUE,u=Number.MAX_VALUE,o=-Number.MAX_VALUE,s=Number.MAX_VALUE,d=-Number.MAX_VALUE;for(let e=0,i=t.length;e<i;e++){const i=t[e];n=Math.min(n,i.longitude),r=Math.max(r,i.longitude),s=Math.min(s,i.latitude),d=Math.max(d,i.latitude);const c=i.longitude>=0?i.longitude:i.longitude+a.CesiumMath.TWO_PI;u=Math.min(u,c),o=Math.max(o,c)}return r-n>o-u&&(n=u,r=o,r>a.CesiumMath.PI&&(r-=a.CesiumMath.TWO_PI),n>a.CesiumMath.PI&&(n-=a.CesiumMath.TWO_PI)),i.defined(e)?(e.west=n,e.south=s,e.east=r,e.north=d,e):new q(n,s,r,d)},q.fromCartesianArray=function(t,e,n){e=i.defaultValue(e,p.WGS84);let r=Number.MAX_VALUE,u=-Number.MAX_VALUE,o=Number.MAX_VALUE,s=-Number.MAX_VALUE,d=Number.MAX_VALUE,c=-Number.MAX_VALUE;for(let n=0,i=t.length;n<i;n++){const i=e.cartesianToCartographic(t[n]);r=Math.min(r,i.longitude),u=Math.max(u,i.longitude),d=Math.min(d,i.latitude),c=Math.max(c,i.latitude);const h=i.longitude>=0?i.longitude:i.longitude+a.CesiumMath.TWO_PI;o=Math.min(o,h),s=Math.max(s,h)}return u-r>s-o&&(r=o,u=s,u>a.CesiumMath.PI&&(u-=a.CesiumMath.TWO_PI),r>a.CesiumMath.PI&&(r-=a.CesiumMath.TWO_PI)),i.defined(n)?(n.west=r,n.south=d,n.east=u,n.north=c,n):new q(r,d,u,c)},q.clone=function(t,e){if(i.defined(t))return i.defined(e)?(e.west=t.west,e.south=t.south,e.east=t.east,e.north=t.north,e):new q(t.west,t.south,t.east,t.north)},q.equalsEpsilon=function(t,e,n){return n=i.defaultValue(n,0),t===e||i.defined(t)&&i.defined(e)&&Math.abs(t.west-e.west)<=n&&Math.abs(t.south-e.south)<=n&&Math.abs(t.east-e.east)<=n&&Math.abs(t.north-e.north)<=n},q.prototype.clone=function(t){return q.clone(this,t)},q.prototype.equals=function(t){return q.equals(this,t)},q.equals=function(t,e){return t===e||i.defined(t)&&i.defined(e)&&t.west===e.west&&t.south===e.south&&t.east===e.east&&t.north===e.north},q.prototype.equalsEpsilon=function(t,e){return q.equalsEpsilon(this,t,e)},q.validate=function(t){},q.southwest=function(t,e){return i.defined(e)?(e.longitude=t.west,e.latitude=t.south,e.height=0,e):new s(t.west,t.south)},q.northwest=function(t,e){return i.defined(e)?(e.longitude=t.west,e.latitude=t.north,e.height=0,e):new s(t.west,t.north)},q.northeast=function(t,e){return i.defined(e)?(e.longitude=t.east,e.latitude=t.north,e.height=0,e):new s(t.east,t.north)},q.southeast=function(t,e){return i.defined(e)?(e.longitude=t.east,e.latitude=t.south,e.height=0,e):new s(t.east,t.south)},q.center=function(t,e){let n=t.east;const r=t.west;n<r&&(n+=a.CesiumMath.TWO_PI);const u=a.CesiumMath.negativePiToPi(.5*(r+n)),o=.5*(t.south+t.north);return i.defined(e)?(e.longitude=u,e.latitude=o,e.height=0,e):new s(u,o)},q.intersection=function(t,e,n){let r=t.east,u=t.west,o=e.east,s=e.west;r<u&&o>0?r+=a.CesiumMath.TWO_PI:o<s&&r>0&&(o+=a.CesiumMath.TWO_PI),r<u&&s<0?s+=a.CesiumMath.TWO_PI:o<s&&u<0&&(u+=a.CesiumMath.TWO_PI);const d=a.CesiumMath.negativePiToPi(Math.max(u,s)),c=a.CesiumMath.negativePiToPi(Math.min(r,o));if((t.west<t.east||e.west<e.east)&&c<=d)return;const h=Math.max(t.south,e.south),l=Math.min(t.north,e.north);return h>=l?void 0:i.defined(n)?(n.west=d,n.south=h,n.east=c,n.north=l,n):new q(d,h,c,l)},q.simpleIntersection=function(t,e,n){const a=Math.max(t.west,e.west),r=Math.max(t.south,e.south),u=Math.min(t.east,e.east),o=Math.min(t.north,e.north);if(!(r>=o||a>=u))return i.defined(n)?(n.west=a,n.south=r,n.east=u,n.north=o,n):new q(a,r,u,o)},q.union=function(t,e,n){i.defined(n)||(n=new q);let r=t.east,u=t.west,o=e.east,s=e.west;r<u&&o>0?r+=a.CesiumMath.TWO_PI:o<s&&r>0&&(o+=a.CesiumMath.TWO_PI),r<u&&s<0?s+=a.CesiumMath.TWO_PI:o<s&&u<0&&(u+=a.CesiumMath.TWO_PI);const d=a.CesiumMath.negativePiToPi(Math.min(u,s)),c=a.CesiumMath.negativePiToPi(Math.max(r,o));return n.west=d,n.south=Math.min(t.south,e.south),n.east=c,n.north=Math.max(t.north,e.north),n},q.expand=function(t,e,n){return i.defined(n)||(n=new q),n.west=Math.min(t.west,e.longitude),n.south=Math.min(t.south,e.latitude),n.east=Math.max(t.east,e.longitude),n.north=Math.max(t.north,e.latitude),n},q.contains=function(t,e){let n=e.longitude;const i=e.latitude,r=t.west;let u=t.east;return u<r&&(u+=a.CesiumMath.TWO_PI,n<0&&(n+=a.CesiumMath.TWO_PI)),(n>r||a.CesiumMath.equalsEpsilon(n,r,a.CesiumMath.EPSILON14))&&(n<u||a.CesiumMath.equalsEpsilon(n,u,a.CesiumMath.EPSILON14))&&i>=t.south&&i<=t.north};const T=new s;function R(t,e){this.x=i.defaultValue(t,0),this.y=i.defaultValue(e,0)}q.subsample=function(t,e,n,r){e=i.defaultValue(e,p.WGS84),n=i.defaultValue(n,0),i.defined(r)||(r=[]);let u=0;const o=t.north,s=t.south,d=t.east,c=t.west,h=T;h.height=n,h.longitude=c,h.latitude=o,r[u]=e.cartographicToCartesian(h,r[u]),u++,h.longitude=d,r[u]=e.cartographicToCartesian(h,r[u]),u++,h.latitude=s,r[u]=e.cartographicToCartesian(h,r[u]),u++,h.longitude=c,r[u]=e.cartographicToCartesian(h,r[u]),u++,h.latitude=o<0?o:s>0?s:0;for(let n=1;n<8;++n)h.longitude=-Math.PI+n*a.CesiumMath.PI_OVER_TWO,q.contains(t,h)&&(r[u]=e.cartographicToCartesian(h,r[u]),u++);return 0===h.latitude&&(h.longitude=c,r[u]=e.cartographicToCartesian(h,r[u]),u++,h.longitude=d,r[u]=e.cartographicToCartesian(h,r[u]),u++),r.length=u,r},q.subsection=function(t,e,n,r,u,o){if(i.defined(o)||(o=new q),t.west<=t.east){const n=t.east-t.west;o.west=t.west+e*n,o.east=t.west+r*n}else{const n=a.CesiumMath.TWO_PI+t.east-t.west;o.west=a.CesiumMath.negativePiToPi(t.west+e*n),o.east=a.CesiumMath.negativePiToPi(t.west+r*n)}const s=t.north-t.south;return o.south=t.south+n*s,o.north=t.south+u*s,1===e&&(o.west=t.east),1===r&&(o.east=t.east),1===n&&(o.south=t.north),1===u&&(o.north=t.north),o},q.MAX_VALUE=Object.freeze(new q(-Math.PI,-a.CesiumMath.PI_OVER_TWO,Math.PI,a.CesiumMath.PI_OVER_TWO)),R.fromElements=function(t,e,n){return i.defined(n)?(n.x=t,n.y=e,n):new R(t,e)},R.clone=function(t,e){if(i.defined(t))return i.defined(e)?(e.x=t.x,e.y=t.y,e):new R(t.x,t.y)},R.fromCartesian3=R.clone,R.fromCartesian4=R.clone,R.packedLength=2,R.pack=function(t,e,n){return n=i.defaultValue(n,0),e[n++]=t.x,e[n]=t.y,e},R.unpack=function(t,e,n){return e=i.defaultValue(e,0),i.defined(n)||(n=new R),n.x=t[e++],n.y=t[e],n},R.packArray=function(t,e){const n=t.length,a=2*n;i.defined(e)?(Array.isArray(e)||e.length===a)&&e.length!==a&&(e.length=a):e=new Array(a);for(let i=0;i<n;++i)R.pack(t[i],e,2*i);return e},R.unpackArray=function(t,e){const n=t.length;i.defined(e)?e.length=n/2:e=new Array(n/2);for(let i=0;i<n;i+=2){const n=i/2;e[n]=R.unpack(t,i,e[n])}return e},R.fromArray=R.unpack,R.maximumComponent=function(t){return Math.max(t.x,t.y)},R.minimumComponent=function(t){return Math.min(t.x,t.y)},R.minimumByComponent=function(t,e,n){return n.x=Math.min(t.x,e.x),n.y=Math.min(t.y,e.y),n},R.maximumByComponent=function(t,e,n){return n.x=Math.max(t.x,e.x),n.y=Math.max(t.y,e.y),n},R.clamp=function(t,e,n,i){const r=a.CesiumMath.clamp(t.x,e.x,n.x),u=a.CesiumMath.clamp(t.y,e.y,n.y);return i.x=r,i.y=u,i},R.magnitudeSquared=function(t){return t.x*t.x+t.y*t.y},R.magnitude=function(t){return Math.sqrt(R.magnitudeSquared(t))};const A=new R;R.distance=function(t,e){return R.subtract(t,e,A),R.magnitude(A)},R.distanceSquared=function(t,e){return R.subtract(t,e,A),R.magnitudeSquared(A)},R.normalize=function(t,e){const n=R.magnitude(t);return e.x=t.x/n,e.y=t.y/n,e},R.dot=function(t,e){return t.x*e.x+t.y*e.y},R.cross=function(t,e){return t.x*e.y-t.y*e.x},R.multiplyComponents=function(t,e,n){return n.x=t.x*e.x,n.y=t.y*e.y,n},R.divideComponents=function(t,e,n){return n.x=t.x/e.x,n.y=t.y/e.y,n},R.add=function(t,e,n){return n.x=t.x+e.x,n.y=t.y+e.y,n},R.subtract=function(t,e,n){return n.x=t.x-e.x,n.y=t.y-e.y,n},R.multiplyByScalar=function(t,e,n){return n.x=t.x*e,n.y=t.y*e,n},R.divideByScalar=function(t,e,n){return n.x=t.x/e,n.y=t.y/e,n},R.negate=function(t,e){return e.x=-t.x,e.y=-t.y,e},R.abs=function(t,e){return e.x=Math.abs(t.x),e.y=Math.abs(t.y),e};const V=new R;R.lerp=function(t,e,n,i){return R.multiplyByScalar(e,n,V),i=R.multiplyByScalar(t,1-n,i),R.add(V,i,i)};const b=new R,P=new R;R.angleBetween=function(t,e){return R.normalize(t,b),R.normalize(e,P),a.CesiumMath.acosClamped(R.dot(b,P))};const E=new R;function I(t,e,n,a){this[0]=i.defaultValue(t,0),this[1]=i.defaultValue(n,0),this[2]=i.defaultValue(e,0),this[3]=i.defaultValue(a,0)}R.mostOrthogonalAxis=function(t,e){const n=R.normalize(t,E);return R.abs(n,n),e=n.x<=n.y?R.clone(R.UNIT_X,e):R.clone(R.UNIT_Y,e)},R.equals=function(t,e){return t===e||i.defined(t)&&i.defined(e)&&t.x===e.x&&t.y===e.y},R.equalsArray=function(t,e,n){return t.x===e[n]&&t.y===e[n+1]},R.equalsEpsilon=function(t,e,n,r){return t===e||i.defined(t)&&i.defined(e)&&a.CesiumMath.equalsEpsilon(t.x,e.x,n,r)&&a.CesiumMath.equalsEpsilon(t.y,e.y,n,r)},R.ZERO=Object.freeze(new R(0,0)),R.ONE=Object.freeze(new R(1,1)),R.UNIT_X=Object.freeze(new R(1,0)),R.UNIT_Y=Object.freeze(new R(0,1)),R.prototype.clone=function(t){return R.clone(this,t)},R.prototype.equals=function(t){return R.equals(this,t)},R.prototype.equalsEpsilon=function(t,e,n){return R.equalsEpsilon(this,t,e,n)},R.prototype.toString=function(){return`(${this.x}, ${this.y})`},I.packedLength=4,I.pack=function(t,e,n){return n=i.defaultValue(n,0),e[n++]=t[0],e[n++]=t[1],e[n++]=t[2],e[n++]=t[3],e},I.unpack=function(t,e,n){return e=i.defaultValue(e,0),i.defined(n)||(n=new I),n[0]=t[e++],n[1]=t[e++],n[2]=t[e++],n[3]=t[e++],n},I.packArray=function(t,e){const n=t.length,a=4*n;i.defined(e)?(Array.isArray(e)||e.length===a)&&e.length!==a&&(e.length=a):e=new Array(a);for(let i=0;i<n;++i)I.pack(t[i],e,4*i);return e},I.unpackArray=function(t,e){const n=t.length;i.defined(e)?e.length=n/4:e=new Array(n/4);for(let i=0;i<n;i+=4){const n=i/4;e[n]=I.unpack(t,i,e[n])}return e},I.clone=function(t,e){if(i.defined(t))return i.defined(e)?(e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e):new I(t[0],t[2],t[1],t[3])},I.fromArray=I.unpack,I.fromColumnMajorArray=function(t,e){return I.clone(t,e)},I.fromRowMajorArray=function(t,e){return i.defined(e)?(e[0]=t[0],e[1]=t[2],e[2]=t[1],e[3]=t[3],e):new I(t[0],t[1],t[2],t[3])},I.fromScale=function(t,e){return i.defined(e)?(e[0]=t.x,e[1]=0,e[2]=0,e[3]=t.y,e):new I(t.x,0,0,t.y)},I.fromUniformScale=function(t,e){return i.defined(e)?(e[0]=t,e[1]=0,e[2]=0,e[3]=t,e):new I(t,0,0,t)},I.fromRotation=function(t,e){const n=Math.cos(t),a=Math.sin(t);return i.defined(e)?(e[0]=n,e[1]=a,e[2]=-a,e[3]=n,e):new I(n,-a,a,n)},I.toArray=function(t,e){return i.defined(e)?(e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e):[t[0],t[1],t[2],t[3]]},I.getElementIndex=function(t,e){return 2*t+e},I.getColumn=function(t,e,n){const i=2*e,a=t[i],r=t[i+1];return n.x=a,n.y=r,n},I.setColumn=function(t,e,n,i){const a=2*e;return(i=I.clone(t,i))[a]=n.x,i[a+1]=n.y,i},I.getRow=function(t,e,n){const i=t[e],a=t[e+2];return n.x=i,n.y=a,n},I.setRow=function(t,e,n,i){return(i=I.clone(t,i))[e]=n.x,i[e+2]=n.y,i};const v=new R;I.setScale=function(t,e,n){const i=I.getScale(t,v),a=e.x/i.x,r=e.y/i.y;return n[0]=t[0]*a,n[1]=t[1]*a,n[2]=t[2]*r,n[3]=t[3]*r,n};const z=new R;I.setUniformScale=function(t,e,n){const i=I.getScale(t,z),a=e/i.x,r=e/i.y;return n[0]=t[0]*a,n[1]=t[1]*a,n[2]=t[2]*r,n[3]=t[3]*r,n};const N=new R;I.getScale=function(t,e){return e.x=R.magnitude(R.fromElements(t[0],t[1],N)),e.y=R.magnitude(R.fromElements(t[2],t[3],N)),e};const W=new R;I.getMaximumScale=function(t){return I.getScale(t,W),R.maximumComponent(W)};const L=new R;I.setRotation=function(t,e,n){const i=I.getScale(t,L);return n[0]=e[0]*i.x,n[1]=e[1]*i.x,n[2]=e[2]*i.y,n[3]=e[3]*i.y,n};const U=new R;I.getRotation=function(t,e){const n=I.getScale(t,U);return e[0]=t[0]/n.x,e[1]=t[1]/n.x,e[2]=t[2]/n.y,e[3]=t[3]/n.y,e},I.multiply=function(t,e,n){const i=t[0]*e[0]+t[2]*e[1],a=t[0]*e[2]+t[2]*e[3],r=t[1]*e[0]+t[3]*e[1],u=t[1]*e[2]+t[3]*e[3];return n[0]=i,n[1]=r,n[2]=a,n[3]=u,n},I.add=function(t,e,n){return n[0]=t[0]+e[0],n[1]=t[1]+e[1],n[2]=t[2]+e[2],n[3]=t[3]+e[3],n},I.subtract=function(t,e,n){return n[0]=t[0]-e[0],n[1]=t[1]-e[1],n[2]=t[2]-e[2],n[3]=t[3]-e[3],n},I.multiplyByVector=function(t,e,n){const i=t[0]*e.x+t[2]*e.y,a=t[1]*e.x+t[3]*e.y;return n.x=i,n.y=a,n},I.multiplyByScalar=function(t,e,n){return n[0]=t[0]*e,n[1]=t[1]*e,n[2]=t[2]*e,n[3]=t[3]*e,n},I.multiplyByScale=function(t,e,n){return n[0]=t[0]*e.x,n[1]=t[1]*e.x,n[2]=t[2]*e.y,n[3]=t[3]*e.y,n},I.multiplyByUniformScale=function(t,e,n){return n[0]=t[0]*e,n[1]=t[1]*e,n[2]=t[2]*e,n[3]=t[3]*e,n},I.negate=function(t,e){return e[0]=-t[0],e[1]=-t[1],e[2]=-t[2],e[3]=-t[3],e},I.transpose=function(t,e){const n=t[0],i=t[2],a=t[1],r=t[3];return e[0]=n,e[1]=i,e[2]=a,e[3]=r,e},I.abs=function(t,e){return e[0]=Math.abs(t[0]),e[1]=Math.abs(t[1]),e[2]=Math.abs(t[2]),e[3]=Math.abs(t[3]),e},I.equals=function(t,e){return t===e||i.defined(t)&&i.defined(e)&&t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]&&t[3]===e[3]},I.equalsArray=function(t,e,n){return t[0]===e[n]&&t[1]===e[n+1]&&t[2]===e[n+2]&&t[3]===e[n+3]},I.equalsEpsilon=function(t,e,n){return n=i.defaultValue(n,0),t===e||i.defined(t)&&i.defined(e)&&Math.abs(t[0]-e[0])<=n&&Math.abs(t[1]-e[1])<=n&&Math.abs(t[2]-e[2])<=n&&Math.abs(t[3]-e[3])<=n},I.IDENTITY=Object.freeze(new I(1,0,0,1)),I.ZERO=Object.freeze(new I(0,0,0,0)),I.COLUMN0ROW0=0,I.COLUMN0ROW1=1,I.COLUMN1ROW0=2,I.COLUMN1ROW1=3,Object.defineProperties(I.prototype,{length:{get:function(){return I.packedLength}}}),I.prototype.clone=function(t){return I.clone(this,t)},I.prototype.equals=function(t){return I.equals(this,t)},I.prototype.equalsEpsilon=function(t,e){return I.equalsEpsilon(this,t,e)},I.prototype.toString=function(){return`(${this[0]}, ${this[2]})\n(${this[1]}, ${this[3]})`},t.Cartesian2=R,t.Cartographic=s,t.Ellipsoid=p,t.Matrix2=I,t.Rectangle=q}));