1
Surpriseplus
2022-09-16 8d1a91c23df335b090e38b2edd15203aa3b03da9
1
define(["exports","./when-cbf8cd21","./Check-35e1a91d","./Math-e66fad2a"],function(e,R,i,V){"use strict";function u(e,t){if(null===e||"object"!=typeof e)return e;t=R.defaultValue(t,!1);var n,a,r=new e.constructor;for(n in e){e.hasOwnProperty(n)&&(a=e[n],t&&(a=u(a,t)),r[n]=a)}return r}(new Date).getTime(),(new Date).getTime();var t={x:6378137,y:6378137,z:6356752.31414};function b(e,t,n){this.x=R.defaultValue(e,0),this.y=R.defaultValue(t,0),this.z=R.defaultValue(n,0)}b.fromSpherical=function(e,t){R.defined(t)||(t=new b);var n=e.clock,a=e.cone,r=R.defaultValue(e.magnitude,1),i=r*Math.sin(a);return t.x=i*Math.cos(n),t.y=i*Math.sin(n),t.z=r*Math.cos(a),t},b.fromElements=function(e,t,n,a){return R.defined(a)?(a.x=e,a.y=t,a.z=n,a):new b(e,t,n)},b.fromCartesian4=b.clone=function(e,t){if(R.defined(e))return R.defined(t)?(t.x=e.x,t.y=e.y,t.z=e.z,t):new b(e.x,e.y,e.z)},b.packedLength=3,b.pack=function(e,t,n){return n=R.defaultValue(n,0),t[n++]=e.x,t[n++]=e.y,t[n]=e.z,t},b.unpack=function(e,t,n){return t=R.defaultValue(t,0),R.defined(n)||(n=new b),n.x=e[t++],n.y=e[t++],n.z=e[t],n},b.packArray=function(e,t){var n=e.length,a=3*n;if(R.defined(t)){if(!Array.isArray(t)&&t.length!==a)throw new i.DeveloperError("If result is a typed array, it must have exactly array.length * 3 elements");t.length!==a&&(t.length=a)}else t=new Array(a);for(var r=0;r<n;++r)b.pack(e[r],t,3*r);return t},b.unpackArray=function(e,t){var n=e.length;R.defined(t)?t.length=n/3:t=new Array(n/3);for(var a=0;a<n;a+=3){var r=a/3;t[r]=b.unpack(e,a,t[r])}return t},b.fromArray=b.unpack,b.maximumComponent=function(e){return Math.max(e.x,e.y,e.z)},b.minimumComponent=function(e){return Math.min(e.x,e.y,e.z)},b.minimumByComponent=function(e,t,n){return n.x=Math.min(e.x,t.x),n.y=Math.min(e.y,t.y),n.z=Math.min(e.z,t.z),n},b.maximumByComponent=function(e,t,n){return n.x=Math.max(e.x,t.x),n.y=Math.max(e.y,t.y),n.z=Math.max(e.z,t.z),n},b.magnitudeSquared=function(e){return e.x*e.x+e.y*e.y+e.z*e.z},b.magnitude=function(e){return Math.sqrt(b.magnitudeSquared(e))};var n=new b;b.distance=function(e,t){return b.subtract(e,t,n),b.magnitude(n)},b.distanceSquared=function(e,t){return b.subtract(e,t,n),b.magnitudeSquared(n)},b.normalize=function(e,t){var n=b.magnitude(e);return t.x=e.x/n,t.y=e.y/n,t.z=e.z/n,t},b.dot=function(e,t){return e.x*t.x+e.y*t.y+e.z*t.z},b.multiplyComponents=function(e,t,n){return n.x=e.x*t.x,n.y=e.y*t.y,n.z=e.z*t.z,n},b.divideComponents=function(e,t,n){return n.x=e.x/t.x,n.y=e.y/t.y,n.z=e.z/t.z,n},b.add=function(e,t,n){return n.x=e.x+t.x,n.y=e.y+t.y,n.z=e.z+t.z,n},b.subtract=function(e,t,n){return n.x=e.x-t.x,n.y=e.y-t.y,n.z=e.z-t.z,n},b.multiplyByScalar=function(e,t,n){return n.x=e.x*t,n.y=e.y*t,n.z=e.z*t,n},b.divideByScalar=function(e,t,n){return n.x=e.x/t,n.y=e.y/t,n.z=e.z/t,n},b.negate=function(e,t){return t.x=-e.x,t.y=-e.y,t.z=-e.z,t},b.abs=function(e,t){return t.x=Math.abs(e.x),t.y=Math.abs(e.y),t.z=Math.abs(e.z),t};var r=new b;b.lerp=function(e,t,n,a){return b.multiplyByScalar(t,n,r),a=b.multiplyByScalar(e,1-n,a),b.add(r,a,a)};var o=new b,d=new b;b.angleBetween=function(e,t){b.normalize(e,o),b.normalize(t,d);var n=b.dot(o,d),a=b.magnitude(b.cross(o,d,o));return Math.atan2(a,n)};var a=new b;b.mostOrthogonalAxis=function(e,t){var n=b.normalize(e,a);return b.abs(n,n),t=n.x<=n.y?n.x<=n.z?b.clone(b.UNIT_X,t):b.clone(b.UNIT_Z,t):n.y<=n.z?b.clone(b.UNIT_Y,t):b.clone(b.UNIT_Z,t)},b.projectVector=function(e,t,n){var a=b.dot(e,t)/b.dot(t,t);return b.multiplyByScalar(t,a,n)},b.equals=function(e,t){return e===t||R.defined(e)&&R.defined(t)&&e.x===t.x&&e.y===t.y&&e.z===t.z},b.equalsArray=function(e,t,n){return e.x===t[n]&&e.y===t[n+1]&&e.z===t[n+2]},b.equalsEpsilon=function(e,t,n,a){return e===t||R.defined(e)&&R.defined(t)&&V.CesiumMath.equalsEpsilon(e.x,t.x,n,a)&&V.CesiumMath.equalsEpsilon(e.y,t.y,n,a)&&V.CesiumMath.equalsEpsilon(e.z,t.z,n,a)},b.cross=function(e,t,n){var a=e.x,r=e.y,i=e.z,u=t.x,o=t.y,d=t.z,s=r*d-i*o,h=i*u-a*d,l=a*o-r*u;return n.x=s,n.y=h,n.z=l,n},b.midpoint=function(e,t,n){return n.x=.5*(e.x+t.x),n.y=.5*(e.y+t.y),n.z=.5*(e.z+t.z),n},b.fromDegrees=function(e,t,n,a,r){return e=V.CesiumMath.toRadians(e),t=V.CesiumMath.toRadians(t),b.fromRadians(e,t,n,a,r)};var s=new b,h=new b,l=new b(t.x*t.x,t.y*t.y,t.z*t.z);b.fromRadians=function(e,t,n,a,r){n=R.defaultValue(n,0);var i=R.defined(a)?a.radiiSquared:l,u=Math.cos(t);s.x=u*Math.cos(e),s.y=u*Math.sin(e),s.z=Math.sin(t),s=b.normalize(s,s),b.multiplyComponents(i,s,h);var o=Math.sqrt(b.dot(s,h));return h=b.divideByScalar(h,o,h),s=b.multiplyByScalar(s,n,s),R.defined(r)||(r=new b),b.add(h,s,r)},b.fromDegreesArray=function(e,t,n){var a=e.length;R.defined(n)?n.length=a/2:n=new Array(a/2);for(var r=0;r<a;r+=2){var i=e[r],u=e[r+1],o=r/2;n[o]=b.fromDegrees(i,u,0,t,n[o])}return n},b.fromRadiansArray=function(e,t,n){var a=e.length;R.defined(n)?n.length=a/2:n=new Array(a/2);for(var r=0;r<a;r+=2){var i=e[r],u=e[r+1],o=r/2;n[o]=b.fromRadians(i,u,0,t,n[o])}return n},b.fromDegreesArrayHeights=function(e,t,n){var a=e.length;R.defined(n)?n.length=a/3:n=new Array(a/3);for(var r=0;r<a;r+=3){var i=e[r],u=e[r+1],o=e[r+2],d=r/3;n[d]=b.fromDegrees(i,u,o,t,n[d])}return n},b.fromRadiansArrayHeights=function(e,t,n){var a=e.length;R.defined(n)?n.length=a/3:n=new Array(a/3);for(var r=0;r<a;r+=3){var i=e[r],u=e[r+1],o=e[r+2],d=r/3;n[d]=b.fromRadians(i,u,o,t,n[d])}return n},b.ZERO=Object.freeze(new b(0,0,0)),b.UNIT_X=Object.freeze(new b(1,0,0)),b.UNIT_Y=Object.freeze(new b(0,1,0)),b.UNIT_Z=Object.freeze(new b(0,0,1)),b.prototype.clone=function(e){return b.clone(this,e)},b.prototype.equals=function(e){return b.equals(this,e)},b.prototype.equalsEpsilon=function(e,t,n){return b.equalsEpsilon(this,e,t,n)},b.prototype.toString=function(){return"("+this.x+", "+this.y+", "+this.z+")"};var I=new b,E=new b;function f(e,t,n,a,r){var i=e.x,u=e.y,o=e.z,d=t.x,s=t.y,h=t.z,l=i*i*d*d,f=u*u*s*s,c=o*o*h*h,m=l+f+c,y=Math.sqrt(1/m),p=b.multiplyByScalar(e,y,I);if(m<a)return isFinite(y)?b.clone(p,r):void 0;var g=n.x,x=n.y,M=n.z,w=E;w.x=p.x*g*2,w.y=p.y*x*2,w.z=p.z*M*2;var v,_,z,C,S,q,O,T=(1-y)*b.magnitude(e)/(.5*b.magnitude(w)),A=0;do{A=(v=l*(S=(_=1/(1+(T-=A)*g))*_)+f*(q=(z=1/(1+T*x))*z)+c*(O=(C=1/(1+T*M))*C)-1)/(-2*(l*(S*_)*g+f*(q*z)*x+c*(O*C)*M))}while(Math.abs(v)>V.CesiumMath.EPSILON12);return R.defined(r)?(r.x=i*_,r.y=u*z,r.z=o*C,r):new b(i*_,u*z,o*C)}function c(e,t,n){this.longitude=R.defaultValue(e,0),this.latitude=R.defaultValue(t,0),this.height=R.defaultValue(n,0)}c.fromRadians=function(e,t,n,a){return n=R.defaultValue(n,0),R.defined(a)?(a.longitude=e,a.latitude=t,a.height=n,a):new c(e,t,n)},c.fromDegrees=function(e,t,n,a){return e=V.CesiumMath.toRadians(e),t=V.CesiumMath.toRadians(t),c.fromRadians(e,t,n,a)};var m=new b,y=new b,p=new b,g=new b(1/t.x,1/t.y,1/t.z),x=new b(1/(t.x*t.x),1/(t.y*t.y),1/(t.z*t.z)),M=V.CesiumMath.EPSILON1;function w(e,t,n,a){t=R.defaultValue(t,0),n=R.defaultValue(n,0),a=R.defaultValue(a,0),e._radii=new b(t,n,a),e._radiiSquared=new b(t*t,n*n,a*a),e._radiiToTheFourth=new b(t*t*t*t,n*n*n*n,a*a*a*a),e._oneOverRadii=new b(0===t?0:1/t,0===n?0:1/n,0===a?0:1/a),e._oneOverRadiiSquared=new b(0===t?0:1/(t*t),0===n?0:1/(n*n),0===a?0:1/(a*a)),e._minimumRadius=Math.min(t,n,a),e._maximumRadius=Math.max(t,n,a),e._centerToleranceSquared=V.CesiumMath.EPSILON1,0!==e._radiiSquared.z&&(e._squaredXOverSquaredZ=e._radiiSquared.x/e._radiiSquared.z)}function v(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,w(this,e,t,n)}c.fromCartesian=function(e,t,n){var a=R.defined(t)?t.oneOverRadii:g,r=R.defined(t)?t.oneOverRadiiSquared:x,i=f(e,a,r,R.defined(t)?t._centerToleranceSquared:M,y);if(R.defined(i)){var u=b.multiplyComponents(i,r,m),u=b.normalize(u,u),o=b.subtract(e,i,p),d=Math.atan2(u.y,u.x),s=Math.asin(u.z),h=V.CesiumMath.sign(b.dot(o,e))*b.magnitude(o);return R.defined(n)?(n.longitude=d,n.latitude=s,n.height=h,n):new c(d,s,h)}},c.toCartesian=function(e,t,n){return b.fromRadians(e.longitude,e.latitude,e.height,t,n)},c.clone=function(e,t){if(R.defined(e))return R.defined(t)?(t.longitude=e.longitude,t.latitude=e.latitude,t.height=e.height,t):new c(e.longitude,e.latitude,e.height)},c.equals=function(e,t){return e===t||R.defined(e)&&R.defined(t)&&e.longitude===t.longitude&&e.latitude===t.latitude&&e.height===t.height},c.equalsEpsilon=function(e,t,n){return n=R.defaultValue(n,0),e===t||R.defined(e)&&R.defined(t)&&Math.abs(e.longitude-t.longitude)<=n&&Math.abs(e.latitude-t.latitude)<=n&&Math.abs(e.height-t.height)<=n},c.ZERO=Object.freeze(new c(0,0,0)),c.prototype.clone=function(e){return c.clone(this,e)},c.prototype.equals=function(e){return c.equals(this,e)},c.prototype.equalsEpsilon=function(e,t){return c.equalsEpsilon(this,e,t)},c.prototype.toString=function(){return"("+this.longitude+", "+this.latitude+", "+this.height+")"},Object.defineProperties(v.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}}}),v.clone=function(e,t){if(R.defined(e)){var n=e._radii;return R.defined(t)?(b.clone(n,t._radii),b.clone(e._radiiSquared,t._radiiSquared),b.clone(e._radiiToTheFourth,t._radiiToTheFourth),b.clone(e._oneOverRadii,t._oneOverRadii),b.clone(e._oneOverRadiiSquared,t._oneOverRadiiSquared),t._minimumRadius=e._minimumRadius,t._maximumRadius=e._maximumRadius,t._centerToleranceSquared=e._centerToleranceSquared,t):new v(n.x,n.y,n.z)}},v.fromCartesian3=function(e,t){return R.defined(t)||(t=new v),R.defined(e)&&w(t,e.x,e.y,e.z),t},v.WGS84=Object.freeze(new v(t.x,t.y,t.z)),v.UNIT_SPHERE=Object.freeze(new v(1,1,1)),v.MOON=Object.freeze(new v(V.CesiumMath.LUNAR_RADIUS,V.CesiumMath.LUNAR_RADIUS,V.CesiumMath.LUNAR_RADIUS)),v.prototype.clone=function(e){return v.clone(this,e)},v.packedLength=b.packedLength,v.pack=function(e,t,n){return n=R.defaultValue(n,0),b.pack(e._radii,t,n),t},v.unpack=function(e,t,n){t=R.defaultValue(t,0);var a=b.unpack(e,t);return v.fromCartesian3(a,n)},v.prototype.geocentricSurfaceNormal=b.normalize,v.prototype.geodeticSurfaceNormalCartographic=function(e,t){var n=e.longitude,a=e.latitude,r=Math.cos(a),i=r*Math.cos(n),u=r*Math.sin(n),o=Math.sin(a);return R.defined(t)||(t=new b),t.x=i,t.y=u,t.z=o,b.normalize(t,t)},v.prototype.geodeticSurfaceNormal=function(e,t){if(!b.equalsEpsilon(e,b.ZERO,V.CesiumMath.EPSILON14))return R.defined(t)||(t=new b),t=b.multiplyComponents(e,this._oneOverRadiiSquared,t),b.normalize(t,t)};var _=new b,z=new b;v.prototype.cartographicToCartesian=function(e,t){var n=_,a=z;this.geodeticSurfaceNormalCartographic(e,n),b.multiplyComponents(this._radiiSquared,n,a);var r=Math.sqrt(b.dot(n,a));return b.divideByScalar(a,r,a),b.multiplyByScalar(n,e.height,n),R.defined(t)||(t=new b),b.add(a,n,t)},v.prototype.cartographicArrayToCartesianArray=function(e,t){var n=e.length;R.defined(t)?t.length=n:t=new Array(n);for(var a=0;a<n;a++)t[a]=this.cartographicToCartesian(e[a],t[a]);return t};var C=new b,S=new b,q=new b;v.prototype.cartesianToCartographic=function(e,t){var n=this.scaleToGeodeticSurface(e,S);if(R.defined(n)){var a=this.geodeticSurfaceNormal(n,C),r=b.subtract(e,n,q),i=Math.atan2(a.y,a.x),u=Math.asin(a.z),o=V.CesiumMath.sign(b.dot(r,e))*b.magnitude(r);return R.defined(t)?(t.longitude=i,t.latitude=u,t.height=o,t):new c(i,u,o)}},v.prototype.cartesianArrayToCartographicArray=function(e,t){var n=e.length;R.defined(t)?t.length=n:t=new Array(n);for(var a=0;a<n;++a)t[a]=this.cartesianToCartographic(e[a],t[a]);return t},v.prototype.scaleToGeodeticSurface=function(e,t){return f(e,this._oneOverRadii,this._oneOverRadiiSquared,this._centerToleranceSquared,t)},v.prototype.scaleToGeocentricSurface=function(e,t){R.defined(t)||(t=new b);var n=e.x,a=e.y,r=e.z,i=this._oneOverRadiiSquared,u=1/Math.sqrt(n*n*i.x+a*a*i.y+r*r*i.z);return b.multiplyByScalar(e,u,t)},v.prototype.transformPositionToScaledSpace=function(e,t){return R.defined(t)||(t=new b),b.multiplyComponents(e,this._oneOverRadii,t)},v.prototype.transformPositionFromScaledSpace=function(e,t){return R.defined(t)||(t=new b),b.multiplyComponents(e,this._radii,t)},v.prototype.equals=function(e){return this===e||R.defined(e)&&b.equals(this._radii,e._radii)},v.prototype.toString=function(){return this._radii.toString()},v.prototype.getSurfaceNormalIntersectionWithZAxis=function(e,t,n){t=R.defaultValue(t,0);var a=this._squaredXOverSquaredZ;if(R.defined(n)||(n=new b),n.x=0,n.y=0,n.z=e.z*(1-a),!(Math.abs(n.z)>=this._radii.z-t))return n};var O=[.14887433898163,.43339539412925,.67940956829902,.86506336668898,.97390652851717,0],T=[.29552422471475,.26926671930999,.21908636251598,.14945134915058,.066671344308684,0];function A(e,t,n){for(var a=.5*(t+e),r=.5*(t-e),i=0,u=0;u<5;u++){var o=r*O[u];i+=T[u]*(n(a+o)+n(a-o))}return i*=r}function P(e,t,n,a){this.west=R.defaultValue(e,0),this.south=R.defaultValue(t,0),this.east=R.defaultValue(n,0),this.north=R.defaultValue(a,0)}v.prototype.surfaceArea=function(e){for(var t=e.west,n=e.east,a=e.south,r=e.north;n<t;)n+=V.CesiumMath.TWO_PI;var i=this._radiiSquared,u=i.x,o=i.y,d=i.z,s=u*o;return A(a,r,function(e){var a=Math.cos(e),r=Math.sin(e);return Math.cos(e)*A(t,n,function(e){var t=Math.cos(e),n=Math.sin(e);return Math.sqrt(s*r*r+d*(o*t*t+u*n*n)*a*a)})})},Object.defineProperties(P.prototype,{width:{get:function(){return P.computeWidth(this)}},height:{get:function(){return P.computeHeight(this)}}}),P.packedLength=4,P.pack=function(e,t,n){return n=R.defaultValue(n,0),t[n++]=e.west,t[n++]=e.south,t[n++]=e.east,t[n]=e.north,t},P.unpack=function(e,t,n){return t=R.defaultValue(t,0),R.defined(n)||(n=new P),n.west=e[t++],n.south=e[t++],n.east=e[t++],n.north=e[t],n},P.computeWidth=function(e){var t=e.east,n=e.west;return t<n&&(t+=V.CesiumMath.TWO_PI),t-n},P.computeHeight=function(e){return e.north-e.south},P.fromDegrees=function(e,t,n,a,r){return e=V.CesiumMath.toRadians(R.defaultValue(e,0)),t=V.CesiumMath.toRadians(R.defaultValue(t,0)),n=V.CesiumMath.toRadians(R.defaultValue(n,0)),a=V.CesiumMath.toRadians(R.defaultValue(a,0)),R.defined(r)?(r.west=e,r.south=t,r.east=n,r.north=a,r):new P(e,t,n,a)},P.fromRadians=function(e,t,n,a,r){return R.defined(r)?(r.west=R.defaultValue(e,0),r.south=R.defaultValue(t,0),r.east=R.defaultValue(n,0),r.north=R.defaultValue(a,0),r):new P(e,t,n,a)},P.fromCartographicArray=function(e,t){for(var n=Number.MAX_VALUE,a=-Number.MAX_VALUE,r=Number.MAX_VALUE,i=-Number.MAX_VALUE,u=Number.MAX_VALUE,o=-Number.MAX_VALUE,d=0,s=e.length;d<s;d++)var h=e[d],n=Math.min(n,h.longitude),a=Math.max(a,h.longitude),u=Math.min(u,h.latitude),o=Math.max(o,h.latitude),l=0<=h.longitude?h.longitude:h.longitude+V.CesiumMath.TWO_PI,r=Math.min(r,l),i=Math.max(i,l);return i-r<a-n&&(n=r,(a=i)>V.CesiumMath.PI&&(a-=V.CesiumMath.TWO_PI),n>V.CesiumMath.PI&&(n-=V.CesiumMath.TWO_PI)),R.defined(t)?(t.west=n,t.south=u,t.east=a,t.north=o,t):new P(n,u,a,o)},P.fromCartesianArray=function(e,t,n){t=R.defaultValue(t,v.WGS84);for(var a=Number.MAX_VALUE,r=-Number.MAX_VALUE,i=Number.MAX_VALUE,u=-Number.MAX_VALUE,o=Number.MAX_VALUE,d=-Number.MAX_VALUE,s=0,h=e.length;s<h;s++)var l=t.cartesianToCartographic(e[s]),a=Math.min(a,l.longitude),r=Math.max(r,l.longitude),o=Math.min(o,l.latitude),d=Math.max(d,l.latitude),f=0<=l.longitude?l.longitude:l.longitude+V.CesiumMath.TWO_PI,i=Math.min(i,f),u=Math.max(u,f);return u-i<r-a&&(a=i,(r=u)>V.CesiumMath.PI&&(r-=V.CesiumMath.TWO_PI),a>V.CesiumMath.PI&&(a-=V.CesiumMath.TWO_PI)),R.defined(n)?(n.west=a,n.south=o,n.east=r,n.north=d,n):new P(a,o,r,d)},P.clone=function(e,t){if(R.defined(e))return R.defined(t)?(t.west=e.west,t.south=e.south,t.east=e.east,t.north=e.north,t):new P(e.west,e.south,e.east,e.north)},P.equalsEpsilon=function(e,t,n){return n=R.defaultValue(n,0),e===t||R.defined(e)&&R.defined(t)&&Math.abs(e.west-t.west)<=n&&Math.abs(e.south-t.south)<=n&&Math.abs(e.east-t.east)<=n&&Math.abs(e.north-t.north)<=n},P.prototype.clone=function(e){return P.clone(this,e)},P.prototype.equals=function(e){return P.equals(this,e)},P.equals=function(e,t){return e===t||R.defined(e)&&R.defined(t)&&e.west===t.west&&e.south===t.south&&e.east===t.east&&e.north===t.north},P.prototype.equalsEpsilon=function(e,t){return P.equalsEpsilon(this,e,t)},P.validate=function(e){},P.southwest=function(e,t){return R.defined(t)?(t.longitude=e.west,t.latitude=e.south,t.height=0,t):new c(e.west,e.south)},P.northwest=function(e,t){return R.defined(t)?(t.longitude=e.west,t.latitude=e.north,t.height=0,t):new c(e.west,e.north)},P.northeast=function(e,t){return R.defined(t)?(t.longitude=e.east,t.latitude=e.north,t.height=0,t):new c(e.east,e.north)},P.southeast=function(e,t){return R.defined(t)?(t.longitude=e.east,t.latitude=e.south,t.height=0,t):new c(e.east,e.south)},P.center=function(e,t){var n=e.east,a=e.west;n<a&&(n+=V.CesiumMath.TWO_PI);var r=V.CesiumMath.negativePiToPi(.5*(a+n)),i=.5*(e.south+e.north);return R.defined(t)?(t.longitude=r,t.latitude=i,t.height=0,t):new c(r,i)},P.intersection=function(e,t,n){var a=e.east,r=e.west,i=t.east,u=t.west;a<r&&0<i?a+=V.CesiumMath.TWO_PI:i<u&&0<a&&(i+=V.CesiumMath.TWO_PI),a<r&&u<0?u+=V.CesiumMath.TWO_PI:i<u&&r<0&&(r+=V.CesiumMath.TWO_PI);var o=V.CesiumMath.negativePiToPi(Math.max(r,u)),d=V.CesiumMath.negativePiToPi(Math.min(a,i));if(!((e.west<e.east||t.west<t.east)&&d<=o)){var s=Math.max(e.south,t.south),h=Math.min(e.north,t.north);if(!(h<=s))return R.defined(n)?(n.west=o,n.south=s,n.east=d,n.north=h,n):new P(o,s,d,h)}},P.simpleIntersection=function(e,t,n){var a=Math.max(e.west,t.west),r=Math.max(e.south,t.south),i=Math.min(e.east,t.east),u=Math.min(e.north,t.north);if(!(u<=r||i<=a))return R.defined(n)?(n.west=a,n.south=r,n.east=i,n.north=u,n):new P(a,r,i,u)},P.union=function(e,t,n){R.defined(n)||(n=new P);var a=e.east,r=e.west,i=t.east,u=t.west;a<r&&0<i?a+=V.CesiumMath.TWO_PI:i<u&&0<a&&(i+=V.CesiumMath.TWO_PI),a<r&&u<0?u+=V.CesiumMath.TWO_PI:i<u&&r<0&&(r+=V.CesiumMath.TWO_PI);var o=V.CesiumMath.convertLongitudeRange(Math.min(r,u)),d=V.CesiumMath.convertLongitudeRange(Math.max(a,i));return n.west=o,n.south=Math.min(e.south,t.south),n.east=d,n.north=Math.max(e.north,t.north),n},P.expand=function(e,t,n){return R.defined(n)||(n=new P),n.west=Math.min(e.west,t.longitude),n.south=Math.min(e.south,t.latitude),n.east=Math.max(e.east,t.longitude),n.north=Math.max(e.north,t.latitude),n},P.contains=function(e,t){var n=t.longitude,a=t.latitude,r=e.west,i=e.east;return i<r&&(i+=V.CesiumMath.TWO_PI,n<0&&(n+=V.CesiumMath.TWO_PI)),(r<n||V.CesiumMath.equalsEpsilon(n,r,V.CesiumMath.EPSILON14))&&(n<i||V.CesiumMath.equalsEpsilon(n,i,V.CesiumMath.EPSILON14))&&a>=e.south&&a<=e.north};var N=new c;function U(e,t){this.x=R.defaultValue(e,0),this.y=R.defaultValue(t,0)}P.subsample=function(e,t,n,a){t=R.defaultValue(t,v.WGS84),n=R.defaultValue(n,0),R.defined(a)||(a=[]);var r=0,i=e.north,u=e.south,o=e.east,d=e.west,s=N;s.height=n,s.longitude=d,s.latitude=i,a[r]=t.cartographicToCartesian(s,a[r]),r++,s.longitude=o,a[r]=t.cartographicToCartesian(s,a[r]),r++,s.latitude=u,a[r]=t.cartographicToCartesian(s,a[r]),r++,s.longitude=d,a[r]=t.cartographicToCartesian(s,a[r]),r++,s.latitude=i<0?i:0<u?u:0;for(var h=1;h<8;++h)s.longitude=-Math.PI+h*V.CesiumMath.PI_OVER_TWO,P.contains(e,s)&&(a[r]=t.cartographicToCartesian(s,a[r]),r++);return 0===s.latitude&&(s.longitude=d,a[r]=t.cartographicToCartesian(s,a[r]),r++,s.longitude=o,a[r]=t.cartographicToCartesian(s,a[r]),r++),a.length=r,a},P.MAX_VALUE=Object.freeze(new P(-Math.PI,-V.CesiumMath.PI_OVER_TWO,Math.PI,V.CesiumMath.PI_OVER_TWO)),U.fromElements=function(e,t,n){return R.defined(n)?(n.x=e,n.y=t,n):new U(e,t)},U.fromCartesian3=U.clone=function(e,t){if(R.defined(e))return R.defined(t)?(t.x=e.x,t.y=e.y,t):new U(e.x,e.y)},U.fromCartesian4=U.clone,U.packedLength=2,U.pack=function(e,t,n){return n=R.defaultValue(n,0),t[n++]=e.x,t[n]=e.y,t},U.unpack=function(e,t,n){return t=R.defaultValue(t,0),R.defined(n)||(n=new U),n.x=e[t++],n.y=e[t],n},U.packArray=function(e,t){var n=e.length,a=2*n;if(R.defined(t)){if(!Array.isArray(t)&&t.length!==a)throw new i.DeveloperError("If result is a typed array, it must have exactly array.length * 2 elements");t.length!==a&&(t.length=a)}else t=new Array(a);for(var r=0;r<n;++r)U.pack(e[r],t,2*r);return t},U.unpackArray=function(e,t){var n=e.length;R.defined(t)?t.length=n/2:t=new Array(n/2);for(var a=0;a<n;a+=2){var r=a/2;t[r]=U.unpack(e,a,t[r])}return t},U.fromArray=U.unpack,U.maximumComponent=function(e){return Math.max(e.x,e.y)},U.minimumComponent=function(e){return Math.min(e.x,e.y)},U.minimumByComponent=function(e,t,n){return n.x=Math.min(e.x,t.x),n.y=Math.min(e.y,t.y),n},U.maximumByComponent=function(e,t,n){return n.x=Math.max(e.x,t.x),n.y=Math.max(e.y,t.y),n},U.magnitudeSquared=function(e){return e.x*e.x+e.y*e.y},U.magnitude=function(e){return Math.sqrt(U.magnitudeSquared(e))};var L=new U;U.distance=function(e,t){return U.subtract(e,t,L),U.magnitude(L)},U.distanceSquared=function(e,t){return U.subtract(e,t,L),U.magnitudeSquared(L)},U.normalize=function(e,t){var n=U.magnitude(e);return t.x=e.x/n,t.y=e.y/n,t},U.dot=function(e,t){return e.x*t.x+e.y*t.y},U.multiplyComponents=function(e,t,n){return n.x=e.x*t.x,n.y=e.y*t.y,n},U.divideComponents=function(e,t,n){return n.x=e.x/t.x,n.y=e.y/t.y,n},U.add=function(e,t,n){return n.x=e.x+t.x,n.y=e.y+t.y,n},U.subtract=function(e,t,n){return n.x=e.x-t.x,n.y=e.y-t.y,n},U.multiplyByScalar=function(e,t,n){return n.x=e.x*t,n.y=e.y*t,n},U.divideByScalar=function(e,t,n){return n.x=e.x/t,n.y=e.y/t,n},U.negate=function(e,t){return t.x=-e.x,t.y=-e.y,t},U.abs=function(e,t){return t.x=Math.abs(e.x),t.y=Math.abs(e.y),t};var W=new U;U.lerp=function(e,t,n,a){return U.multiplyByScalar(t,n,W),a=U.multiplyByScalar(e,1-n,a),U.add(W,a,a)};var k=new U,B=new U;U.angleBetween=function(e,t){return U.normalize(e,k),U.normalize(t,B),V.CesiumMath.acosClamped(U.dot(k,B))};var X=new U;U.mostOrthogonalAxis=function(e,t){var n=U.normalize(e,X);return U.abs(n,n),t=n.x<=n.y?U.clone(U.UNIT_X,t):U.clone(U.UNIT_Y,t)},U.equals=function(e,t){return e===t||R.defined(e)&&R.defined(t)&&e.x===t.x&&e.y===t.y},U.equalsArray=function(e,t,n){return e.x===t[n]&&e.y===t[n+1]},U.equalsEpsilon=function(e,t,n,a){return e===t||R.defined(e)&&R.defined(t)&&V.CesiumMath.equalsEpsilon(e.x,t.x,n,a)&&V.CesiumMath.equalsEpsilon(e.y,t.y,n,a)},U.ZERO=Object.freeze(new U(0,0)),U.UNIT_X=Object.freeze(new U(1,0)),U.UNIT_Y=Object.freeze(new U(0,1)),U.prototype.clone=function(e){return U.clone(this,e)},U.prototype.equals=function(e){return U.equals(this,e)},U.prototype.equalsEpsilon=function(e,t,n){return U.equalsEpsilon(this,e,t,n)},U.prototype.toString=function(){return"("+this.x+", "+this.y+")"},e.Cartesian2=U,e.Cartesian3=b,e.Cartographic=c,e.Ellipsoid=v,e.Rectangle=P,e.clone=u});