/** * Cesium - https://github.com/AnalyticalGraphicsInc/cesium * * Copyright 2011-2017 Cesium Contributors * * 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/AnalyticalGraphicsInc/cesium/blob/master/LICENSE.md for full licensing details. */ /** @license mersenne-twister.js - https://gist.github.com/banksean/300494 Copyright (C) 1997 - 2002, Makoto Matsumoto and Takuji Nishimura, All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. The names of its contributors may not be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ !function(){define("Core/defined",[],function(){"use strict";function t(t){return void 0!==t&&null!==t}return t}),define("Core/DeveloperError",["./defined"],function(t){"use strict";function e(t){this.name="DeveloperError",this.message=t;var e;try{throw new Error}catch(t){e=t.stack}this.stack=e}return t(Object.create)&&(e.prototype=Object.create(Error.prototype),e.prototype.constructor=e),e.prototype.toString=function(){var e=this.name+": "+this.message;return t(this.stack)&&(e+="\n"+this.stack.toString()),e},e.throwInstantiationError=function(){throw new e("This function defines an interface and should not be called directly.")},e}),define("Core/Check",["./defined","./DeveloperError"],function(t,e){"use strict";function n(t){return t+" is required, actual value was undefined"}function r(t,e,n){return"Expected "+n+" to be typeof "+e+", actual typeof was "+t}var i={};return i.typeOf={},i.defined=function(r,i){if(!t(i))throw new e(n(r))},i.typeOf.func=function(t,n){if("function"!=typeof n)throw new e(r(typeof n,"function",t))},i.typeOf.string=function(t,n){if("string"!=typeof n)throw new e(r(typeof n,"string",t))},i.typeOf.number=function(t,n){if("number"!=typeof n)throw new e(r(typeof n,"number",t))},i.typeOf.number.lessThan=function(t,n,r){if(i.typeOf.number(t,n),n>=r)throw new e("Expected "+t+" to be less than "+r+", actual value was "+n)},i.typeOf.number.lessThanOrEquals=function(t,n,r){if(i.typeOf.number(t,n),n>r)throw new e("Expected "+t+" to be less than or equal to "+r+", actual value was "+n)},i.typeOf.number.greaterThan=function(t,n,r){if(i.typeOf.number(t,n),n<=r)throw new e("Expected "+t+" to be greater than "+r+", actual value was "+n)},i.typeOf.number.greaterThanOrEquals=function(t,n,r){if(i.typeOf.number(t,n),n>>0,this.mti=1;this.mti>>30;this.mt[this.mti]=(1812433253*((4294901760&t)>>>16)<<16)+1812433253*(65535&t)+this.mti,this.mt[this.mti]>>>=0}},t.prototype.genrand_int32=function(){var t,e=new Array(0,this.MATRIX_A);if(this.mti>=this.N){var n;for(this.mti==this.N+1&&this.init_genrand(5489),n=0;n>>1^e[1&t];for(;n>>1^e[1&t];t=this.mt[this.N-1]&this.UPPER_MASK|this.mt[0]&this.LOWER_MASK,this.mt[this.N-1]=this.mt[this.M-1]^t>>>1^e[1&t],this.mti=0}return t=this.mt[this.mti++],t^=t>>>11,t^=t<<7&2636928640,t^=t<<15&4022730752,(t^=t>>>18)>>>0},t.prototype.random=function(){return this.genrand_int32()*(1/4294967296)},t}),define("Core/Math",["../ThirdParty/mersenne-twister","./defaultValue","./defined","./DeveloperError"],function(t,e,n,r){"use strict";var i={};i.EPSILON1=.1,i.EPSILON2=.01,i.EPSILON3=.001,i.EPSILON4=1e-4,i.EPSILON5=1e-5,i.EPSILON6=1e-6,i.EPSILON7=1e-7,i.EPSILON8=1e-8,i.EPSILON9=1e-9,i.EPSILON10=1e-10,i.EPSILON11=1e-11,i.EPSILON12=1e-12,i.EPSILON13=1e-13,i.EPSILON14=1e-14,i.EPSILON15=1e-15,i.EPSILON16=1e-16,i.EPSILON17=1e-17,i.EPSILON18=1e-18,i.EPSILON19=1e-19,i.EPSILON20=1e-20,i.GRAVITATIONALPARAMETER=3986004418e5,i.SOLAR_RADIUS=6955e5,i.LUNAR_RADIUS=1737400,i.SIXTY_FOUR_KILOBYTES=65536,i.sign=function(t){return t>0?1:t<0?-1:0},i.signNotZero=function(t){return t<0?-1:1},i.toSNorm=function(t,n){return n=e(n,255),Math.round((.5*i.clamp(t,-1,1)+.5)*n)},i.fromSNorm=function(t,n){return n=e(n,255),i.clamp(t,0,n)/n*2-1},i.sinh=function(t){return.5*(Math.pow(Math.E,t)-Math.pow(Math.E,-1*t))},i.cosh=function(t){return.5*(Math.pow(Math.E,t)+Math.pow(Math.E,-1*t))},i.lerp=function(t,e,n){return(1-n)*t+n*e},i.PI=Math.PI,i.ONE_OVER_PI=1/Math.PI,i.PI_OVER_TWO=.5*Math.PI,i.PI_OVER_THREE=Math.PI/3,i.PI_OVER_FOUR=Math.PI/4,i.PI_OVER_SIX=Math.PI/6,i.THREE_PI_OVER_TWO=3*Math.PI*.5,i.TWO_PI=2*Math.PI,i.ONE_OVER_TWO_PI=1/(2*Math.PI),i.RADIANS_PER_DEGREE=Math.PI/180,i.DEGREES_PER_RADIAN=180/Math.PI,i.RADIANS_PER_ARCSECOND=i.RADIANS_PER_DEGREE/3600,i.toRadians=function(t){return t*i.RADIANS_PER_DEGREE},i.toDegrees=function(t){return t*i.DEGREES_PER_RADIAN},i.convertLongitudeRange=function(t){var e=i.TWO_PI,n=t-Math.floor(t/e)*e;return n<-Math.PI?n+e:n>=Math.PI?n-e:n},i.clampToLatitudeRange=function(t){return i.clamp(t,-1*i.PI_OVER_TWO,i.PI_OVER_TWO)},i.negativePiToPi=function(t){return i.zeroToTwoPi(t+i.PI)-i.PI},i.zeroToTwoPi=function(t){var e=i.mod(t,i.TWO_PI);return Math.abs(e)i.EPSILON14?i.TWO_PI:e},i.mod=function(t,e){return(t%e+e)%e},i.equalsEpsilon=function(t,n,r,i){i=e(i,r);var a=Math.abs(t-n);return a<=i||a<=r*Math.max(Math.abs(t),Math.abs(n))};var a=[1];i.factorial=function(t){var e=a.length;if(t>=e)for(var n=a[e-1],r=e;r<=t;r++)a.push(n*r);return a[t]},i.incrementWrap=function(t,n,r){return r=e(r,0),++t,t>n&&(t=r),t},i.isPowerOfTwo=function(t){return 0!==t&&0==(t&t-1)},i.nextPowerOfTwo=function(t){return--t,t|=t>>1,t|=t>>2,t|=t>>4,t|=t>>8,t|=t>>16,++t},i.clamp=function(t,e,n){return tn?n:t};var o=new t;return i.setRandomNumberSeed=function(e){o=new t(e)},i.nextRandomNumber=function(){return o.random()},i.randomBetween=function(t,e){return i.nextRandomNumber()*(e-t)+t},i.acosClamped=function(t){return Math.acos(i.clamp(t,-1,1))},i.asinClamped=function(t){return Math.asin(i.clamp(t,-1,1))},i.chordLength=function(t,e){return 2*e*Math.sin(.5*t)},i.logBase=function(t,e){return Math.log(t)/Math.log(e)},i.fog=function(t,e){var n=t*e;return 1-Math.exp(-n*n)},i}),define("Core/Cartesian3",["./Check","./defaultValue","./defined","./DeveloperError","./freezeObject","./Math"],function(t,e,n,r,i,a){"use strict";function o(t,n,r){this.x=e(t,0),this.y=e(n,0),this.z=e(r,0)}o.fromSpherical=function(t,r){n(r)||(r=new o);var i=t.clock,a=t.cone,u=e(t.magnitude,1),s=u*Math.sin(a);return r.x=s*Math.cos(i),r.y=s*Math.sin(i),r.z=u*Math.cos(a),r},o.fromElements=function(t,e,r,i){return n(i)?(i.x=t,i.y=e,i.z=r,i):new o(t,e,r)},o.clone=function(t,e){if(n(t))return n(e)?(e.x=t.x,e.y=t.y,e.z=t.z,e):new o(t.x,t.y,t.z)},o.fromCartesian4=o.clone,o.packedLength=3,o.pack=function(t,n,r){return r=e(r,0),n[r++]=t.x,n[r++]=t.y,n[r]=t.z,n},o.unpack=function(t,r,i){return r=e(r,0),n(i)||(i=new o),i.x=t[r++],i.y=t[r++],i.z=t[r],i},o.packArray=function(t,e){var r=t.length;n(e)?e.length=3*r:e=new Array(3*r);for(var i=0;ir.EPSILON12);return e(c)?(c.x=E*C,c.y=_*g,c.z=l*v,c):new t(E*C,_*g,l*v)}var a=new t,o=new t;return i}),define("Core/Cartographic",["./Cartesian3","./Check","./defaultValue","./defined","./freezeObject","./Math","./scaleToGeodeticSurface"],function(t,e,n,r,i,a,o){"use strict";function u(t,e,r){this.longitude=n(t,0),this.latitude=n(e,0),this.height=n(r,0)}u.fromRadians=function(t,e,i,a){return i=n(i,0),r(a)?(a.longitude=t,a.latitude=e,a.height=i,a):new u(t,e,i)},u.fromDegrees=function(t,e,n,r){return t=a.toRadians(t),e=a.toRadians(e),u.fromRadians(t,e,n,r)};var s=new t,c=new t,E=new t,_=new t(1/6378137,1/6378137,1/6356752.314245179),l=new t(1/40680631590769,1/40680631590769,1/40408299984661.445),f=a.EPSILON1;return u.fromCartesian=function(e,n,i){var h=r(n)?n.oneOverRadii:_,R=r(n)?n.oneOverRadiiSquared:l,T=r(n)?n._centerToleranceSquared:f,d=o(e,h,R,T,c);if(r(d)){var A=t.multiplyComponents(d,R,s);A=t.normalize(A,A);var p=t.subtract(e,d,E),m=Math.atan2(A.y,A.x),N=Math.asin(A.z),y=a.sign(t.dot(p,e))*t.magnitude(p);return r(i)?(i.longitude=m,i.latitude=N,i.height=y,i):new u(m,N,y)}},u.clone=function(t,e){if(r(t))return r(e)?(e.longitude=t.longitude,e.latitude=t.latitude,e.height=t.height,e):new u(t.longitude,t.latitude,t.height)},u.equals=function(t,e){return t===e||r(t)&&r(e)&&t.longitude===e.longitude&&t.latitude===e.latitude&&t.height===e.height},u.equalsEpsilon=function(t,e,n){return t===e||r(t)&&r(e)&&Math.abs(t.longitude-e.longitude)<=n&&Math.abs(t.latitude-e.latitude)<=n&&Math.abs(t.height-e.height)<=n},u.ZERO=i(new u(0,0,0)),u.prototype.clone=function(t){return u.clone(this,t)},u.prototype.equals=function(t){return u.equals(this,t)},u.prototype.equalsEpsilon=function(t,e){return u.equalsEpsilon(this,t,e)},u.prototype.toString=function(){return"("+this.longitude+", "+this.latitude+", "+this.height+")"},u}),define("Core/defineProperties",["./defined"],function(t){"use strict";var e=function(){try{return"x"in Object.defineProperty({},"x",{})}catch(t){return!1}}(),n=Object.defineProperties;return e&&t(n)||(n=function(t){return t}),n}),define("Core/Ellipsoid",["./Cartesian3","./Cartographic","./Check","./defaultValue","./defined","./defineProperties","./DeveloperError","./freezeObject","./Math","./scaleToGeodeticSurface"],function(t,e,n,r,i,a,o,u,s,c){"use strict";function E(e,n,i,a){n=r(n,0),i=r(i,0),a=r(a,0),e._radii=new t(n,i,a),e._radiiSquared=new t(n*n,i*i,a*a),e._radiiToTheFourth=new t(n*n*n*n,i*i*i*i,a*a*a*a),e._oneOverRadii=new t(0===n?0:1/n,0===i?0:1/i,0===a?0:1/a),e._oneOverRadiiSquared=new t(0===n?0:1/(n*n),0===i?0:1/(i*i),0===a?0:1/(a*a)),e._minimumRadius=Math.min(n,i,a),e._maximumRadius=Math.max(n,i,a),e._centerToleranceSquared=s.EPSILON1,0!==e._radiiSquared.z&&(e._squaredXOverSquaredZ=e._radiiSquared.x/e._radiiSquared.z)}function _(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,E(this,t,e,n)}a(_.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}}}),_.clone=function(e,n){if(i(e)){var r=e._radii;return i(n)?(t.clone(r,n._radii),t.clone(e._radiiSquared,n._radiiSquared),t.clone(e._radiiToTheFourth,n._radiiToTheFourth),t.clone(e._oneOverRadii,n._oneOverRadii),t.clone(e._oneOverRadiiSquared,n._oneOverRadiiSquared),n._minimumRadius=e._minimumRadius,n._maximumRadius=e._maximumRadius,n._centerToleranceSquared=e._centerToleranceSquared,n):new _(r.x,r.y,r.z)}},_.fromCartesian3=function(t,e){return i(e)||(e=new _),i(t)?(E(e,t.x,t.y,t.z),e):e},_.WGS84=u(new _(6378137,6378137,6356752.314245179)),_.UNIT_SPHERE=u(new _(1,1,1)),_.MOON=u(new _(s.LUNAR_RADIUS,s.LUNAR_RADIUS,s.LUNAR_RADIUS)),_.prototype.clone=function(t){return _.clone(this,t)},_.packedLength=t.packedLength,_.pack=function(e,n,i){return i=r(i,0),t.pack(e._radii,n,i),n},_.unpack=function(e,n,i){n=r(n,0);var a=t.unpack(e,n);return _.fromCartesian3(a,i)},_.prototype.geocentricSurfaceNormal=t.normalize,_.prototype.geodeticSurfaceNormalCartographic=function(e,n){var r=e.longitude,a=e.latitude,o=Math.cos(a),u=o*Math.cos(r),s=o*Math.sin(r),c=Math.sin(a);return i(n)||(n=new t),n.x=u,n.y=s,n.z=c,t.normalize(n,n)},_.prototype.geodeticSurfaceNormal=function(e,n){return i(n)||(n=new t),n=t.multiplyComponents(e,this._oneOverRadiiSquared,n),t.normalize(n,n)};var l=new t,f=new t;_.prototype.cartographicToCartesian=function(e,n){var r=l,a=f;this.geodeticSurfaceNormalCartographic(e,r),t.multiplyComponents(this._radiiSquared,r,a);var o=Math.sqrt(t.dot(r,a));return t.divideByScalar(a,o,a),t.multiplyByScalar(r,e.height,r),i(n)||(n=new t),t.add(a,r,n)},_.prototype.cartographicArrayToCartesianArray=function(t,e){var n=t.length;i(e)?e.length=n:e=new Array(n);for(var r=0;r=this._radii.z-n))return a},_}),define("Core/GeographicProjection",["./Cartesian3","./Cartographic","./defaultValue","./defined","./defineProperties","./DeveloperError","./Ellipsoid"],function(t,e,n,r,i,a,o){"use strict";function u(t){this._ellipsoid=n(t,o.WGS84),this._semimajorAxis=this._ellipsoid.maximumRadius,this._oneOverSemimajorAxis=1/this._semimajorAxis}return i(u.prototype,{ellipsoid:{get:function(){return this._ellipsoid}}}),u.prototype.project=function(e,n){var i=this._semimajorAxis,a=e.longitude*i,o=e.latitude*i,u=e.height;return r(n)?(n.x=a,n.y=o,n.z=u,n):new t(a,o,u)},u.prototype.unproject=function(t,n){var i=this._oneOverSemimajorAxis,a=t.x*i,o=t.y*i,u=t.z;return r(n)?(n.longitude=a,n.latitude=o,n.height=u,n):new e(a,o,u)},u}),define("Core/Intersect",["./freezeObject"],function(t){"use strict";return t({OUTSIDE:-1,INTERSECTING:0,INSIDE:1})}),define("Core/Interval",["./defaultValue"],function(t){"use strict";function e(e,n){this.start=t(e,0),this.stop=t(n,0)}return e}),define("Core/Matrix3",["./Cartesian3","./Check","./defaultValue","./defined","./defineProperties","./DeveloperError","./freezeObject","./Math"],function(t,e,n,r,i,a,o,u){"use strict";function s(t,e,r,i,a,o,u,s,c){this[0]=n(t,0),this[1]=n(i,0),this[2]=n(u,0),this[3]=n(e,0),this[4]=n(a,0),this[5]=n(s,0),this[6]=n(r,0),this[7]=n(o,0),this[8]=n(c,0)}function c(t){for(var e=0,n=0;n<9;++n){var r=t[n];e+=r*r}return Math.sqrt(e)}function E(t){for(var e=0,n=0;n<3;++n){var r=t[s.getElementIndex(R[n],h[n])];e+=2*r*r}return Math.sqrt(e)}function _(t,e){for(var n=u.EPSILON15,r=0,i=1,a=0;a<3;++a){var o=Math.abs(t[s.getElementIndex(R[a],h[a])]);o>r&&(i=a,r=o)}var c=1,E=0,_=h[i],l=R[i];if(Math.abs(t[s.getElementIndex(l,_)])>n){var f,T=t[s.getElementIndex(l,l)],d=t[s.getElementIndex(_,_)],A=t[s.getElementIndex(l,_)],p=(T-d)/2/A;f=p<0?-1/(-p+Math.sqrt(1+p*p)):1/(p+Math.sqrt(1+p*p)),c=1/Math.sqrt(1+f*f),E=f*c}return e=s.clone(s.IDENTITY,e),e[s.getElementIndex(_,_)]=e[s.getElementIndex(l,l)]=c,e[s.getElementIndex(l,_)]=E,e[s.getElementIndex(_,l)]=-E,e}s.packedLength=9,s.pack=function(t,e,r){return r=n(r,0),e[r++]=t[0],e[r++]=t[1],e[r++]=t[2],e[r++]=t[3],e[r++]=t[4],e[r++]=t[5],e[r++]=t[6],e[r++]=t[7],e[r++]=t[8],e},s.unpack=function(t,e,i){return e=n(e,0),r(i)||(i=new s),i[0]=t[e++],i[1]=t[e++],i[2]=t[e++],i[3]=t[e++],i[4]=t[e++],i[5]=t[e++],i[6]=t[e++],i[7]=t[e++],i[8]=t[e++],i},s.clone=function(t,e){if(r(t))return r(e)?(e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e):new s(t[0],t[3],t[6],t[1],t[4],t[7],t[2],t[5],t[8])},s.fromArray=function(t,e,i){return e=n(e,0),r(i)||(i=new s),i[0]=t[e],i[1]=t[e+1],i[2]=t[e+2],i[3]=t[e+3],i[4]=t[e+4],i[5]=t[e+5],i[6]=t[e+6],i[7]=t[e+7],i[8]=t[e+8],i},s.fromColumnMajorArray=function(t,e){return s.clone(t,e)},s.fromRowMajorArray=function(t,e){return r(e)?(e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8],e):new s(t[0],t[1],t[2],t[3],t[4],t[5],t[6],t[7],t[8])},s.fromQuaternion=function(t,e){var n=t.x*t.x,i=t.x*t.y,a=t.x*t.z,o=t.x*t.w,u=t.y*t.y,c=t.y*t.z,E=t.y*t.w,_=t.z*t.z,l=t.z*t.w,f=t.w*t.w,h=n-u-_+f,R=2*(i-l),T=2*(a+E),d=2*(i+l),A=-n+u-_+f,p=2*(c-o),m=2*(a-E),N=2*(c+o),y=-n-u+_+f;return r(e)?(e[0]=h,e[1]=d,e[2]=m,e[3]=R,e[4]=A,e[5]=N,e[6]=T,e[7]=p,e[8]=y,e):new s(h,R,T,d,A,p,m,N,y)},s.fromHeadingPitchRoll=function(t,e){var n=Math.cos(-t.pitch),i=Math.cos(-t.heading),a=Math.cos(t.roll),o=Math.sin(-t.pitch),u=Math.sin(-t.heading),c=Math.sin(t.roll),E=n*i,_=-a*u+c*o*i,l=c*u+a*o*i,f=n*u,h=a*i+c*o*u,R=-c*i+a*o*u,T=-o,d=c*n,A=a*n;return r(e)?(e[0]=E,e[1]=f,e[2]=T,e[3]=_,e[4]=h,e[5]=d,e[6]=l,e[7]=R,e[8]=A,e):new s(E,_,l,f,h,R,T,d,A)},s.fromScale=function(t,e){return r(e)?(e[0]=t.x,e[1]=0,e[2]=0,e[3]=0,e[4]=t.y,e[5]=0,e[6]=0,e[7]=0,e[8]=t.z,e):new s(t.x,0,0,0,t.y,0,0,0,t.z)},s.fromUniformScale=function(t,e){return r(e)?(e[0]=t,e[1]=0,e[2]=0,e[3]=0,e[4]=t,e[5]=0,e[6]=0,e[7]=0,e[8]=t,e):new s(t,0,0,0,t,0,0,0,t)},s.fromCrossProduct=function(t,e){return r(e)?(e[0]=0,e[1]=t.z,e[2]=-t.y,e[3]=-t.z,e[4]=0,e[5]=t.x,e[6]=t.y,e[7]=-t.x,e[8]=0,e):new s(0,-t.z,t.y,t.z,0,-t.x,-t.y,t.x,0)},s.fromRotationX=function(t,e){var n=Math.cos(t),i=Math.sin(t);return r(e)?(e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=n,e[5]=i,e[6]=0,e[7]=-i,e[8]=n,e):new s(1,0,0,0,n,-i,0,i,n)},s.fromRotationY=function(t,e){var n=Math.cos(t),i=Math.sin(t);return r(e)?(e[0]=n,e[1]=0,e[2]=-i,e[3]=0,e[4]=1,e[5]=0,e[6]=i,e[7]=0,e[8]=n,e):new s(n,0,i,0,1,0,-i,0,n)},s.fromRotationZ=function(t,e){var n=Math.cos(t),i=Math.sin(t);return r(e)?(e[0]=n,e[1]=i,e[2]=0,e[3]=-i,e[4]=n,e[5]=0,e[6]=0,e[7]=0,e[8]=1,e):new s(n,-i,0,i,n,0,0,0,1)},s.toArray=function(t,e){return r(e)?(e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e):[t[0],t[1],t[2],t[3],t[4],t[5],t[6],t[7],t[8]]},s.getElementIndex=function(t,e){return 3*t+e},s.getColumn=function(t,e,n){var r=3*e,i=t[r],a=t[r+1],o=t[r+2];return n.x=i,n.y=a,n.z=o,n},s.setColumn=function(t,e,n,r){r=s.clone(t,r);var i=3*e;return r[i]=n.x,r[i+1]=n.y,r[i+2]=n.z,r},s.getRow=function(t,e,n){var r=t[e],i=t[e+3],a=t[e+6];return n.x=r,n.y=i,n.z=a,n},s.setRow=function(t,e,n,r){return r=s.clone(t,r),r[e]=n.x,r[e+3]=n.y,r[e+6]=n.z,r};var l=new t;s.getScale=function(e,n){return n.x=t.magnitude(t.fromElements(e[0],e[1],e[2],l)),n.y=t.magnitude(t.fromElements(e[3],e[4],e[5],l)),n.z=t.magnitude(t.fromElements(e[6],e[7],e[8],l)),n};var f=new t;s.getMaximumScale=function(e){return s.getScale(e,f),t.maximumComponent(f)},s.multiply=function(t,e,n){var r=t[0]*e[0]+t[3]*e[1]+t[6]*e[2],i=t[1]*e[0]+t[4]*e[1]+t[7]*e[2],a=t[2]*e[0]+t[5]*e[1]+t[8]*e[2],o=t[0]*e[3]+t[3]*e[4]+t[6]*e[5],u=t[1]*e[3]+t[4]*e[4]+t[7]*e[5],s=t[2]*e[3]+t[5]*e[4]+t[8]*e[5],c=t[0]*e[6]+t[3]*e[7]+t[6]*e[8],E=t[1]*e[6]+t[4]*e[7]+t[7]*e[8],_=t[2]*e[6]+t[5]*e[7]+t[8]*e[8];return n[0]=r,n[1]=i,n[2]=a,n[3]=o,n[4]=u,n[5]=s,n[6]=c,n[7]=E,n[8]=_,n},s.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[4]=t[4]+e[4],n[5]=t[5]+e[5],n[6]=t[6]+e[6],n[7]=t[7]+e[7],n[8]=t[8]+e[8],n},s.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[4]=t[4]-e[4],n[5]=t[5]-e[5],n[6]=t[6]-e[6],n[7]=t[7]-e[7],n[8]=t[8]-e[8],n},s.multiplyByVector=function(t,e,n){var r=e.x,i=e.y,a=e.z,o=t[0]*r+t[3]*i+t[6]*a,u=t[1]*r+t[4]*i+t[7]*a,s=t[2]*r+t[5]*i+t[8]*a;return n.x=o,n.y=u,n.z=s,n},s.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[4]=t[4]*e,n[5]=t[5]*e,n[6]=t[6]*e,n[7]=t[7]*e,n[8]=t[8]*e,n},s.multiplyByScale=function(t,e,n){return n[0]=t[0]*e.x,n[1]=t[1]*e.x,n[2]=t[2]*e.x,n[3]=t[3]*e.y,n[4]=t[4]*e.y,n[5]=t[5]*e.y,n[6]=t[6]*e.z,n[7]=t[7]*e.z,n[8]=t[8]*e.z,n},s.negate=function(t,e){return e[0]=-t[0],e[1]=-t[1],e[2]=-t[2],e[3]=-t[3],e[4]=-t[4],e[5]=-t[5],e[6]=-t[6],e[7]=-t[7],e[8]=-t[8],e},s.transpose=function(t,e){var n=t[0],r=t[3],i=t[6],a=t[1],o=t[4],u=t[7],s=t[2],c=t[5],E=t[8];return e[0]=n,e[1]=r,e[2]=i,e[3]=a,e[4]=o,e[5]=u,e[6]=s,e[7]=c,e[8]=E,e};var h=[1,0,0],R=[2,2,1],T=new s,d=new s;return s.computeEigenDecomposition=function(t,e){var n=u.EPSILON20,i=0,a=0;r(e)||(e={});for(var o=e.unitary=s.clone(s.IDENTITY,e.unitary),l=e.diagonal=s.clone(t,e.diagonal),f=n*c(l);a<10&&E(l)>f;)_(l,T),s.transpose(T,d),s.multiply(l,T,l),s.multiply(d,l,l),s.multiply(o,T,o),++i>2&&(++a,i=0);return e},s.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[4]=Math.abs(t[4]),e[5]=Math.abs(t[5]),e[6]=Math.abs(t[6]),e[7]=Math.abs(t[7]),e[8]=Math.abs(t[8]),e},s.determinant=function(t){var e=t[0],n=t[3],r=t[6],i=t[1],a=t[4],o=t[7],u=t[2],s=t[5],c=t[8];return e*(a*c-s*o)+i*(s*r-n*c)+u*(n*o-a*r)},s.inverse=function(t,e){var n=t[0],r=t[1],i=t[2],a=t[3],o=t[4],u=t[5],c=t[6],E=t[7],_=t[8],l=s.determinant(t);e[0]=o*_-E*u,e[1]=E*i-r*_,e[2]=r*u-o*i,e[3]=c*u-a*_,e[4]=n*_-c*i,e[5]=a*i-n*u,e[6]=a*E-c*o,e[7]=c*r-n*E,e[8]=n*o-a*r;var f=1/l;return s.multiplyByScalar(e,f,e)},s.equals=function(t,e){return t===e||r(t)&&r(e)&&t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]&&t[3]===e[3]&&t[4]===e[4]&&t[5]===e[5]&&t[6]===e[6]&&t[7]===e[7]&&t[8]===e[8]},s.equalsEpsilon=function(t,e,n){return t===e||r(t)&&r(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&&Math.abs(t[4]-e[4])<=n&&Math.abs(t[5]-e[5])<=n&&Math.abs(t[6]-e[6])<=n&&Math.abs(t[7]-e[7])<=n&&Math.abs(t[8]-e[8])<=n},s.IDENTITY=o(new s(1,0,0,0,1,0,0,0,1)),s.ZERO=o(new s(0,0,0,0,0,0,0,0,0)),s.COLUMN0ROW0=0,s.COLUMN0ROW1=1,s.COLUMN0ROW2=2,s.COLUMN1ROW0=3,s.COLUMN1ROW1=4,s.COLUMN1ROW2=5,s.COLUMN2ROW0=6,s.COLUMN2ROW1=7,s.COLUMN2ROW2=8,i(s.prototype,{length:{get:function(){return s.packedLength}}}),s.prototype.clone=function(t){return s.clone(this,t)},s.prototype.equals=function(t){return s.equals(this,t)},s.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]&&t[4]===e[n+4]&&t[5]===e[n+5]&&t[6]===e[n+6]&&t[7]===e[n+7]&&t[8]===e[n+8]},s.prototype.equalsEpsilon=function(t,e){return s.equalsEpsilon(this,t,e)},s.prototype.toString=function(){return"("+this[0]+", "+this[3]+", "+this[6]+")\n("+this[1]+", "+this[4]+", "+this[7]+")\n("+this[2]+", "+this[5]+", "+this[8]+")"},s}),define("Core/Cartesian4",["./Check","./defaultValue","./defined","./DeveloperError","./freezeObject","./Math"],function(t,e,n,r,i,a){"use strict";function o(t,n,r,i){this.x=e(t,0),this.y=e(n,0),this.z=e(r,0),this.w=e(i,0)}o.fromElements=function(t,e,r,i,a){return n(a)?(a.x=t,a.y=e,a.z=r,a.w=i,a):new o(t,e,r,i)},o.fromColor=function(t,e){return n(e)?(e.x=t.red,e.y=t.green,e.z=t.blue,e.w=t.alpha,e):new o(t.red,t.green,t.blue,t.alpha)},o.clone=function(t,e){if(n(t))return n(e)?(e.x=t.x,e.y=t.y,e.z=t.z,e.w=t.w,e):new o(t.x,t.y,t.z,t.w)},o.packedLength=4,o.pack=function(t,n,r){return r=e(r,0),n[r++]=t.x,n[r++]=t.y,n[r++]=t.z,n[r]=t.w,n},o.unpack=function(t,r,i){return r=e(r,0),n(i)||(i=new o),i.x=t[r++],i.y=t[r++],i.z=t[r++],i.w=t[r],i},o.packArray=function(t,e){var r=t.length;n(e)?e.length=4*r:e=new Array(4*r);for(var i=0;i=0?f.longitude:f.longitude+u.TWO_PI;a=Math.min(a,h),o=Math.max(o,h)}return i-n>o-a&&(n=a,i=o,i>u.PI&&(i-=u.TWO_PI),n>u.PI&&(n-=u.TWO_PI)),r(e)?(e.west=n,e.south=c,e.east=i,e.north=E,e):new s(n,c,i,E)},s.fromCartesianArray=function(t,e,i){e=n(e,a.WGS84);for(var o=Number.MAX_VALUE,c=-Number.MAX_VALUE,E=Number.MAX_VALUE,_=-Number.MAX_VALUE,l=Number.MAX_VALUE,f=-Number.MAX_VALUE,h=0,R=t.length;h=0?T.longitude:T.longitude+u.TWO_PI;E=Math.min(E,d),_=Math.max(_,d)}return c-o>_-E&&(o=E,c=_,c>u.PI&&(c-=u.TWO_PI),o>u.PI&&(o-=u.TWO_PI)),r(i)?(i.west=o,i.south=l,i.east=c,i.north=f,i):new s(o,l,c,f)},s.clone=function(t,e){if(r(t))return r(e)?(e.west=t.west,e.south=t.south,e.east=t.east,e.north=t.north,e):new s(t.west,t.south,t.east,t.north)},s.prototype.clone=function(t){return s.clone(this,t)},s.prototype.equals=function(t){return s.equals(this,t)},s.equals=function(t,e){return t===e||r(t)&&r(e)&&t.west===e.west&&t.south===e.south&&t.east===e.east&&t.north===e.north},s.prototype.equalsEpsilon=function(t,e){return r(t)&&Math.abs(this.west-t.west)<=e&&Math.abs(this.south-t.south)<=e&&Math.abs(this.east-t.east)<=e&&Math.abs(this.north-t.north)<=e},s.validate=function(t){},s.southwest=function(e,n){return r(n)?(n.longitude=e.west,n.latitude=e.south,n.height=0,n):new t(e.west,e.south)},s.northwest=function(e,n){return r(n)?(n.longitude=e.west,n.latitude=e.north,n.height=0,n):new t(e.west,e.north)},s.northeast=function(e,n){return r(n)?(n.longitude=e.east,n.latitude=e.north,n.height=0,n):new t(e.east,e.north)},s.southeast=function(e,n){return r(n)?(n.longitude=e.east,n.latitude=e.south,n.height=0,n):new t(e.east,e.south)},s.center=function(e,n){var i=e.east,a=e.west;i0?i+=u.TWO_PI:o0&&(o+=u.TWO_PI),i=f))return r(n)?(n.west=E,n.south=l,n.east=_,n.north=f,n):new s(E,l,_,f)}},s.simpleIntersection=function(t,e,n){var i=Math.max(t.west,e.west),a=Math.max(t.south,e.south),o=Math.min(t.east,e.east),u=Math.min(t.north,e.north);if(!(a>=u||i>=o))return r(n)?(n.west=i,n.south=a,n.east=o,n.north=u,n):new s(i,a,o,u)},s.union=function(t,e,n){r(n)||(n=new s);var i=t.east,a=t.west,o=e.east,c=e.west;i0?i+=u.TWO_PI:o0&&(o+=u.TWO_PI),ii||u.equalsEpsilon(n,i,u.EPSILON14))&&(n=t.south&&r<=t.north};var c=new t;return s.subsample=function(t,e,i,o){e=n(e,a.WGS84),i=n(i,0),r(o)||(o=[]);var E=0,_=t.north,l=t.south,f=t.east,h=t.west,R=c;R.height=i,R.longitude=h,R.latitude=_,o[E]=e.cartographicToCartesian(R,o[E]),E++,R.longitude=f,o[E]=e.cartographicToCartesian(R,o[E]),E++,R.latitude=l,o[E]=e.cartographicToCartesian(R,o[E]),E++,R.longitude=h,o[E]=e.cartographicToCartesian(R,o[E]),E++,R.latitude=_<0?_:l>0?l:0;for(var T=1;T<8;++T)R.longitude=-Math.PI+T*u.PI_OVER_TWO,s.contains(t,R)&&(o[E]=e.cartographicToCartesian(R,o[E]),E++);return 0===R.latitude&&(R.longitude=h,o[E]=e.cartographicToCartesian(R,o[E]),E++,R.longitude=f,o[E]=e.cartographicToCartesian(R,o[E]),E++),o.length=E,o},s.MAX_VALUE=o(new s(-Math.PI,-u.PI_OVER_TWO,Math.PI,u.PI_OVER_TWO)),s}),define("Core/BoundingSphere",["./Cartesian3","./Cartographic","./Check","./defaultValue","./defined","./Ellipsoid","./GeographicProjection","./Intersect","./Interval","./Matrix3","./Matrix4","./Rectangle"],function(t,e,n,r,i,a,o,u,s,c,E,_){"use strict";function l(e,n){this.center=t.clone(r(e,t.ZERO)),this.radius=r(n,0)}var f=new t,h=new t,R=new t,T=new t,d=new t,A=new t,p=new t,m=new t,N=new t,y=new t,I=new t,S=new t;l.fromPoints=function(e,n){if(i(n)||(n=new l),!i(e)||0===e.length)return n.center=t.clone(t.ZERO,n.center),n.radius=0,n;var r,a=t.clone(e[0],p),o=t.clone(a,f),u=t.clone(a,h),s=t.clone(a,R),c=t.clone(a,T),E=t.clone(a,d),_=t.clone(a,A),O=e.length;for(r=1;rc.x&&t.clone(a,c),wE.y&&t.clone(a,E),C_.z&&t.clone(a,_)}var g=t.magnitudeSquared(t.subtract(c,o,m)),v=t.magnitudeSquared(t.subtract(E,u,m)),P=t.magnitudeSquared(t.subtract(_,s,m)),L=o,F=c,x=g;v>x&&(x=v,L=u,F=E),P>x&&(x=P,L=s,F=_);var U=N;U.x=.5*(L.x+F.x),U.y=.5*(L.y+F.y),U.z=.5*(L.z+F.z);var D=t.magnitudeSquared(t.subtract(F,U,m)),B=Math.sqrt(D),z=y;z.x=o.x,z.y=u.y,z.z=s.z;var b=I;b.x=c.x,b.y=E.y,b.z=_.z;var G=t.multiplyByScalar(t.add(z,b,m),.5,S),V=0;for(r=0;rV&&(V=X);var q=t.magnitudeSquared(t.subtract(a,U,m));if(q>D){var W=Math.sqrt(q);B=.5*(B+W),D=B*B;var H=W-B;U.x=(B*U.x+H*a.x)/W,U.y=(B*U.y+H*a.y)/W,U.z=(B*U.z+H*a.z)/W}}return BO.x&&t.clone(u,O),vM.y&&t.clone(u,M),P<_.z&&t.clone(u,_),P>w.z&&t.clone(u,w)}var L=t.magnitudeSquared(t.subtract(O,c,m)),F=t.magnitudeSquared(t.subtract(M,E,m)),x=t.magnitudeSquared(t.subtract(w,_,m)),U=c,D=O,B=L;F>B&&(B=F,U=E,D=M),x>B&&(B=x,U=_,D=w);var z=N;z.x=.5*(U.x+D.x),z.y=.5*(U.y+D.y),z.z=.5*(U.z+D.z);var b=t.magnitudeSquared(t.subtract(D,z,m)),G=Math.sqrt(b),V=y;V.x=c.x,V.y=E.y,V.z=_.z;var X=I;X.x=O.x,X.y=M.y,X.z=w.z;var q=t.multiplyByScalar(t.add(V,X,m),.5,S),W=0;for(s=0;sW&&(W=H);var k=t.magnitudeSquared(t.subtract(u,z,m));if(k>b){var Y=Math.sqrt(k);G=.5*(G+Y),b=G*G;var K=Y-G;z.x=(G*z.x+K*u.x)/Y,z.y=(G*z.y+K*u.y)/Y,z.z=(G*z.z+K*u.z)/Y}}return GE.x&&t.clone(a,E),C_.y&&t.clone(a,_),gO.z&&t.clone(a,O)}var v=t.magnitudeSquared(t.subtract(E,u,m)),P=t.magnitudeSquared(t.subtract(_,s,m)),L=t.magnitudeSquared(t.subtract(O,c,m)),F=u,x=E,U=v;P>U&&(U=P,F=s,x=_),L>U&&(U=L,F=c,x=O);var D=N;D.x=.5*(F.x+x.x),D.y=.5*(F.y+x.y),D.z=.5*(F.z+x.z);var B=t.magnitudeSquared(t.subtract(x,D,m)),z=Math.sqrt(B),b=y;b.x=u.x,b.y=s.y,b.z=c.z;var G=I;G.x=E.x,G.y=_.y,G.z=O.z;var V=t.multiplyByScalar(t.add(b,G,m),.5,S),X=0;for(o=0;oX&&(X=q);var W=t.magnitudeSquared(t.subtract(a,D,m));if(W>B){var H=Math.sqrt(W);z=.5*(z+H),B=z*z;var k=H-z;D.x=(z*D.x+k*a.x)/H,D.y=(z*D.y+k*a.y)/H,D.z=(z*D.z+k*a.z)/H}}return z=E+s)return e.clone(r),r;if(s>=E+o)return n.clone(r),r;var _=.5*(o+E+s),f=t.multiplyByScalar(c,(-o+_)/E,D);return t.add(f,a,f),t.clone(f,r.center),r.radius=_,r};var B=new t;l.expand=function(e,n,r){r=l.clone(e,r);var i=t.magnitude(t.subtract(n,r.center,B));return i>r.radius&&(r.radius=i),r},l.intersectPlane=function(e,n){var r=e.center,i=e.radius,a=n.normal,o=t.dot(a,r)+n.distance;return o<-i?u.OUTSIDE:o0)n=Math.sqrt(R+1),u=.5*n,n=.5/n,i=(t[s.COLUMN1ROW2]-t[s.COLUMN2ROW1])*n,a=(t[s.COLUMN2ROW0]-t[s.COLUMN0ROW2])*n,o=(t[s.COLUMN0ROW1]-t[s.COLUMN1ROW0])*n;else{var T=_,d=0;f>E&&(d=1),h>E&&h>f&&(d=2);var A=T[d],p=T[A];n=Math.sqrt(t[s.getElementIndex(d,d)]-t[s.getElementIndex(A,A)]-t[s.getElementIndex(p,p)]+1);var m=l;m[d]=.5*n,n=.5/n,u=(t[s.getElementIndex(p,A)]-t[s.getElementIndex(A,p)])*n,m[A]=(t[s.getElementIndex(A,d)]+t[s.getElementIndex(d,A)])*n,m[p]=(t[s.getElementIndex(p,d)]+t[s.getElementIndex(d,p)])*n,i=-m[0],a=-m[1],o=-m[2]}return r(e)?(e.x=i,e.y=a,e.z=o,e.w=u,e):new c(i,a,o,u)};var f=new c,h=new c,R=new c,T=new c;c.fromHeadingPitchRoll=function(e,n){return T=c.fromAxisAngle(t.UNIT_X,e.roll,f),R=c.fromAxisAngle(t.UNIT_Y,-e.pitch,n),n=c.multiply(R,T,R),h=c.fromAxisAngle(t.UNIT_Z,-e.heading,f),c.multiply(h,n,n)};var d=new t,A=new t,p=new c,m=new c,N=new c;c.packedLength=4,c.pack=function(t,e,r){return r=n(r,0),e[r++]=t.x,e[r++]=t.y,e[r++]=t.z,e[r]=t.w,e},c.unpack=function(t,e,i){return e=n(e,0),r(i)||(i=new c),i.x=t[e],i.y=t[e+1],i.z=t[e+2],i.w=t[e+3],i},c.packedInterpolationLength=3,c.convertPackedArrayForInterpolation=function(t,e,n,r){c.unpack(t,4*n,N),c.conjugate(N,N);for(var i=0,a=n-e+1;i=0?i=1:(i=-1,a=-a);for(var o=a-1,u=1-n,s=n*n,E=u*u,_=7;_>=0;--_)x[_]=(L[_]*s-F[_])*o,U[_]=(L[_]*E-F[_])*o;var l=i*n*(1+x[0]*(1+x[1]*(1+x[2]*(1+x[3]*(1+x[4]*(1+x[5]*(1+x[6]*(1+x[7])))))))),f=u*(1+U[0]*(1+U[1]*(1+U[2]*(1+U[3]*(1+U[4]*(1+U[5]*(1+U[6]*(1+U[7])))))))),h=c.multiplyByScalar(t,f,v);return c.multiplyByScalar(e,l,r),c.add(h,r,r)},c.fastSquad=function(t,e,n,r,i,a){var o=c.fastSlerp(t,e,i,C),u=c.fastSlerp(n,r,i,g);return c.fastSlerp(o,u,2*i*(1-i),a)},c.equals=function(t,e){return t===e||r(t)&&r(e)&&t.x===e.x&&t.y===e.y&&t.z===e.z&&t.w===e.w},c.equalsEpsilon=function(t,e,n){return t===e||r(t)&&r(e)&&Math.abs(t.x-e.x)<=n&&Math.abs(t.y-e.y)<=n&&Math.abs(t.z-e.z)<=n&&Math.abs(t.w-e.w)<=n},c.ZERO=a(new c(0,0,0,0)),c.IDENTITY=a(new c(0,0,0,1)),c.prototype.clone=function(t){return c.clone(this,t)},c.prototype.equals=function(t){return c.equals(this,t)},c.prototype.equalsEpsilon=function(t,e){return c.equalsEpsilon(this,t,e)},c.prototype.toString=function(){return"("+this.x+", "+this.y+", "+this.z+", "+this.w+")"},c}),define("Core/VertexFormat",["./defaultValue","./defined","./DeveloperError","./freezeObject"],function(t,e,n,r){"use strict";function i(e){e=t(e,t.EMPTY_OBJECT),this.position=t(e.position,!1),this.normal=t(e.normal,!1),this.st=t(e.st,!1),this.bitangent=t(e.bitangent,!1),this.tangent=t(e.tangent,!1),this.color=t(e.color,!1)}return i.POSITION_ONLY=r(new i({position:!0})),i.POSITION_AND_NORMAL=r(new i({position:!0,normal:!0})),i.POSITION_NORMAL_AND_ST=r(new i({position:!0,normal:!0,st:!0})),i.POSITION_AND_ST=r(new i({position:!0,st:!0})),i.POSITION_AND_COLOR=r(new i({position:!0,color:!0})),i.ALL=r(new i({position:!0,normal:!0,st:!0,tangent:!0,bitangent:!0})),i.DEFAULT=i.POSITION_NORMAL_AND_ST,i.packedLength=6,i.pack=function(e,n,r){return r=t(r,0),n[r++]=e.position?1:0,n[r++]=e.normal?1:0,n[r++]=e.st?1:0,n[r++]=e.tangent?1:0,n[r++]=e.bitangent?1:0,n[r]=e.color?1:0,n},i.unpack=function(n,r,a){return r=t(r,0),e(a)||(a=new i),a.position=1===n[r++],a.normal=1===n[r++],a.st=1===n[r++],a.tangent=1===n[r++],a.bitangent=1===n[r++],a.color=1===n[r],a},i.clone=function(t,n){if(e(t))return e(n)||(n=new i),n.position=t.position,n.normal=t.normal,n.st=t.st,n.tangent=t.tangent,n.bitangent=t.bitangent,n.color=t.color,n},i}),define("Core/FrustumGeometry",["./BoundingSphere","./Cartesian3","./Cartesian4","./Check","./ComponentDatatype","./defaultValue","./defined","./Geometry","./GeometryAttribute","./GeometryAttributes","./Matrix3","./Matrix4","./OrthographicFrustum","./PerspectiveFrustum","./PrimitiveType","./Quaternion","./VertexFormat"],function(t,e,n,r,i,a,o,u,s,c,E,_,l,f,h,R,T){"use strict";function d(t){var n,r,i=t.frustum,o=t.orientation,u=t.origin,s=a(t.vertexFormat,T.DEFAULT),c=a(t._drawNearPlane,!0);i instanceof f?(n=p,r=f.packedLength):i instanceof l&&(n=m,r=l.packedLength),this._frustumType=n,this._frustum=i.clone(),this._origin=e.clone(u),this._orientation=R.clone(o),this._drawNearPlane=c,this._vertexFormat=s,this._workerName="createFrustumGeometry",this.packedLength=2+r+e.packedLength+R.packedLength+T.packedLength}function A(t,e,n,r,i,a,u,s){for(var c=t/3*2,E=0;E<4;++E)o(e)&&(e[t]=a.x,e[t+1]=a.y,e[t+2]=a.z),o(n)&&(n[t]=u.x,n[t+1]=u.y,n[t+2]=u.z),o(r)&&(r[t]=s.x,r[t+1]=s.y,r[t+2]=s.z),t+=3;i[c]=0,i[c+1]=0,i[c+2]=1,i[c+3]=0,i[c+4]=1,i[c+5]=1,i[c+6]=0,i[c+7]=1}var p=0,m=1;d.pack=function(t,n,r){r=a(r,0);var i=t._frustumType,o=t._frustum;return n[r++]=i,i===p?(f.pack(o,n,r),r+=f.packedLength):(l.pack(o,n,r),r+=l.packedLength),e.pack(t._origin,n,r),r+=e.packedLength,R.pack(t._orientation,n,r),r+=R.packedLength,T.pack(t._vertexFormat,n,r),r+=T.packedLength,n[r]=t._drawNearPlane?1:0,n};var N=new f,y=new l,I=new R,S=new e,O=new T;d.unpack=function(t,n,r){n=a(n,0);var i,u=t[n++];u===p?(i=f.unpack(t,n,N),n+=f.packedLength):(i=l.unpack(t,n,y),n+=l.packedLength);var s=e.unpack(t,n,S);n+=e.packedLength;var c=R.unpack(t,n,I);n+=R.packedLength;var E=T.unpack(t,n,O);n+=T.packedLength;var _=1===t[n];if(!o(r))return new d({frustum:i,origin:s,orientation:c,vertexFormat:E,_drawNearPlane:_});var h=u===r._frustumType?r._frustum:void 0;return r._frustum=i.clone(h),r._frustumType=u,r._origin=e.clone(s,r._origin),r._orientation=R.clone(c,r._orientation),r._vertexFormat=T.clone(E,r._vertexFormat),r._drawNearPlane=_,r};var M=new E,w=new _,C=new _,g=new e,v=new e,P=new e,L=new e,F=new e,x=new e,U=new Array(3),D=new Array(4);D[0]=new n(-1,-1,1,1),D[1]=new n(1,-1,1,1),D[2]=new n(1,1,1,1),D[3]=new n(-1,1,1,1);for(var B=new Array(4),z=0;z<4;++z)B[z]=new n;return d._computeNearFarPlanes=function(t,r,i,u,s,c,l,f){var h=E.fromQuaternion(r,M),R=a(c,g),T=a(l,v),d=a(f,P);R=E.getColumn(h,0,R),T=E.getColumn(h,1,T),d=E.getColumn(h,2,d),e.normalize(R,R),e.normalize(T,T),e.normalize(d,d),e.negate(R,R);var A,m,N=_.computeView(t,d,T,R,w);if(i===p){var y=u.projectionMatrix,I=_.multiply(y,N,C);m=_.inverse(I,C)}else A=_.inverseTransformation(N,C);o(m)?(U[0]=u.near,U[1]=u.far):(U[0]=0,U[1]=u.near,U[2]=u.far);for(var S=0;S<2;++S)for(var O=0;O<4;++O){var L=n.clone(D[O],B[O]);if(o(m)){L=_.multiplyByVector(m,L,L);var F=1/L.w;e.multiplyByScalar(L,F,L),e.subtract(L,t,L),e.normalize(L,L);var x=e.dot(d,L);e.multiplyByScalar(L,U[S]/x,L),e.add(L,t,L)}else{o(u._offCenterFrustum)&&(u=u._offCenterFrustum);var z=U[S],b=U[S+1];L.x=.5*(L.x*(u.right-u.left)+u.left+u.right),L.y=.5*(L.y*(u.top-u.bottom)+u.bottom+u.top),L.z=.5*(L.z*(z-b)-z-b),L.w=1,_.multiplyByVector(A,L,L)}s[12*S+3*O]=L.x,s[12*S+3*O+1]=L.y,s[12*S+3*O+2]=L.z}},d.createGeometry=function(n){var r=n._frustumType,a=n._frustum,E=n._origin,_=n._orientation,l=n._drawNearPlane,f=n._vertexFormat,R=l?6:5,T=new Float64Array(72);d._computeNearFarPlanes(E,_,r,a,T);var p=24;T[p]=T[12],T[p+1]=T[13],T[p+2]=T[14],T[p+3]=T[0],T[p+4]=T[1],T[p+5]=T[2],T[p+6]=T[9],T[p+7]=T[10],T[p+8]=T[11],T[p+9]=T[21],T[p+10]=T[22],T[p+11]=T[23],p+=12,T[p]=T[15],T[p+1]=T[16],T[p+2]=T[17],T[p+3]=T[3],T[p+4]=T[4],T[p+5]=T[5],T[p+6]=T[0],T[p+7]=T[1],T[p+8]=T[2],T[p+9]=T[12],T[p+10]=T[13],T[p+11]=T[14],p+=12,T[p]=T[3],T[p+1]=T[4],T[p+2]=T[5],T[p+3]=T[15],T[p+4]=T[16],T[p+5]=T[17],T[p+6]=T[18],T[p+7]=T[19],T[p+8]=T[20],T[p+9]=T[6],T[p+10]=T[7],T[p+11]=T[8],p+=12,T[p]=T[6],T[p+1]=T[7],T[p+2]=T[8],T[p+3]=T[18],T[p+4]=T[19],T[p+5]=T[20],T[p+6]=T[21],T[p+7]=T[22],T[p+8]=T[23],T[p+9]=T[9],T[p+10]=T[10],T[p+11]=T[11],l||(T=T.subarray(12));var m=new c({position:new s({componentDatatype:i.DOUBLE,componentsPerAttribute:3,values:T})});if(o(f.normal)||o(f.tangent)||o(f.bitangent)||o(f.st)){var N=o(f.normal)?new Float32Array(12*R):void 0,y=o(f.tangent)?new Float32Array(12*R):void 0,I=o(f.bitangent)?new Float32Array(12*R):void 0,S=o(f.st)?new Float32Array(8*R):void 0,O=g,M=v,w=P,C=e.negate(O,L),U=e.negate(M,F),D=e.negate(w,x);p=0,l&&(A(p,N,y,I,S,D,O,M),p+=12),A(p,N,y,I,S,w,C,M),p+=12,A(p,N,y,I,S,C,D,M),p+=12,A(p,N,y,I,S,U,D,C),p+=12,A(p,N,y,I,S,O,w,M),p+=12,A(p,N,y,I,S,M,w,C),o(N)&&(m.normal=new s({componentDatatype:i.FLOAT,componentsPerAttribute:3,values:N})),o(y)&&(m.tangent=new s({componentDatatype:i.FLOAT,componentsPerAttribute:3,values:y})),o(I)&&(m.bitangent=new s({componentDatatype:i.FLOAT,componentsPerAttribute:3,values:I})),o(S)&&(m.st=new s({componentDatatype:i.FLOAT,componentsPerAttribute:2,values:S}))}for(var B=new Uint16Array(6*R),z=0;z