* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* Columbus View (Pat. Pend.)
*
* Portions licensed separately.
* See https://github.com/CesiumGS/cesium/blob/master/LICENSE.md for full licensing details.
*/
define(["exports","./when-60b00257","./Check-4274a1fd","./Math-9d37f659"],function(e,R,i,V){"use strict";functionb(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=newb);varn=e.clock,a=e.cone,r=R.defaultValue(e.magnitude,1),i=r*Math.sin(a);returnt.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){returnR.defined(a)?(a.x=e,a.y=t,a.z=n,a):newb(e,t,n)},b.fromCartesian4=b.clone=function(e,t){if(R.defined(e))returnR.defined(t)?(t.x=e.x,t.y=e.y,t.z=e.z,t):newb(e.x,e.y,e.z)},b.packedLength=3,b.pack=function(e,t,n){returnn=R.defaultValue(n,0),t[n++]=e.x,t[n++]=e.y,t[n]=e.z,t},b.unpack=function(e,t,n){returnt=R.defaultValue(t,0),R.defined(n)||(n=newb),n.x=e[t++],n.y=e[t++],n.z=e[t],n},b.packArray=function(e,t){varn=e.length,a=3*n;if(R.defined(t)){if(!Array.isArray(t)&&t.length!==a)thrownewi.DeveloperError("If result is a typed array, it must have exactly array.length * 3 elements");t.length!==a&&(t.length=a)}elset=newArray(a);for(varr=0;r<n;++r)b.pack(e[r],t,3*r);returnt},b.unpackArray=function(e,t){varn=e.length;R.defined(t)?t.length=n/3:t=newArray(n/3);for(vara=0;a<n;a+=3){varr=a/3;t[r]=b.unpack(e,a,t[r])}returnt},b.fromArray=b.unpack,b.maximumComponent=function(e){returnMath.max(e.x,e.y,e.z)},b.minimumComponent=function(e){returnMath.min(e.x,e.y,e.z)},b.minimumByComponent=function(e,t,n){returnn.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){returnn.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){returne.x*e.x+e.y*e.y+e.z*e.z},b.magnitude=function(e){returnMath.sqrt(b.magnitudeSquared(e))};varn=newb;b.distance=function(e,t){returnb.subtract(e,t,n),b.magnitude(n)},b.distanceSquared=function(e,t){returnb.subtract(e,t,n),b.magnitudeSquared(n)},b.normalize=function(e,t){varn=b.magnitude(e);returnt.x=e.x/n,t.y=e.y/n,t.z=e.z/n,t},b.dot=function(e,t){returne.x*t.x+e.y*t.y+e.z*t.z},b.multiplyComponents=function(e,t,n){returnn.x=e.x*t.x,n.y=e.y*t.y,n.z=e.z*t.z,n},b.divideComponents=function(e,t,n){returnn.x=e.x/t.x,n.y=e.y/t.y,n.z=e.z/t.z,n},b.add=function(e,t,n){returnn.x=e.x+t.x,n.y=e.y+t.y,n.z=e.z+t.z,n},b.subtract=function(e,t,n){returnn.x=e.x-t.x,n.y=e.y-t.y,n.z=e.z-t.z,n},b.multiplyByScalar=function(e,t,n){returnn.x=e.x*t,n.y=e.y*t,n.z=e.z*t,n},b.divideByScalar=function(e,t,n){returnn.x=e.x/t,n.y=e.y/t,n.z=e.z/t,n},b.negate=function(e,t){returnt.x=-e.x,t.y=-e.y,t.z=-e.z,t},b.abs=function(e,t){returnt.x=Math.abs(e.x),t.y=Math.abs(e.y),t.z=Math.abs(e.z),t};varr=newb;b.lerp=function(e,t,n,a){returnb.multiplyByScalar(t,n,r),a=b.multiplyByScalar(e,1-n,a),b.add(r,a,a)};varu=newb,o=newb;b.angleBetween=function(e,t){b.normalize(e,u),b.normalize(t,o);varn=b.dot(u,o),a=b.magnitude(b.cross(u,o,u));returnMath.atan2(a,n)};vara=newb;b.mostOrthogonalAxis=function(e,t){varn=b.normalize(e,a);returnb.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){vara=b.dot(e,t)/b.dot(t,t);returnb.multiplyByScalar(t,a,n)},b.equals=function(e,t){returne===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){returne.x===t[n]&&e.y===t[n+1]&&e.z===t[n+2]},b.equalsEpsilon=function(e,t,n,a){returne===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){vara=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;returnn.x=s,n.y=h,n.z=l,n},b.midpoint=function(e,t,n){returnn.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){returne=V.CesiumMath.toRadians(e),t=V.CesiumMath.toRadians(t),b.fromRadians(e,t,n,a,r)};vard=newb,s=newb,h=newb(40680631590769,40680631590769,40408299984661.445);b.fromRadians=function(e,t,n,a,r){n=R.defaultValue(n,0);vari=R.defined(a)?a.radiiSquared:h,u=Math.cos(t);d.x=u*Math.cos(e),d.y=u*Math.sin(e),d.z=Math.sin(t),d=b.normalize(d,d),b.multiplyComponents(i,d,s);varo=Math.sqrt(b.dot(d,s));returns=b.divideByScalar(s,o,s),d=b.multiplyByScalar(d,n,d),R.defined(r)||(r=newb),b.add(s,d,r)},b.fromDegreesArray=function(e,t,n){vara=e.length;R.defined(n)?n.length=a/2:n=newArray(a/2);for(varr=0;r<a;r+=2){vari=e[r],u=e[r+1],o=r/2;n[o]=b.fromDegrees(i,u,0,t,n[o])}returnn},b.fromRadiansArray=function(e,t,n){vara=e.length;R.defined(n)?n.length=a/2:n=newArray(a/2);for(varr=0;r<a;r+=2){vari=e[r],u=e[r+1],o=r/2;n[o]=b.fromRadians(i,u,0,t,n[o])}returnn},b.fromDegreesArrayHeights=function(e,t,n){vara=e.length;R.defined(n)?n.length=a/3:n=newArray(a/3);for(varr=0;r<a;r+=3){vari=e[r],u=e[r+1],o=e[r+2],d=r/3;n[d]=b.fromDegrees(i,u,o,t,n[d])}returnn},b.fromRadiansArrayHeights=function(e,t,n){vara=e.length;R.defined(n)?n.length=a/3:n=newArray(a/3);for(varr=0;r<a;r+=3){vari=e[r],u=e[r+1],o=e[r+2],d=r/3;n[d]=b.fromRadians(i,u,o,t,n[d])}returnn},b.ZERO=Object.freeze(newb(0,0,0)),b.UNIT_X=Object.freeze(newb(1,0,0)),b.UNIT_Y=Object.freeze(newb(0,1,0)),b.UNIT_Z=Object.freeze(newb(0,0,1)),b.prototype.clone=function(e){returnb.clone(this,e)},b.prototype.equals=function(e){returnb.equals(this,e)},b.prototype.equalsEpsilon=function(e,t,n){returnb.equalsEpsilon(this,e,t,n)},b.prototype.toString=function(){return"("+this.x+", "+this.y+", "+this.z+")"};varI=newb,E=newb;functionl(e,t,n,a,r){vari=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)returnisFinite(y)?b.clone(p,r):void0;varg=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;varv,_,C,z,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=(C=1/(1+T*x))*C)+c*(O=(z=1/(1+T*M))*z)-1)/(-2*(l*(S*_)*g+f*(q*C)*x+c*(O*z)*M))}while(Math.abs(v)>V.CesiumMath.EPSILON12);returnR.defined(r)?(r.x=i*_,r.y=u*C,r.z=o*z,r):newb(i*_,u*C,o*z)}functionf(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){returnn=R.defaultValue(n,0),R.defined(a)?(a.longitude=e,a.latitude=t,a.height=n,a):newf(e,t,n)},f.fromDegrees=function(e,t,n,a){returne=V.CesiumMath.toRadians(e),t=V.CesiumMath.toRadians(t),f.fromRadians(e,t,n,a)};varc=newb,m=newb,y=newb,p=newb(1/6378137,1/6378137,1/6356752.314245179),g=newb(1/40680631590769,1/40680631590769,1/40408299984661.445),x=V.CesiumMath.EPSILON1;functionM(e,t,n,a){t=R.defaultValue(t,0),n=R.defaultValue(n,0),a=R.defaultValue(a,0),e._radii=newb(t,n,a),e._radiiSquared=newb(t*t,n*n,a*a),e._radiiToTheFourth=newb(t*t*t*t,n*n*n*n,a*a*a*a),e._oneOverRadii=newb(0===t?0:1/t,0===n?0:1/n,0===a?0:1/a),e._oneOverRadiiSquared=newb(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)}functionw(e,t,n){this._radii=void0,this._radiiSquared=void0,this._radiiToTheFourth=void0,this._oneOverRadii=void0,this._oneOverRadiiSquared=void0,this._minimumRadius=void0,this._maximumRadius=void0,this._centerToleranceSquared=void0,this._squaredXOverSquaredZ=void0,M(this,e,t,n)}f.fromCartesian=function(e,t,n){vara=R.defined(t)?t.oneOverRadii:p,r=R.defined(t)?t.oneOverRadiiSquared:g,i=l(e,a,r,R.defined(t)?t._centerToleranceSquared:x,m);if(R.defined(i)){varu=b.multiplyComponents(i,r,c);u=b.normalize(u,u);varo=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);returnR.defined(n)?(n.longitude=d,n.latitude=s,n.height=h,n):newf(d,s,h)}},f.toCartesian=function(e,t,n){returnb.fromRadians(e.longitude,e.latitude,e.height,t,n)},f.clone=function(e,t){if(R.defined(e))returnR.defined(t)?(t.longitude=e.longitude,t.latitude=e.latitude,t.height=e.height,t):newf(e.longitude,e.latitude,e.height)},f.equals=function(e,t){returne===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){returne===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(newf(0,0,0)),f.prototype.clone=function(e){returnf.clone(this,e)},f.prototype.equals=function(e){returnf.equals(this,e)},f.prototype.equalsEpsilon=function(e,t){returnf.equalsEpsilon(this,e,t)},f.prototype.toString=function(){return"("+this.longitude+", "+this.latitude+", "+this.height+")"},Object.defineProperties(w.prototype,{radii:{get:function(){returnthis._radii}},radiiSquared:{get:function(){returnthis._radiiSquared}},radiiToTheFourth:{get:function(){returnthis._radiiToTheFourth}},oneOverRadii:{get:function(){returnthis._oneOverRadii}},oneOverRadiiSquared:{get:function(){returnthis._oneOverRadiiSquared}},minimumRadius:{get:function(){returnthis._minimumRadius}},maximumRadius:{get:function(){returnthis._maximumRadius}}}),w.clone=function(e,t){if(R.defined(e)){varn=e._radii;returnR.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):neww(n.x,n.y,n.z)}},w.fromCartesian3=function(e,t){returnR.defined(t)||(t=neww),R.defined(e)&&M(t,e.x,e.y,e.z),t},w.WGS84=Object.freeze(neww(6378137,6378137,6356752.314245179)),w.UNIT_SPHERE=Object.freeze(neww(1,1,1)),w.MOON=Object.freeze(neww(V.CesiumMath.LUNAR_RADIUS,V.CesiumMath.LUNAR_RADIUS,V.CesiumMath.LUNAR_RADIUS)),w.prototype.clone=function(e){returnw.clone(this,e)},w.packedLength=b.packedLength,w.pack=function(e,t,n){returnn=R.defaultValue(n,0),b.pack(e._radii,t,n),t},w.unpack=function(e,t,n){t=R.defaultValue(t,0);vara=b.unpack(e,t);returnw.fromCartesian3(a,n)},w.prototype.geocentricSurfaceNormal=b.normalize,w.prototype.geodeticSurfaceNormalCartographic=function(e,t){varn=e.longitude,a=e.latitude,r=Math.cos(a),i=r*Math.cos(n),u=r*Math.sin(n),o=Math.sin(a);returnR.defined(t)||(t=newb),t.x=i,t.y=u,t.z=o,b.normalize(t,t)},w.prototype.geodeticSurfaceNormal=function(e,t){returnR.defined(t)||(t=newb),t=b.multiplyComponents(e,this._oneOverRadiiSquared,t),b.normalize(t,t)};varv=newb,_=newb;w.prototype.cartographicToCartesian=function(e,t){varn=v,a=_;this.geodeticSurfaceNormalCartographic(e,n),b.multiplyComponents(this._radiiSquared,n,a);varr=Math.sqrt(b.dot(n,a));returnb.divideByScalar(a,r,a),b.multiplyByScalar(n,e.height,n),R.defined(t)||(t=newb),b.add(a,n,t)},w.prototype.cartographicArrayToCartesianArray=function(e,t){varn=e.length;R.defined(t)?t.length=n:t=newArray(n);for(vara=0;a<n;a++)t[a]=this.cartographicToCartesian(e[a],t[a]);returnt};varC=newb,z=newb,S=newb;functionq(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)}w.prototype.cartesianToCartographic=function(e,t){varn=this.scaleToGeodeticSurface(e,z);if(R.defined(n)){vara=this.geodeticSurfaceNormal(n,C),r=b.subtract(e,n,S),i=Math.atan2(a.y,a.x),u=Math.asin(a.z),o=V.CesiumMath.sign(b.dot(r,e))*b.magnitude(r);returnR.defined(t)?(t.longitude=i,t.latitude=u,t.height=o,t):newf(i,u,o)}},w.prototype.cartesianArrayToCartographicArray=function(e,t){varn=e.length;R.defined(t)?t.length=n:t=newArray(n);for(vara=0;a<n;++a)t[a]=this.cartesianToCartographic(e[a],t[a]);returnt},w.prototype.scaleToGeodeticSurface=function(e,t){returnl(e,this._oneOverRadii,this._oneOverRadiiSquared,this._centerToleranceSquared,t)},w.prototype.scaleToGeocentricSurface=function(e,t){R.defined(t)||(t=newb);varn=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);returnb.multiplyByScalar(e,u,t)},w.prototype.transformPositionToScaledSpace=function(e,t){returnR.defined(t)||(t=newb),b.multiplyComponents(e,this._oneOverRadii,t)},w.prototype.transformPositionFromScaledSpace=function(e,t){returnR.defined(t)||(t=newb),b.multiplyComponents(e,this._radii,t)},w.prototype.equals=function(e){returnthis===e||R.defined(e)&&b.equals(this._radii,e._radii)},w.prototype.toString=function(){returnthis._radii.toString()},w.prototype.getSurfaceNormalIntersectionWithZAxis=function(e,t,n){t=R.defaultValue(t,0);vara=this._squaredXOverSquaredZ;if(R.defined(n)||(n=newb),n.x=0,n.y=0,n.z=e.z*(1-a),!(Math.abs(n.z)>=this._radii.z-t))returnn},Object.defineProperties(q.prototype,{width:{get:function(){returnq.computeWidth(this)}},height:{get:function(){returnq.computeHeight(this)}}}),q.packedLength=4,q.pack=function(e,t,n){returnn=R.defaultValue(n,0),t[n++]=e.west,t[n++]=e.south,t[n++]=e.east,t[n]=e.north,t},q.unpack=function(e,t,n){returnt=R.defaultValue(t,0),R.defined(n)||(n=newq),n.west=e[t++],n.south=e[t++],n.east=e[t++],n.north=e[t],n},q.computeWidth=function(e){vart=e.east,n=e.west;returnt<n&&(t+=V.CesiumMath.TWO_PI),t-n},q.computeHeight=function(e){returne.north-e.south},q.fromDegrees=function(e,t,n,a,r){returne=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):newq(e,t,n,a)},q.fromRadians=function(e,t,n,a,r){returnR.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):newq(e,t,n,a)},q.fromCartographicArray=function(e,t){for(varn=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++){varh=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);varl=0<=h.longitude?h.longitude:h.longitude+V.CesiumMath.TWO_PI;r=Math.min(r,l),i=Math.max(i,l)}returni-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):newq(n,u,a,o)},q.fromCartesianArray=function(e,t,n){t=R.defaultValue(t,w.WGS84);for(vara=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++){varl=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);varf=0<=l.longitude?l.longitude:l.longitude+V.CesiumMath.TWO_PI;i=Math.min(i,f),u=Math.max(u,f)}returnu-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):newq(a,o,r,d)},q.clone=function(e,t){if(R.defined(e))returnR.defined(t)?(t.west=e.west,t.south=e.south,t.east=e.east,t.north=e.north,t):newq(e.west,e.south,e.east,e.north)},q.equalsEpsilon=function(e,t,n){returne===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},q.prototype.clone=function(e){returnq.clone(this,e)},q.prototype.equals=function(e){returnq.equals(this,e)},q.equals=function(e,t){returne===t||R.defined(e)&&R.defined(t)&&e.west===t.west&&e.south===t.south&&e.east===t.east&&e.north===t.north},q.prototype.equalsEpsilon=function(e,t){returnq.equalsEpsilon(this,e,t)},q.validate=function(e){},q.southwest=function(e,t){returnR.defined(t)?(t.longitude=e.west,t.latitude=e.south,t.height=0,t):newf(e.west,e.south)},q.northwest=function(e,t){returnR.defined(t)?(t.longitude=e.west,t.latitude=e.north,t.height=0,t):newf(e.west,e.north)},q.northeast=function(e,t){returnR.defined(t)?(t.longitude=e.east,t.latitude=e.north,t.height=0,t):newf(e.east,e.north)},q.southeast=function(e,t){returnR.defined(t)?(t.longitude=e.east,t.latitude=e.south,t.height=0,t):newf(e.east,e.south)},q.center=function(e,t){varn=e.east,a=e.west;n<a&&(n+=V.CesiumMath.TWO_PI);varr=V.CesiumMath.negativePiToPi(.5*(a+n)),i=.5*(e.south+e.north);returnR.defined(t)?(t.longitude=r,t.latitude=i,t.height=0,t):newf(r,i)},q.intersection=function(e,t,n){vara=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);varo=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)){vars=Math.max(e.south,t.south),h=Math.min(e.north,t.north);if(!(h<=s))returnR.defined(n)?(n.west=o,n.south=s,n.east=d,n.north=h,n):newq(o,s,d,h)}},q.simpleIntersection=function(e,t,n){vara=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))returnR.defined(n)?(n.west=a,n.south=r,n.east=i,n.north=u,n):newq(a,r,i,u)},q.union=function(e,t,n){R.defined(n)||(n=newq);vara=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);varo=V.CesiumMath.convertLongitudeRange(Math.min(r,u)),d=V.CesiumMath.convertLongitudeRange(Math.max(a,i));returnn.west=o,n.south=Math.min(e.south,t.south),n.east=d,n.north=Math.max(e.north,t.north),n},q.expand=function(e,t,n){returnR.defined(n)||(n=newq),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},q.contains=function(e,t){varn=t.longitude,a=t.latitude,r=e.west,i=e.east;returni<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};varO=newf;functionT(e,t){this.x=R.defaultValue(e,0),this.y=R.defaultValue(t,0)}q.subsample=function(e,t,n,a){t=R.defaultValue(t,w.WGS84),n=R.defaultValue(n,0),R.defined(a)||(a=[]);varr=0,i=e.north,u=e.south,o=e.east,d=e.west,s=O;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(varh=1;h<8;++h)s.longitude=-Math.PI+h*V.CesiumMath.PI_OVER_TWO,q.contains(e,s)&&(a[r]=t.cartographicToCartesian(s,a[r]),r++);return0===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},q.MAX_VALUE=Object.freeze(newq(-Math.PI,-V.CesiumMath.PI_OVER_TWO,Math.PI,V.CesiumMath.PI_OVER_TWO)),T.fromElements=function(e,t,n){returnR.defined(n)?(n.x=e,n.y=t,n):newT(e,t)},T.fromCartesian3=T.clone=function(e,t){if(R.defined(e))returnR.defined(t)?(t.x=e.x,t.y=e.y,t):newT(e.x,e.y)},T.fromCartesian4=T.clone,T.packedLength=2,T.pack=function(e,t,n){returnn=R.defaultValue(n,0),t[n++]=e.x,t[n]=e.y,t},T.unpack=function(e,t,n){returnt=R.defaultValue(t,0),R.defined(n)||(n=newT),n.x=e[t++],n.y=e[t],n},T.packArray=function(e,t){varn=e.length,a=2*n;if(R.defined(t)){if(!Array.isArray(t)&&t.length!==a)thrownewi.DeveloperError("If result is a typed array, it must have exactly array.length * 2 elements");t.length!==a&&(t.length=a)}elset=newArray(a);for(varr=0;r<n;++r)T.pack(e[r],t,2*r);returnt},T.unpackArray=function(e,t){varn=e.length;R.defined(t)?t.length=n/2:t=newArray(n/2);for(vara=0;a<n;a+=2){varr=a/2;t[r]=T.unpack(e,a,t[r])}returnt},T.fromArray=T.unpack,T.maximumComponent=function(e){returnMath.max(e.x,e.y)},T.minimumComponent=function(e){returnMath.min(e.x,e.y)},T.minimumByComponent=function(e,t,n){returnn.x=Math.min(e.x,t.x),n.y=Math.min(e.y,t.y),n},T.maximumByComponent=function(e,t,n){returnn.x=Math.max(e.x,t.x),n.y=Math.max(e.y,t.y),n},T.magnitudeSquared=function(e){returne.x*e.x+e.y*e.y},T.magnitude=function(e){returnMath.sqrt(T.magnitudeSquared(e))};varA=newT;T.distance=function(e,t){returnT.subtract(e,t,A),T.magnitude(A)},T.distanceSquared=function(e,t){returnT.subtract(e,t,A),T.magnitudeSquared(A)},T.normalize=function(e,t){varn=T.magnitude(e);returnt.x=e.x/n,t.y=e.y/n,t},T.dot=function(e,t){returne.x*t.x+e.y*t.y},T.multiplyComponents=function(e,t,n){returnn.x=e.x*t.x,n.y=e.y*t.y,n},T.divideComponents=function(e,t,n){returnn.x=e.x/t.x,n.y=e.y/t.y,n},T.add=function(e,t,n){returnn.x=e.x+t.x,n.y=e.y+t.y,n},T.subtract=function(e,t,n){returnn.x=e.x-t.x,n.y=e.y-t.y,n},T.multiplyByScalar=function(e,t,n){returnn.x=e.x*t,n.y=e.y*t,n},T.divideByScalar=function(e,t,n){returnn.x=e.x/t,n.y=e.y/t,n},T.negate=function(e,t){returnt.x=-e.x,t.y=-e.y,t},T.abs=function(e,t){returnt.x=Math.abs(e.x),t.y=Math.abs(e.y),t};varP=newT;T.lerp=function(e,t,n,a){returnT.multiplyByScalar(t,n,P),a=T.multiplyByScalar(e,1-n,a),T.add(P,a,a)};varN=newT,U=newT;T.angleBetween=function(e,t){returnT.normalize(e,N),T.normalize(t,U),V.CesiumMath.acosClamped(T.dot(N,U))};varL=newT;T.mostOrthogonalAxis=function(e,t){varn=T.normalize(e,L);returnT.abs(n,n),t=n.x<=n.y?T.clone(T.UNIT_X,t):T.clone(T.UNIT_Y,t)},T.equals=function(e,t){returne===t||R.defined(e)&&R.defined(t)&&e.x===t.x&&e.y===t.y},T.equalsArray=function(e,t,n){returne.x===t[n]&&e.y===t[n+1]},T.equalsEpsilon=function(e,t,n,a){returne===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)},T.ZERO=Object.freeze(newT(0,0)),T.UNIT_X=Object.freeze(newT(1,0)),T.UNIT_Y=Object.freeze(newT(0,1)),T.prototype.clone=function(e){returnT.clone(this,e)},T.prototype.equals=function(e){returnT.equals(this,e)},T.prototype.equalsEpsilon=function(e,t,n){returnT.equalsEpsilon(this,e,t,n)},T.prototype.toString=function(){return"("+this.x+", "+this.y+")"},e.Cartesian2=T,e.Cartesian3=b,e.Cartographic=f,e.Ellipsoid=w,e.Rectangle=q});
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* Columbus View (Pat. Pend.)
*
* Portions licensed separately.
* See https://github.com/CesiumGS/cesium/blob/master/LICENSE.md for full licensing details.
*/
define(["exports","./when-60b00257"],function(e,n){"use strict";functionr(e){vart;this.name="DeveloperError",this.message=e;try{thrownewError}catch(e){t=e.stack}this.stack=t}n.defined(Object.create)&&((r.prototype=Object.create(Error.prototype)).constructor=r),r.prototype.toString=function(){vare=this.name+": "+this.message;returnn.defined(this.stack)&&(e+="\n"+this.stack.toString()),e},r.throwInstantiationError=function(){thrownewr("This function defines an interface and should not be called directly.")};vara={};functiono(e,t,n){return"Expected "+n+" to be typeof "+t+", actual typeof was "+e}a.typeOf={},a.defined=function(e,t){if(!n.defined(t))thrownewr(e+" is required, actual value was undefined")},a.typeOf.func=function(e,t){if("function"!=typeoft)thrownewr(o(typeoft,"function",e))},a.typeOf.string=function(e,t){if("string"!=typeoft)thrownewr(o(typeoft,"string",e))},a.typeOf.number=function(e,t){if("number"!=typeoft)thrownewr(o(typeoft,"number",e))},a.typeOf.number.lessThan=function(e,t,n){if(a.typeOf.number(e,t),n<=t)thrownewr("Expected "+e+" to be less than "+n+", actual value was "+t)},a.typeOf.number.lessThanOrEquals=function(e,t,n){if(a.typeOf.number(e,t),n<t)thrownewr("Expected "+e+" to be less than or equal to "+n+", actual value was "+t)},a.typeOf.number.greaterThan=function(e,t,n){if(a.typeOf.number(e,t),t<=n)thrownewr("Expected "+e+" to be greater than "+n+", actual value was "+t)},a.typeOf.number.greaterThanOrEquals=function(e,t,n){if(a.typeOf.number(e,t),t<n)thrownewr("Expected "+e+" to be greater than or equal to"+n+", actual value was "+t)},a.typeOf.object=function(e,t){if("object"!=typeoft)thrownewr(o(typeoft,"object",e))},a.typeOf.bool=function(e,t){if("boolean"!=typeoft)thrownewr(o(typeoft,"boolean",e))},a.typeOf.number.equals=function(e,t,n,o){if(a.typeOf.number(e,n),a.typeOf.number(t,o),n!==o)thrownewr(e+" must be equal to "+t+", the actual values are "+n+" and "+o)},e.Check=a,e.DeveloperError=r});