define(["exports","./when-cbf8cd21","./Check-35e1a91d","./Math-6a1814d8"],function(e,R,i,V){"use strict";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;rV.CesiumMath.EPSILON12);return R.defined(r)?(r.x=i*_,r.y=u*C,r.z=o*z,r):new b(i*_,u*C,o*z)}function f(e,t,n){this.longitude=R.defaultValue(e,0),this.latitude=R.defaultValue(t,0),this.height=R.defaultValue(n,0)}f.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 f(e,t,n)},f.fromDegrees=function(e,t,n,a){return e=V.CesiumMath.toRadians(e),t=V.CesiumMath.toRadians(t),f.fromRadians(e,t,n,a)};var c=new b,m=new b,y=new b,p=new b(1/6378137,1/6378137,1/6356752.314245179),g=new b(1/40680631590769,1/40680631590769,1/40408299984661.445),M=V.CesiumMath.EPSILON1;function x(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,x(this,e,t,n)}f.fromCartesian=function(e,t,n){var a=R.defined(t)?t.oneOverRadii:p,r=R.defined(t)?t.oneOverRadiiSquared:g,i=l(e,a,r,R.defined(t)?t._centerToleranceSquared:M,m);if(R.defined(i)){var u=b.multiplyComponents(i,r,c);u=b.normalize(u,u);var o=b.subtract(e,i,y),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 f(d,s,h)}},f.toCartesian=function(e,t,n){return b.fromRadians(e.longitude,e.latitude,e.height,t,n)},f.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 f(e.longitude,e.latitude,e.height)},f.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},f.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},f.ZERO=Object.freeze(new f(0,0,0)),f.prototype.clone=function(e){return f.clone(this,e)},f.prototype.equals=function(e){return f.equals(this,e)},f.prototype.equalsEpsilon=function(e,t){return f.equalsEpsilon(this,e,t)},f.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)&&x(t,e.x,e.y,e.z),t},v.WGS84=Object.freeze(new v(6378137,6378137,6356752.314245179)),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 w=new b,_=new b;v.prototype.cartographicToCartesian=function(e,t){var n=w,a=_;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=this._radii.z-t))return n};var q=[.14887433898163,.43339539412925,.67940956829902,.86506336668898,.97390652851717,0],O=[.29552422471475,.26926671930999,.21908636251598,.14945134915058,.066671344308684,0];function T(e,t,n){for(var a=.5*(t+e),r=.5*(t-e),i=0,u=0;u<5;u++){var o=r*q[u];i+=O[u]*(n(a+o)+n(a-o))}return i*=r}function A(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;nV.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 A(n,u,a,o)},A.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;sV.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 A(a,o,r,d)},A.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 A(e.west,e.south,e.east,e.north)},A.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},A.prototype.clone=function(e){return A.clone(this,e)},A.prototype.equals=function(e){return A.equals(this,e)},A.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},A.prototype.equalsEpsilon=function(e,t){return A.equalsEpsilon(this,e,t)},A.validate=function(e){},A.southwest=function(e,t){return R.defined(t)?(t.longitude=e.west,t.latitude=e.south,t.height=0,t):new f(e.west,e.south)},A.northwest=function(e,t){return R.defined(t)?(t.longitude=e.west,t.latitude=e.north,t.height=0,t):new f(e.west,e.north)},A.northeast=function(e,t){return R.defined(t)?(t.longitude=e.east,t.latitude=e.north,t.height=0,t):new f(e.east,e.north)},A.southeast=function(e,t){return R.defined(t)?(t.longitude=e.east,t.latitude=e.south,t.height=0,t):new f(e.east,e.south)},A.center=function(e,t){var n=e.east,a=e.west;n=e.south&&a<=e.north};var P=new f;function N(e,t){this.x=R.defaultValue(e,0),this.y=R.defaultValue(t,0)}A.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=P;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