/** * 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 e(e){return void 0!==e&&null!==e}return e}),define("Core/DeveloperError",["./defined"],function(e){"use strict";function t(e){this.name="DeveloperError",this.message=e;var t;try{throw new Error}catch(e){t=e.stack}this.stack=t}return e(Object.create)&&(t.prototype=Object.create(Error.prototype),t.prototype.constructor=t),t.prototype.toString=function(){var t=this.name+": "+this.message;return e(this.stack)&&(t+="\n"+this.stack.toString()),t},t.throwInstantiationError=function(){throw new t("This function defines an interface and should not be called directly.")},t}),define("Core/Check",["./defined","./DeveloperError"],function(e,t){"use strict";function n(e){return e+" is required, actual value was undefined"}function r(e,t,n){return"Expected "+n+" to be typeof "+t+", actual typeof was "+e}var a={};return a.typeOf={},a.defined=function(r,a){if(!e(a))throw new t(n(r))},a.typeOf.func=function(e,n){if("function"!=typeof n)throw new t(r(typeof n,"function",e))},a.typeOf.string=function(e,n){if("string"!=typeof n)throw new t(r(typeof n,"string",e))},a.typeOf.number=function(e,n){if("number"!=typeof n)throw new t(r(typeof n,"number",e))},a.typeOf.number.lessThan=function(e,n,r){if(a.typeOf.number(e,n),n>=r)throw new t("Expected "+e+" to be less than "+r+", actual value was "+n)},a.typeOf.number.lessThanOrEquals=function(e,n,r){if(a.typeOf.number(e,n),n>r)throw new t("Expected "+e+" to be less than or equal to "+r+", actual value was "+n)},a.typeOf.number.greaterThan=function(e,n,r){if(a.typeOf.number(e,n),n<=r)throw new t("Expected "+e+" to be greater than "+r+", actual value was "+n)},a.typeOf.number.greaterThanOrEquals=function(e,n,r){if(a.typeOf.number(e,n),n>>0,this.mti=1;this.mti>>30;this.mt[this.mti]=(1812433253*((4294901760&e)>>>16)<<16)+1812433253*(65535&e)+this.mti,this.mt[this.mti]>>>=0}},e.prototype.genrand_int32=function(){var e,t=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^t[1&e];for(;n>>1^t[1&e];e=this.mt[this.N-1]&this.UPPER_MASK|this.mt[0]&this.LOWER_MASK,this.mt[this.N-1]=this.mt[this.M-1]^e>>>1^t[1&e],this.mti=0}return e=this.mt[this.mti++],e^=e>>>11,e^=e<<7&2636928640,e^=e<<15&4022730752,(e^=e>>>18)>>>0},e.prototype.random=function(){return this.genrand_int32()*(1/4294967296)},e}),define("Core/Math",["../ThirdParty/mersenne-twister","./defaultValue","./defined","./DeveloperError"],function(e,t,n,r){"use strict";var a={};a.EPSILON1=.1,a.EPSILON2=.01,a.EPSILON3=.001,a.EPSILON4=1e-4,a.EPSILON5=1e-5,a.EPSILON6=1e-6,a.EPSILON7=1e-7,a.EPSILON8=1e-8,a.EPSILON9=1e-9,a.EPSILON10=1e-10,a.EPSILON11=1e-11,a.EPSILON12=1e-12,a.EPSILON13=1e-13,a.EPSILON14=1e-14,a.EPSILON15=1e-15,a.EPSILON16=1e-16,a.EPSILON17=1e-17,a.EPSILON18=1e-18,a.EPSILON19=1e-19,a.EPSILON20=1e-20,a.GRAVITATIONALPARAMETER=3986004418e5,a.SOLAR_RADIUS=6955e5,a.LUNAR_RADIUS=1737400,a.SIXTY_FOUR_KILOBYTES=65536,a.sign=function(e){return e>0?1:e<0?-1:0},a.signNotZero=function(e){return e<0?-1:1},a.toSNorm=function(e,n){return n=t(n,255),Math.round((.5*a.clamp(e,-1,1)+.5)*n)},a.fromSNorm=function(e,n){return n=t(n,255),a.clamp(e,0,n)/n*2-1},a.sinh=function(e){return.5*(Math.pow(Math.E,e)-Math.pow(Math.E,-1*e))},a.cosh=function(e){return.5*(Math.pow(Math.E,e)+Math.pow(Math.E,-1*e))},a.lerp=function(e,t,n){return(1-n)*e+n*t},a.PI=Math.PI,a.ONE_OVER_PI=1/Math.PI,a.PI_OVER_TWO=.5*Math.PI,a.PI_OVER_THREE=Math.PI/3,a.PI_OVER_FOUR=Math.PI/4,a.PI_OVER_SIX=Math.PI/6,a.THREE_PI_OVER_TWO=3*Math.PI*.5,a.TWO_PI=2*Math.PI,a.ONE_OVER_TWO_PI=1/(2*Math.PI),a.RADIANS_PER_DEGREE=Math.PI/180,a.DEGREES_PER_RADIAN=180/Math.PI,a.RADIANS_PER_ARCSECOND=a.RADIANS_PER_DEGREE/3600,a.toRadians=function(e){return e*a.RADIANS_PER_DEGREE},a.toDegrees=function(e){return e*a.DEGREES_PER_RADIAN},a.convertLongitudeRange=function(e){var t=a.TWO_PI,n=e-Math.floor(e/t)*t;return n<-Math.PI?n+t:n>=Math.PI?n-t:n},a.clampToLatitudeRange=function(e){return a.clamp(e,-1*a.PI_OVER_TWO,a.PI_OVER_TWO)},a.negativePiToPi=function(e){return a.zeroToTwoPi(e+a.PI)-a.PI},a.zeroToTwoPi=function(e){var t=a.mod(e,a.TWO_PI);return Math.abs(t)a.EPSILON14?a.TWO_PI:t},a.mod=function(e,t){return(e%t+t)%t},a.equalsEpsilon=function(e,n,r,a){a=t(a,r);var i=Math.abs(e-n);return i<=a||i<=r*Math.max(Math.abs(e),Math.abs(n))};var i=[1];a.factorial=function(e){var t=i.length;if(e>=t)for(var n=i[t-1],r=t;r<=e;r++)i.push(n*r);return i[e]},a.incrementWrap=function(e,n,r){return r=t(r,0),++e,e>n&&(e=r),e},a.isPowerOfTwo=function(e){return 0!==e&&0==(e&e-1)},a.nextPowerOfTwo=function(e){return--e,e|=e>>1,e|=e>>2,e|=e>>4,e|=e>>8,e|=e>>16,++e},a.clamp=function(e,t,n){return en?n:e};var o=new e;return a.setRandomNumberSeed=function(t){o=new e(t)},a.nextRandomNumber=function(){return o.random()},a.randomBetween=function(e,t){return a.nextRandomNumber()*(t-e)+e},a.acosClamped=function(e){return Math.acos(a.clamp(e,-1,1))},a.asinClamped=function(e){return Math.asin(a.clamp(e,-1,1))},a.chordLength=function(e,t){return 2*t*Math.sin(.5*e)},a.logBase=function(e,t){return Math.log(e)/Math.log(t)},a.fog=function(e,t){var n=e*t;return 1-Math.exp(-n*n)},a}),define("Core/Cartesian3",["./Check","./defaultValue","./defined","./DeveloperError","./freezeObject","./Math"],function(e,t,n,r,a,i){"use strict";function o(e,n,r){this.x=t(e,0),this.y=t(n,0),this.z=t(r,0)}o.fromSpherical=function(e,r){n(r)||(r=new o);var a=e.clock,i=e.cone,u=t(e.magnitude,1),s=u*Math.sin(i);return r.x=s*Math.cos(a),r.y=s*Math.sin(a),r.z=u*Math.cos(i),r},o.fromElements=function(e,t,r,a){return n(a)?(a.x=e,a.y=t,a.z=r,a):new o(e,t,r)},o.clone=function(e,t){if(n(e))return n(t)?(t.x=e.x,t.y=e.y,t.z=e.z,t):new o(e.x,e.y,e.z)},o.fromCartesian4=o.clone,o.packedLength=3,o.pack=function(e,n,r){return r=t(r,0),n[r++]=e.x,n[r++]=e.y,n[r]=e.z,n},o.unpack=function(e,r,a){return r=t(r,0),n(a)||(a=new o),a.x=e[r++],a.y=e[r++],a.z=e[r],a},o.packArray=function(e,t){var r=e.length;n(t)?t.length=3*r:t=new Array(3*r);for(var a=0;ar.EPSILON12);return t(c)?(c.x=l*O,c.y=E*x,c.z=f*w,c):new e(l*O,E*x,f*w)}var i=new e,o=new e;return a}),define("Core/Cartographic",["./Cartesian3","./Check","./defaultValue","./defined","./freezeObject","./Math","./scaleToGeodeticSurface"],function(e,t,n,r,a,i,o){"use strict";function u(e,t,r){this.longitude=n(e,0),this.latitude=n(t,0),this.height=n(r,0)}u.fromRadians=function(e,t,a,i){return a=n(a,0),r(i)?(i.longitude=e,i.latitude=t,i.height=a,i):new u(e,t,a)},u.fromDegrees=function(e,t,n,r){return e=i.toRadians(e),t=i.toRadians(t),u.fromRadians(e,t,n,r)};var s=new e,c=new e,l=new e,E=new e(1/6378137,1/6378137,1/6356752.314245179),f=new e(1/40680631590769,1/40680631590769,1/40408299984661.445),h=i.EPSILON1;return u.fromCartesian=function(t,n,a){var d=r(n)?n.oneOverRadii:E,p=r(n)?n.oneOverRadiiSquared:f,y=r(n)?n._centerToleranceSquared:h,_=o(t,d,p,y,c);if(r(_)){var m=e.multiplyComponents(_,p,s);m=e.normalize(m,m);var T=e.subtract(t,_,l),R=Math.atan2(m.y,m.x),A=Math.asin(m.z),v=i.sign(e.dot(T,t))*e.magnitude(T);return r(a)?(a.longitude=R,a.latitude=A,a.height=v,a):new u(R,A,v)}},u.clone=function(e,t){if(r(e))return r(t)?(t.longitude=e.longitude,t.latitude=e.latitude,t.height=e.height,t):new u(e.longitude,e.latitude,e.height)},u.equals=function(e,t){return e===t||r(e)&&r(t)&&e.longitude===t.longitude&&e.latitude===t.latitude&&e.height===t.height},u.equalsEpsilon=function(e,t,n){return e===t||r(e)&&r(t)&&Math.abs(e.longitude-t.longitude)<=n&&Math.abs(e.latitude-t.latitude)<=n&&Math.abs(e.height-t.height)<=n},u.ZERO=a(new u(0,0,0)),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){return u.equalsEpsilon(this,e,t)},u.prototype.toString=function(){return"("+this.longitude+", "+this.latitude+", "+this.height+")"},u}),define("Core/defineProperties",["./defined"],function(e){"use strict";var t=function(){try{return"x"in Object.defineProperty({},"x",{})}catch(e){return!1}}(),n=Object.defineProperties;return t&&e(n)||(n=function(e){return e}),n}),define("Core/Ellipsoid",["./Cartesian3","./Cartographic","./Check","./defaultValue","./defined","./defineProperties","./DeveloperError","./freezeObject","./Math","./scaleToGeodeticSurface"],function(e,t,n,r,a,i,o,u,s,c){"use strict";function l(t,n,a,i){n=r(n,0),a=r(a,0),i=r(i,0),t._radii=new e(n,a,i),t._radiiSquared=new e(n*n,a*a,i*i),t._radiiToTheFourth=new e(n*n*n*n,a*a*a*a,i*i*i*i),t._oneOverRadii=new e(0===n?0:1/n,0===a?0:1/a,0===i?0:1/i),t._oneOverRadiiSquared=new e(0===n?0:1/(n*n),0===a?0:1/(a*a),0===i?0:1/(i*i)),t._minimumRadius=Math.min(n,a,i),t._maximumRadius=Math.max(n,a,i),t._centerToleranceSquared=s.EPSILON1,0!==t._radiiSquared.z&&(t._squaredXOverSquaredZ=t._radiiSquared.x/t._radiiSquared.z)}function E(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,l(this,e,t,n)}i(E.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}}}),E.clone=function(t,n){if(a(t)){var r=t._radii;return a(n)?(e.clone(r,n._radii),e.clone(t._radiiSquared,n._radiiSquared),e.clone(t._radiiToTheFourth,n._radiiToTheFourth),e.clone(t._oneOverRadii,n._oneOverRadii),e.clone(t._oneOverRadiiSquared,n._oneOverRadiiSquared),n._minimumRadius=t._minimumRadius,n._maximumRadius=t._maximumRadius,n._centerToleranceSquared=t._centerToleranceSquared,n):new E(r.x,r.y,r.z)}},E.fromCartesian3=function(e,t){return a(t)||(t=new E),a(e)?(l(t,e.x,e.y,e.z),t):t},E.WGS84=u(new E(6378137,6378137,6356752.314245179)),E.UNIT_SPHERE=u(new E(1,1,1)),E.MOON=u(new E(s.LUNAR_RADIUS,s.LUNAR_RADIUS,s.LUNAR_RADIUS)),E.prototype.clone=function(e){return E.clone(this,e)},E.packedLength=e.packedLength,E.pack=function(t,n,a){return a=r(a,0),e.pack(t._radii,n,a),n},E.unpack=function(t,n,a){n=r(n,0);var i=e.unpack(t,n);return E.fromCartesian3(i,a)},E.prototype.geocentricSurfaceNormal=e.normalize,E.prototype.geodeticSurfaceNormalCartographic=function(t,n){var r=t.longitude,i=t.latitude,o=Math.cos(i),u=o*Math.cos(r),s=o*Math.sin(r),c=Math.sin(i);return a(n)||(n=new e),n.x=u,n.y=s,n.z=c,e.normalize(n,n)},E.prototype.geodeticSurfaceNormal=function(t,n){return a(n)||(n=new e),n=e.multiplyComponents(t,this._oneOverRadiiSquared,n),e.normalize(n,n)};var f=new e,h=new e;E.prototype.cartographicToCartesian=function(t,n){var r=f,i=h;this.geodeticSurfaceNormalCartographic(t,r),e.multiplyComponents(this._radiiSquared,r,i);var o=Math.sqrt(e.dot(r,i));return e.divideByScalar(i,o,i),e.multiplyByScalar(r,t.height,r),a(n)||(n=new e),e.add(i,r,n)},E.prototype.cartographicArrayToCartesianArray=function(e,t){var n=e.length;a(t)?t.length=n:t=new Array(n);for(var r=0;r=this._radii.z-n))return i},E}),define("Core/Rectangle",["./Cartographic","./Check","./defaultValue","./defined","./defineProperties","./Ellipsoid","./freezeObject","./Math"],function(e,t,n,r,a,i,o,u){"use strict";function s(e,t,r,a){this.west=n(e,0),this.south=n(t,0),this.east=n(r,0),this.north=n(a,0)}a(s.prototype,{width:{get:function(){return s.computeWidth(this)}},height:{get:function(){return s.computeHeight(this)}}}),s.packedLength=4,s.pack=function(e,t,r){return r=n(r,0),t[r++]=e.west,t[r++]=e.south,t[r++]=e.east,t[r]=e.north,t},s.unpack=function(e,t,a){return t=n(t,0),r(a)||(a=new s),a.west=e[t++],a.south=e[t++],a.east=e[t++],a.north=e[t],a},s.computeWidth=function(e){var t=e.east,n=e.west;return t=0?h.longitude:h.longitude+u.TWO_PI;i=Math.min(i,d),o=Math.max(o,d)}return a-n>o-i&&(n=i,a=o,a>u.PI&&(a-=u.TWO_PI),n>u.PI&&(n-=u.TWO_PI)),r(t)?(t.west=n,t.south=c,t.east=a,t.north=l,t):new s(n,c,a,l)},s.fromCartesianArray=function(e,t,a){t=n(t,i.WGS84);for(var o=Number.MAX_VALUE,c=-Number.MAX_VALUE,l=Number.MAX_VALUE,E=-Number.MAX_VALUE,f=Number.MAX_VALUE,h=-Number.MAX_VALUE,d=0,p=e.length;d=0?y.longitude:y.longitude+u.TWO_PI;l=Math.min(l,_),E=Math.max(E,_)}return c-o>E-l&&(o=l,c=E,c>u.PI&&(c-=u.TWO_PI),o>u.PI&&(o-=u.TWO_PI)),r(a)?(a.west=o,a.south=f,a.east=c,a.north=h,a):new s(o,f,c,h)},s.clone=function(e,t){if(r(e))return r(t)?(t.west=e.west,t.south=e.south,t.east=e.east,t.north=e.north,t):new s(e.west,e.south,e.east,e.north)},s.prototype.clone=function(e){return s.clone(this,e)},s.prototype.equals=function(e){return s.equals(this,e)},s.equals=function(e,t){return e===t||r(e)&&r(t)&&e.west===t.west&&e.south===t.south&&e.east===t.east&&e.north===t.north},s.prototype.equalsEpsilon=function(e,t){return r(e)&&Math.abs(this.west-e.west)<=t&&Math.abs(this.south-e.south)<=t&&Math.abs(this.east-e.east)<=t&&Math.abs(this.north-e.north)<=t},s.validate=function(e){},s.southwest=function(t,n){return r(n)?(n.longitude=t.west,n.latitude=t.south,n.height=0,n):new e(t.west,t.south)},s.northwest=function(t,n){return r(n)?(n.longitude=t.west,n.latitude=t.north,n.height=0,n):new e(t.west,t.north)},s.northeast=function(t,n){return r(n)?(n.longitude=t.east,n.latitude=t.north,n.height=0,n):new e(t.east,t.north)},s.southeast=function(t,n){return r(n)?(n.longitude=t.east,n.latitude=t.south,n.height=0,n):new e(t.east,t.south)},s.center=function(t,n){var a=t.east,i=t.west;a0?a+=u.TWO_PI:o0&&(o+=u.TWO_PI),a=h))return r(n)?(n.west=l,n.south=f,n.east=E,n.north=h,n):new s(l,f,E,h)}},s.simpleIntersection=function(e,t,n){var a=Math.max(e.west,t.west),i=Math.max(e.south,t.south),o=Math.min(e.east,t.east),u=Math.min(e.north,t.north);if(!(i>=u||a>=o))return r(n)?(n.west=a,n.south=i,n.east=o,n.north=u,n):new s(a,i,o,u)},s.union=function(e,t,n){r(n)||(n=new s);var a=e.east,i=e.west,o=t.east,c=t.west;a0?a+=u.TWO_PI:o0&&(o+=u.TWO_PI),aa||u.equalsEpsilon(n,a,u.EPSILON14))&&(n=e.south&&r<=e.north};var c=new e;return s.subsample=function(e,t,a,o){t=n(t,i.WGS84),a=n(a,0),r(o)||(o=[]);var l=0,E=e.north,f=e.south,h=e.east,d=e.west,p=c;p.height=a,p.longitude=d,p.latitude=E,o[l]=t.cartographicToCartesian(p,o[l]),l++,p.longitude=h,o[l]=t.cartographicToCartesian(p,o[l]),l++,p.latitude=f,o[l]=t.cartographicToCartesian(p,o[l]),l++,p.longitude=d,o[l]=t.cartographicToCartesian(p,o[l]),l++,p.latitude=E<0?E:f>0?f:0;for(var y=1;y<8;++y)p.longitude=-Math.PI+y*u.PI_OVER_TWO,s.contains(e,p)&&(o[l]=t.cartographicToCartesian(p,o[l]),l++);return 0===p.latitude&&(p.longitude=d,o[l]=t.cartographicToCartesian(p,o[l]),l++,p.longitude=h,o[l]=t.cartographicToCartesian(p,o[l]),l++),o.length=l,o},s.MAX_VALUE=o(new s(-Math.PI,-u.PI_OVER_TWO,Math.PI,u.PI_OVER_TWO)),s}),define("Core/GeographicProjection",["./Cartesian3","./Cartographic","./defaultValue","./defined","./defineProperties","./DeveloperError","./Ellipsoid"],function(e,t,n,r,a,i,o){"use strict";function u(e){this._ellipsoid=n(e,o.WGS84),this._semimajorAxis=this._ellipsoid.maximumRadius,this._oneOverSemimajorAxis=1/this._semimajorAxis}return a(u.prototype,{ellipsoid:{get:function(){return this._ellipsoid}}}),u.prototype.project=function(t,n){var a=this._semimajorAxis,i=t.longitude*a,o=t.latitude*a,u=t.height;return r(n)?(n.x=i,n.y=o,n.z=u,n):new e(i,o,u)},u.prototype.unproject=function(e,n){var a=this._oneOverSemimajorAxis,i=e.x*a,o=e.y*a,u=e.z;return r(n)?(n.longitude=i,n.latitude=o,n.height=u,n):new t(i,o,u)},u}),define("Core/Intersect",["./freezeObject"],function(e){"use strict";return e({OUTSIDE:-1,INTERSECTING:0,INSIDE:1})}),define("Core/Interval",["./defaultValue"],function(e){"use strict";function t(t,n){this.start=e(t,0),this.stop=e(n,0)}return t}),define("Core/Matrix3",["./Cartesian3","./Check","./defaultValue","./defined","./defineProperties","./DeveloperError","./freezeObject","./Math"],function(e,t,n,r,a,i,o,u){"use strict";function s(e,t,r,a,i,o,u,s,c){this[0]=n(e,0),this[1]=n(a,0),this[2]=n(u,0),this[3]=n(t,0),this[4]=n(i,0),this[5]=n(s,0),this[6]=n(r,0),this[7]=n(o,0),this[8]=n(c,0)}function c(e){for(var t=0,n=0;n<9;++n){var r=e[n];t+=r*r}return Math.sqrt(t)}function l(e){for(var t=0,n=0;n<3;++n){var r=e[s.getElementIndex(p[n],d[n])];t+=2*r*r}return Math.sqrt(t)}function E(e,t){for(var n=u.EPSILON15,r=0,a=1,i=0;i<3;++i){var o=Math.abs(e[s.getElementIndex(p[i],d[i])]);o>r&&(a=i,r=o)}var c=1,l=0,E=d[a],f=p[a];if(Math.abs(e[s.getElementIndex(f,E)])>n){var h,y=e[s.getElementIndex(f,f)],_=e[s.getElementIndex(E,E)],m=e[s.getElementIndex(f,E)],T=(y-_)/2/m;h=T<0?-1/(-T+Math.sqrt(1+T*T)):1/(T+Math.sqrt(1+T*T)),c=1/Math.sqrt(1+h*h),l=h*c}return t=s.clone(s.IDENTITY,t),t[s.getElementIndex(E,E)]=t[s.getElementIndex(f,f)]=c,t[s.getElementIndex(f,E)]=l,t[s.getElementIndex(E,f)]=-l,t}s.packedLength=9,s.pack=function(e,t,r){return r=n(r,0),t[r++]=e[0],t[r++]=e[1],t[r++]=e[2],t[r++]=e[3],t[r++]=e[4],t[r++]=e[5],t[r++]=e[6],t[r++]=e[7],t[r++]=e[8],t},s.unpack=function(e,t,a){return t=n(t,0),r(a)||(a=new s),a[0]=e[t++],a[1]=e[t++],a[2]=e[t++],a[3]=e[t++],a[4]=e[t++],a[5]=e[t++],a[6]=e[t++],a[7]=e[t++],a[8]=e[t++],a},s.clone=function(e,t){if(r(e))return r(t)?(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],t):new s(e[0],e[3],e[6],e[1],e[4],e[7],e[2],e[5],e[8])},s.fromArray=function(e,t,a){return t=n(t,0),r(a)||(a=new s),a[0]=e[t],a[1]=e[t+1],a[2]=e[t+2],a[3]=e[t+3],a[4]=e[t+4],a[5]=e[t+5],a[6]=e[t+6],a[7]=e[t+7],a[8]=e[t+8],a},s.fromColumnMajorArray=function(e,t){return s.clone(e,t)},s.fromRowMajorArray=function(e,t){return r(t)?(t[0]=e[0],t[1]=e[3],t[2]=e[6],t[3]=e[1],t[4]=e[4],t[5]=e[7],t[6]=e[2],t[7]=e[5],t[8]=e[8],t):new s(e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8])},s.fromQuaternion=function(e,t){var n=e.x*e.x,a=e.x*e.y,i=e.x*e.z,o=e.x*e.w,u=e.y*e.y,c=e.y*e.z,l=e.y*e.w,E=e.z*e.z,f=e.z*e.w,h=e.w*e.w,d=n-u-E+h,p=2*(a-f),y=2*(i+l),_=2*(a+f),m=-n+u-E+h,T=2*(c-o),R=2*(i-l),A=2*(c+o),v=-n-u+E+h;return r(t)?(t[0]=d,t[1]=_,t[2]=R,t[3]=p,t[4]=m,t[5]=A,t[6]=y,t[7]=T,t[8]=v,t):new s(d,p,y,_,m,T,R,A,v)},s.fromHeadingPitchRoll=function(e,t){var n=Math.cos(-e.pitch),a=Math.cos(-e.heading),i=Math.cos(e.roll),o=Math.sin(-e.pitch),u=Math.sin(-e.heading),c=Math.sin(e.roll),l=n*a,E=-i*u+c*o*a,f=c*u+i*o*a,h=n*u,d=i*a+c*o*u,p=-c*a+i*o*u,y=-o,_=c*n,m=i*n;return r(t)?(t[0]=l,t[1]=h,t[2]=y,t[3]=E,t[4]=d,t[5]=_,t[6]=f,t[7]=p,t[8]=m,t):new s(l,E,f,h,d,p,y,_,m)},s.fromScale=function(e,t){return r(t)?(t[0]=e.x,t[1]=0,t[2]=0,t[3]=0,t[4]=e.y,t[5]=0,t[6]=0,t[7]=0,t[8]=e.z,t):new s(e.x,0,0,0,e.y,0,0,0,e.z)},s.fromUniformScale=function(e,t){return r(t)?(t[0]=e,t[1]=0,t[2]=0,t[3]=0,t[4]=e,t[5]=0,t[6]=0,t[7]=0,t[8]=e,t):new s(e,0,0,0,e,0,0,0,e)},s.fromCrossProduct=function(e,t){return r(t)?(t[0]=0,t[1]=e.z,t[2]=-e.y,t[3]=-e.z,t[4]=0,t[5]=e.x,t[6]=e.y,t[7]=-e.x,t[8]=0,t):new s(0,-e.z,e.y,e.z,0,-e.x,-e.y,e.x,0)},s.fromRotationX=function(e,t){var n=Math.cos(e),a=Math.sin(e);return r(t)?(t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=n,t[5]=a,t[6]=0,t[7]=-a,t[8]=n,t):new s(1,0,0,0,n,-a,0,a,n)},s.fromRotationY=function(e,t){var n=Math.cos(e),a=Math.sin(e);return r(t)?(t[0]=n,t[1]=0,t[2]=-a,t[3]=0,t[4]=1,t[5]=0,t[6]=a,t[7]=0,t[8]=n,t):new s(n,0,a,0,1,0,-a,0,n)},s.fromRotationZ=function(e,t){var n=Math.cos(e),a=Math.sin(e);return r(t)?(t[0]=n,t[1]=a,t[2]=0,t[3]=-a,t[4]=n,t[5]=0,t[6]=0,t[7]=0,t[8]=1,t):new s(n,-a,0,a,n,0,0,0,1)},s.toArray=function(e,t){return r(t)?(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],t):[e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8]]},s.getElementIndex=function(e,t){return 3*e+t},s.getColumn=function(e,t,n){var r=3*t,a=e[r],i=e[r+1],o=e[r+2];return n.x=a,n.y=i,n.z=o,n},s.setColumn=function(e,t,n,r){r=s.clone(e,r);var a=3*t;return r[a]=n.x,r[a+1]=n.y,r[a+2]=n.z,r},s.getRow=function(e,t,n){var r=e[t],a=e[t+3],i=e[t+6];return n.x=r,n.y=a,n.z=i,n},s.setRow=function(e,t,n,r){return r=s.clone(e,r),r[t]=n.x,r[t+3]=n.y,r[t+6]=n.z,r};var f=new e;s.getScale=function(t,n){return n.x=e.magnitude(e.fromElements(t[0],t[1],t[2],f)),n.y=e.magnitude(e.fromElements(t[3],t[4],t[5],f)),n.z=e.magnitude(e.fromElements(t[6],t[7],t[8],f)),n};var h=new e;s.getMaximumScale=function(t){return s.getScale(t,h),e.maximumComponent(h)},s.multiply=function(e,t,n){var r=e[0]*t[0]+e[3]*t[1]+e[6]*t[2],a=e[1]*t[0]+e[4]*t[1]+e[7]*t[2],i=e[2]*t[0]+e[5]*t[1]+e[8]*t[2],o=e[0]*t[3]+e[3]*t[4]+e[6]*t[5],u=e[1]*t[3]+e[4]*t[4]+e[7]*t[5],s=e[2]*t[3]+e[5]*t[4]+e[8]*t[5],c=e[0]*t[6]+e[3]*t[7]+e[6]*t[8],l=e[1]*t[6]+e[4]*t[7]+e[7]*t[8],E=e[2]*t[6]+e[5]*t[7]+e[8]*t[8];return n[0]=r,n[1]=a,n[2]=i,n[3]=o,n[4]=u,n[5]=s,n[6]=c,n[7]=l,n[8]=E,n},s.add=function(e,t,n){return n[0]=e[0]+t[0],n[1]=e[1]+t[1],n[2]=e[2]+t[2],n[3]=e[3]+t[3],n[4]=e[4]+t[4],n[5]=e[5]+t[5],n[6]=e[6]+t[6],n[7]=e[7]+t[7],n[8]=e[8]+t[8],n},s.subtract=function(e,t,n){return n[0]=e[0]-t[0],n[1]=e[1]-t[1],n[2]=e[2]-t[2],n[3]=e[3]-t[3],n[4]=e[4]-t[4],n[5]=e[5]-t[5],n[6]=e[6]-t[6],n[7]=e[7]-t[7],n[8]=e[8]-t[8],n},s.multiplyByVector=function(e,t,n){var r=t.x,a=t.y,i=t.z,o=e[0]*r+e[3]*a+e[6]*i,u=e[1]*r+e[4]*a+e[7]*i,s=e[2]*r+e[5]*a+e[8]*i;return n.x=o,n.y=u,n.z=s,n},s.multiplyByScalar=function(e,t,n){return n[0]=e[0]*t,n[1]=e[1]*t,n[2]=e[2]*t,n[3]=e[3]*t,n[4]=e[4]*t,n[5]=e[5]*t,n[6]=e[6]*t,n[7]=e[7]*t,n[8]=e[8]*t,n},s.multiplyByScale=function(e,t,n){return n[0]=e[0]*t.x,n[1]=e[1]*t.x,n[2]=e[2]*t.x,n[3]=e[3]*t.y,n[4]=e[4]*t.y,n[5]=e[5]*t.y,n[6]=e[6]*t.z,n[7]=e[7]*t.z,n[8]=e[8]*t.z,n},s.negate=function(e,t){return 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],t},s.transpose=function(e,t){var n=e[0],r=e[3],a=e[6],i=e[1],o=e[4],u=e[7],s=e[2],c=e[5],l=e[8];return t[0]=n,t[1]=r,t[2]=a,t[3]=i,t[4]=o,t[5]=u,t[6]=s,t[7]=c,t[8]=l,t};var d=[1,0,0],p=[2,2,1],y=new s,_=new s;return s.computeEigenDecomposition=function(e,t){var n=u.EPSILON20,a=0,i=0;r(t)||(t={});for(var o=t.unitary=s.clone(s.IDENTITY,t.unitary),f=t.diagonal=s.clone(e,t.diagonal),h=n*c(f);i<10&&l(f)>h;)E(f,y),s.transpose(y,_),s.multiply(f,y,f),s.multiply(_,f,f),s.multiply(o,y,o),++a>2&&(++i,a=0);return t},s.abs=function(e,t){return t[0]=Math.abs(e[0]),t[1]=Math.abs(e[1]),t[2]=Math.abs(e[2]),t[3]=Math.abs(e[3]),t[4]=Math.abs(e[4]),t[5]=Math.abs(e[5]),t[6]=Math.abs(e[6]),t[7]=Math.abs(e[7]),t[8]=Math.abs(e[8]),t},s.determinant=function(e){var t=e[0],n=e[3],r=e[6],a=e[1],i=e[4],o=e[7],u=e[2],s=e[5],c=e[8];return t*(i*c-s*o)+a*(s*r-n*c)+u*(n*o-i*r)},s.inverse=function(e,t){ var n=e[0],r=e[1],a=e[2],i=e[3],o=e[4],u=e[5],c=e[6],l=e[7],E=e[8],f=s.determinant(e);t[0]=o*E-l*u,t[1]=l*a-r*E,t[2]=r*u-o*a,t[3]=c*u-i*E,t[4]=n*E-c*a,t[5]=i*a-n*u,t[6]=i*l-c*o,t[7]=c*r-n*l,t[8]=n*o-i*r;var h=1/f;return s.multiplyByScalar(t,h,t)},s.equals=function(e,t){return e===t||r(e)&&r(t)&&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]},s.equalsEpsilon=function(e,t,n){return e===t||r(e)&&r(t)&&Math.abs(e[0]-t[0])<=n&&Math.abs(e[1]-t[1])<=n&&Math.abs(e[2]-t[2])<=n&&Math.abs(e[3]-t[3])<=n&&Math.abs(e[4]-t[4])<=n&&Math.abs(e[5]-t[5])<=n&&Math.abs(e[6]-t[6])<=n&&Math.abs(e[7]-t[7])<=n&&Math.abs(e[8]-t[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,a(s.prototype,{length:{get:function(){return s.packedLength}}}),s.prototype.clone=function(e){return s.clone(this,e)},s.prototype.equals=function(e){return s.equals(this,e)},s.equalsArray=function(e,t,n){return e[0]===t[n]&&e[1]===t[n+1]&&e[2]===t[n+2]&&e[3]===t[n+3]&&e[4]===t[n+4]&&e[5]===t[n+5]&&e[6]===t[n+6]&&e[7]===t[n+7]&&e[8]===t[n+8]},s.prototype.equalsEpsilon=function(e,t){return s.equalsEpsilon(this,e,t)},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(e,t,n,r,a,i){"use strict";function o(e,n,r,a){this.x=t(e,0),this.y=t(n,0),this.z=t(r,0),this.w=t(a,0)}o.fromElements=function(e,t,r,a,i){return n(i)?(i.x=e,i.y=t,i.z=r,i.w=a,i):new o(e,t,r,a)},o.fromColor=function(e,t){return n(t)?(t.x=e.red,t.y=e.green,t.z=e.blue,t.w=e.alpha,t):new o(e.red,e.green,e.blue,e.alpha)},o.clone=function(e,t){if(n(e))return n(t)?(t.x=e.x,t.y=e.y,t.z=e.z,t.w=e.w,t):new o(e.x,e.y,e.z,e.w)},o.packedLength=4,o.pack=function(e,n,r){return r=t(r,0),n[r++]=e.x,n[r++]=e.y,n[r++]=e.z,n[r]=e.w,n},o.unpack=function(e,r,a){return r=t(r,0),n(a)||(a=new o),a.x=e[r++],a.y=e[r++],a.z=e[r++],a.w=e[r],a},o.packArray=function(e,t){var r=e.length;n(t)?t.length=4*r:t=new Array(4*r);for(var a=0;ac.x&&e.clone(i,c),Ml.y&&e.clone(i,l),OE.z&&e.clone(i,E)}var x=e.magnitudeSquared(e.subtract(c,o,R)),w=e.magnitudeSquared(e.subtract(l,u,R)),C=e.magnitudeSquared(e.subtract(E,s,R)),P=o,L=c,b=x;w>b&&(b=w,P=u,L=l),C>b&&(b=C,P=s,L=E);var U=A;U.x=.5*(P.x+L.x),U.y=.5*(P.y+L.y),U.z=.5*(P.z+L.z);var F=e.magnitudeSquared(e.subtract(L,U,R)),D=Math.sqrt(F),B=v;B.x=o.x,B.y=u.y,B.z=s.z;var z=S;z.x=c.x,z.y=l.y,z.z=E.z;var G=e.multiplyByScalar(e.add(B,z,R),.5,N),q=0;for(r=0;rq&&(q=V);var X=e.magnitudeSquared(e.subtract(i,U,R));if(X>F){var W=Math.sqrt(X);D=.5*(D+W),F=D*D;var H=W-D;U.x=(D*U.x+H*i.x)/W,U.y=(D*U.y+H*i.y)/W,U.z=(D*U.z+H*i.z)/W}}return Dg.x&&e.clone(u,g),wI.y&&e.clone(u,I),CM.z&&e.clone(u,M)}var P=e.magnitudeSquared(e.subtract(g,c,R)),L=e.magnitudeSquared(e.subtract(I,l,R)),b=e.magnitudeSquared(e.subtract(M,E,R)),U=c,F=g,D=P;L>D&&(D=L,U=l,F=I),b>D&&(D=b,U=E,F=M);var B=A;B.x=.5*(U.x+F.x),B.y=.5*(U.y+F.y),B.z=.5*(U.z+F.z);var z=e.magnitudeSquared(e.subtract(F,B,R)),G=Math.sqrt(z),q=v;q.x=c.x,q.y=l.y,q.z=E.z;var V=S;V.x=g.x,V.y=I.y,V.z=M.z;var X=e.multiplyByScalar(e.add(q,V,R),.5,N),W=0;for(s=0;sW&&(W=H);var Y=e.magnitudeSquared(e.subtract(u,B,R));if(Y>z){var k=Math.sqrt(Y);G=.5*(G+k),z=G*G;var Z=k-G;B.x=(G*B.x+Z*u.x)/k,B.y=(G*B.y+Z*u.y)/k,B.z=(G*B.z+Z*u.z)/k}}return Gl.x&&e.clone(i,l),OE.y&&e.clone(i,E),xg.z&&e.clone(i,g)}var w=e.magnitudeSquared(e.subtract(l,u,R)),C=e.magnitudeSquared(e.subtract(E,s,R)),P=e.magnitudeSquared(e.subtract(g,c,R)),L=u,b=l,U=w;C>U&&(U=C,L=s,b=E),P>U&&(U=P,L=c,b=g);var F=A;F.x=.5*(L.x+b.x),F.y=.5*(L.y+b.y),F.z=.5*(L.z+b.z);var D=e.magnitudeSquared(e.subtract(b,F,R)),B=Math.sqrt(D),z=v;z.x=u.x,z.y=s.y,z.z=c.z;var G=S;G.x=l.x,G.y=E.y,G.z=g.z;var q=e.multiplyByScalar(e.add(z,G,R),.5,N),V=0;for(o=0;oV&&(V=X);var W=e.magnitudeSquared(e.subtract(i,F,R));if(W>D){var H=Math.sqrt(W);B=.5*(B+H),D=B*B;var Y=H-B;F.x=(B*F.x+Y*i.x)/H,F.y=(B*F.y+Y*i.y)/H,F.z=(B*F.z+Y*i.z)/H}}return B=l+s)return t.clone(r),r;if(s>=l+o)return n.clone(r),r;var E=.5*(o+l+s),h=e.multiplyByScalar(c,(-o+E)/l,F);return e.add(h,i,h),e.clone(h,r.center),r.radius=E,r};var D=new e;f.expand=function(t,n,r){r=f.clone(t,r);var a=e.magnitude(e.subtract(n,r.center,D));return a>r.radius&&(r.radius=a),r},f.intersectPlane=function(t,n){var r=t.center,a=t.radius,i=n.normal,o=e.dot(i,r)+n.distance;return o<-a?u.OUTSIDE:o=0?(r=65536*Math.floor(e/65536),t.high=r,t.low=e-r):(r=65536*Math.floor(-e/65536),t.high=-r,t.low=e+r),t};var a={high:0,low:0};r.fromCartesian=function(e,t){n(t)||(t=new r);var i=t.high,o=t.low;return r.encode(e.x,a),i.x=a.high,o.x=a.low,r.encode(e.y,a),i.y=a.high,o.y=a.low,r.encode(e.z,a),i.z=a.high,o.z=a.low,t};var i=new r;return r.writeElements=function(e,t,n){r.fromCartesian(e,i);var a=i.high,o=i.low;t[n]=a.x,t[n+1]=a.y,t[n+2]=a.z,t[n+3]=o.x,t[n+4]=o.y,t[n+5]=o.z},r}),define("Core/IndexDatatype",["./defined","./DeveloperError","./freezeObject","./Math","./WebGLConstants"],function(e,t,n,r,a){"use strict";var i={UNSIGNED_BYTE:a.UNSIGNED_BYTE,UNSIGNED_SHORT:a.UNSIGNED_SHORT,UNSIGNED_INT:a.UNSIGNED_INT};return i.getSizeInBytes=function(e){switch(e){case i.UNSIGNED_BYTE:return Uint8Array.BYTES_PER_ELEMENT;case i.UNSIGNED_SHORT:return Uint16Array.BYTES_PER_ELEMENT;case i.UNSIGNED_INT:return Uint32Array.BYTES_PER_ELEMENT}},i.validate=function(t){return e(t)&&(t===i.UNSIGNED_BYTE||t===i.UNSIGNED_SHORT||t===i.UNSIGNED_INT)},i.createTypedArray=function(e,t){return e>=r.SIXTY_FOUR_KILOBYTES?new Uint32Array(t):new Uint16Array(t)},i.createTypedArrayFromArrayBuffer=function(e,t,n,a){return e>=r.SIXTY_FOUR_KILOBYTES?new Uint32Array(t,n,a):new Uint16Array(t,n,a)},n(i)}),define("Core/QuadraticRealPolynomial",["./DeveloperError","./Math"],function(e,t){"use strict";function n(e,n,r){var a=e+n;return t.sign(e)!==t.sign(n)&&Math.abs(a/Math.max(Math.abs(e),Math.abs(n)))u&&u/o0?[f/e,a/f]:[a/f,f/e]},r}),define("Core/CubicRealPolynomial",["./DeveloperError","./QuadraticRealPolynomial"],function(e,t){"use strict";function n(e,t,n,r){var a,i,o=e,u=t/3,s=n/3,c=r,l=o*s,E=u*c,f=u*u,h=s*s,d=o*s-f,p=o*c-u*s,y=u*c-h,_=4*d*y-p*p;if(_<0){var m,T,R;f*E>=l*h?(m=o,T=d,R=-2*u*d+o*p):(m=c,T=y,R=-c*p+2*s*y);var A=R<0?-1:1,v=-A*Math.abs(m)*Math.sqrt(-_);i=-R+v;var S=i/2,N=S<0?-Math.pow(-S,1/3):Math.pow(S,1/3),g=i===v?-N:-T/N;return a=T<=0?N+g:-R/(N*N+g*g+T),f*E>=l*h?[(a-u)/o]:[-c/(a+s)]}var I=d,M=-2*u*d+o*p,O=y,x=-c*p+2*s*y,w=Math.sqrt(_),C=Math.sqrt(3)/2,P=Math.abs(Math.atan2(o*w,-M)/3);a=2*Math.sqrt(-I);var L=Math.cos(P);i=a*L;var b=a*(-L/2-C*Math.sin(P)),U=i+b>2*u?i-u:b-u,F=o,D=U/F;P=Math.abs(Math.atan2(c*w,-x)/3),a=2*Math.sqrt(-O),L=Math.cos(P),i=a*L,b=a*(-L/2-C*Math.sin(P));var B=-c,z=i+b<2*s?i+s:b+s,G=B/z,q=F*z,V=-U*z-F*B,X=U*B,W=(s*V-u*X)/(-u*V+s*q);return D<=W?D<=G?W<=G?[D,W,G]:[D,G,W]:[G,D,W]:D<=G?[W,D,G]:W<=G?[W,G,D]:[G,W,D]}var r={};return r.computeDiscriminant=function(e,t,n,r){var a=e*e,i=t*t,o=n*n;return 18*e*t*n*r+i*o-27*a*(r*r)-4*(e*o*n+i*t*r)},r.computeRealRoots=function(e,r,a,i){var o,u;if(0===e)return t.computeRealRoots(r,a,i);if(0===r){if(0===a){if(0===i)return[0,0,0];u=-i/e;var s=u<0?-Math.pow(-u,1/3):Math.pow(u,1/3);return[s,s,s]}return 0===i?(o=t.computeRealRoots(e,0,a),0===o.Length?[0]:[o[0],0,o[1]]):n(e,0,a,i)}return 0===a?0===i?(u=-r/e,u<0?[u,0,0]:[0,0,u]):n(e,r,0,i):0===i?(o=t.computeRealRoots(e,r,a),0===o.length?[0]:o[1]<=0?[o[0],o[1],0]:o[0]>=0?[0,o[0],o[1]]:[o[0],0,o[1]]):n(e,r,a,i)},r}),define("Core/QuarticRealPolynomial",["./CubicRealPolynomial","./DeveloperError","./Math","./QuadraticRealPolynomial"],function(e,t,n,r){"use strict";function a(t,a,i,o){var u=t*t,s=a-3*u/8,c=i-a*t/2+u*t/8,l=o-i*t/4+a*u/16-3*u*u/256,E=e.computeRealRoots(1,2*s,s*s-4*l,-c*c);if(E.length>0){var f=-t/4,h=E[E.length-1];if(Math.abs(h)=0&&_>=0){var m=Math.sqrt(y),T=Math.sqrt(_);return[f-T,f-m,f+m,f+T]}if(y>=0&&_<0)return p=Math.sqrt(y),[f-p,f+p];if(y<0&&_>=0)return p=Math.sqrt(_),[f-p,f+p]}return[]}if(h>0){var R=Math.sqrt(h),A=(s+h-c/R)/2,v=(s+h+c/R)/2,S=r.computeRealRoots(1,R,A),N=r.computeRealRoots(1,-R,v);return 0!==S.length?(S[0]+=f,S[1]+=f,0!==N.length?(N[0]+=f,N[1]+=f,S[1]<=N[0]?[S[0],S[1],N[0],N[1]]:N[1]<=S[0]?[N[0],N[1],S[0],S[1]]:S[0]>=N[0]&&S[1]<=N[1]?[N[0],S[0],S[1],N[1]]:N[0]>=S[0]&&N[1]<=S[1]?[S[0],N[0],N[1],S[1]]:S[0]>N[0]&&S[0]0){var d,p,y=h[0],_=a-y,m=_*_,T=t/2,R=_/2,A=m-4*o,v=m+4*Math.abs(o),S=c-4*y,N=c+4*Math.abs(y);if(y<0||A*N=P[0]&&C[1]<=P[1]?[P[0],C[0],C[1],P[1]]:P[0]>=C[0]&&P[1]<=C[1]?[C[0],P[0],P[1],C[1]]:C[0]>P[0]&&C[0]0){var i=1/(2*e),o=Math.sqrt(a),u=(-t+o)*i,s=(-t-o)*i;return u0?T.push(new e(a,i*F,i*-z)):0!==z?(T.push(new e(a,i*F,i*-z)),T.push(new e(a,i*F,i*z)),++b):T.push(new e(a,i*F,i*z))}return T}var p={};p.rayPlane=function(t,n,a){r(a)||(a=new e);var i=t.origin,u=t.direction,s=n.normal,c=e.dot(s,u);if(!(Math.abs(c)S)return;if(c=e.cross(s,p,R),(E=e.dot(d,c))<0||l+E>S)return;f=e.dot(A,c)/S}else{if(Math.abs(S)1)return;if(c=e.cross(s,p,R),(E=e.dot(d,c)*N)<0||l+E>1)return;f=e.dot(A,c)*N}return f},p.rayTriangle=function(t,n,a,i,o,u){var s=p.rayTriangleParametric(t,n,a,i,o);if(r(s)&&!(s<0))return r(u)||(u=new e),e.multiplyByScalar(t.direction,s,u),e.add(t.origin,u,u)};var A=new l;p.lineSegmentTriangle=function(t,n,a,i,o,u,s){var c=A;e.clone(t,c.origin),e.subtract(n,t,c.direction),e.normalize(c.direction,c.direction);var l=p.rayTriangleParametric(c,a,i,o,u);if(!(!r(l)||l<0||l>e.distance(t,n)))return r(s)||(s=new e),e.multiplyByScalar(c.direction,l,s),e.add(c.origin,s,s)};var v={root0:0,root1:0};p.raySphere=function(e,t,n){if(n=f(e,t,n),r(n)&&!(n.stop<0))return n.start=Math.max(n.start,0),n};var S=new l;p.lineSegmentSphere=function(t,n,a,i){var o=S;e.clone(t,o.origin);var u=e.subtract(n,t,o.direction),s=e.magnitude(u);if(e.normalize(u,u),i=f(o,a,i),!(!r(i)||i.stop<0||i.start>s))return i.start=Math.max(i.start,0),i.stop=Math.min(i.stop,s),i};var N=new e,g=new e;p.rayEllipsoid=function(t,n){var r,a,o,u,s,c=n.oneOverRadii,l=e.multiplyComponents(c,t.origin,N),E=e.multiplyComponents(c,t.direction,g),f=e.magnitudeSquared(l),h=e.dot(l,E);if(f>1){if(h>=0)return;var d=h*h;if(r=f-1,a=e.magnitudeSquared(E),o=a*r,do){u=h*h-o,s=-h+Math.sqrt(u);var p=s/a,y=r/s;return p=0)return a}var c=r(this.rayEllipsoid(t,n)),l=n.transformPositionToScaledSpace(i,I),E=e.normalize(l,l),f=e.mostOrthogonalAxis(l,x),h=e.normalize(e.cross(f,E,M),M),p=e.normalize(e.cross(E,h,O),O),y=C;y[0]=E.x,y[1]=E.y,y[2]=E.z,y[3]=h.x,y[4]=h.y,y[5]=h.z,y[6]=p.x,y[7]=p.y,y[8]=p.z;var _=u.transpose(y,P),m=u.fromScale(n.radii,L),T=u.fromScale(n.oneOverRadii,b),R=U;R[0]=0,R[1]=-i.z,R[2]=i.y,R[3]=i.z,R[4]=0,R[5]=-i.x,R[6]=-i.y,R[7]=i.x,R[8]=0;var A,v,S=u.multiply(u.multiply(_,T,F),R,F),N=u.multiply(u.multiply(S,m,D),y,D),g=u.multiplyByVector(S,a,w),q=d(N,e.negate(g,I),0,0,1),V=q.length;if(V>0){for(var X=e.clone(e.ZERO,z),W=Number.NEGATIVE_INFINITY,H=0;HW&&(W=k,X=e.clone(A,X))}var Z=n.cartesianToCartographic(X,G);return W=o.clamp(W,0,1),v=e.magnitude(e.subtract(X,a,x))*Math.sqrt(1-W*W),v=c?-v:v,Z.height=v,n.cartographicToCartesian(Z,new e)}};var q=new e;return p.lineSegmentPlane=function(t,n,a,i){r(i)||(i=new e);var u=e.subtract(n,t,q),s=a.normal,c=e.dot(s,u);if(!(Math.abs(c)1))return e.multiplyByScalar(u,E,i),e.add(t,i,i),i}},p.trianglePlaneIntersection=function(t,n,r,a){var i=a.normal,o=a.distance,u=e.dot(i,t)+o<0,s=e.dot(i,n)+o<0,c=e.dot(i,r)+o<0,l=0;l+=u?1:0,l+=s?1:0,l+=c?1:0;var E,f;if(1!==l&&2!==l||(E=new e,f=new e),1===l){if(u)return p.lineSegmentPlane(t,n,a,E),p.lineSegmentPlane(t,r,a,f),{positions:[t,n,r,E,f],indices:[0,3,4,1,2,4,1,4,3]};if(s)return p.lineSegmentPlane(n,r,a,E),p.lineSegmentPlane(n,t,a,f),{positions:[t,n,r,E,f],indices:[1,3,4,2,0,4,2,4,3]};if(c)return p.lineSegmentPlane(r,t,a,E),p.lineSegmentPlane(r,n,a,f),{positions:[t,n,r,E,f],indices:[2,3,4,0,1,4,0,4,3]}}else if(2===l){if(!u)return p.lineSegmentPlane(n,t,a,E),p.lineSegmentPlane(r,t,a,f),{positions:[t,n,r,E,f],indices:[1,2,4,1,4,3,0,3,4]};if(!s)return p.lineSegmentPlane(r,n,a,E),p.lineSegmentPlane(t,n,a,f),{positions:[t,n,r,E,f],indices:[2,0,4,2,4,3,1,3,4]};if(!c)return p.lineSegmentPlane(t,r,a,E),p.lineSegmentPlane(n,r,a,f),{positions:[t,n,r,E,f],indices:[0,1,4,0,4,3,2,3,4]}}},p}),define("Core/Plane",["./Cartesian3","./defined","./DeveloperError","./freezeObject","./Math"],function(e,t,n,r,a){"use strict";function i(t,n){this.normal=e.clone(t),this.distance=n}i.fromPointNormal=function(n,r,a){var o=-e.dot(r,n);return t(a)?(e.clone(r,a.normal),a.distance=o,a):new i(r,o)};var o=new e;return i.fromCartesian4=function(n,r){var a=e.fromCartesian4(n,o),u=n.w;return t(r)?(e.clone(a,r.normal),r.distance=u,r):new i(a,u)},i.getPointDistance=function(t,n){return e.dot(t.normal,n)+t.distance},i.ORIGIN_XY_PLANE=r(new i(e.UNIT_Z,0)),i.ORIGIN_YZ_PLANE=r(new i(e.UNIT_X,0)),i.ORIGIN_ZX_PLANE=r(new i(e.UNIT_Y,0)),i}),define("Core/Tipsify",["./defaultValue","./defined","./DeveloperError"],function(e,t,n){"use strict";var r={};return r.calculateACMR=function(n){n=e(n,e.EMPTY_OBJECT);var r=n.indices,a=n.maximumIndex,i=e(n.cacheSize,24),o=r.length;if(!t(a)){a=0;for(var u=0,s=r[u];ua&&(a=s),++u,s=r[u]}for(var c=[],l=0;li&&(c[r[f]]=E,++E);return(E-i+1)/(o/3)},r.tipsify=function(n){function r(e,t,n,r){for(;t.length>=1;){var i=t[t.length-1];if(t.splice(t.length-1,1),e[i].numLiveTriangles>0)return i}for(;a0)return++a-1;++a}return-1}n=e(n,e.EMPTY_OBJECT);var a,i=n.indices,o=n.maximumIndex,u=e(n.cacheSize,24),s=i.length,c=0,l=0,E=i[l],f=s;if(t(o))c=o+1;else{for(;lc&&(c=E),++l,E=i[l];if(-1===c)return 0;++c}var h,d=[];for(h=0;hu&&(m.timeStamp=_,++_),++l}y=function(e,t,n,a,i,o,u){for(var s,c=-1,l=-1,E=0;El||-1===l)&&(l=s,c=f)),++E}return-1===c?r(a,o,e,u):c}(i,u,R,d,_,A,c)}return S},r}),define("Core/GeometryPipeline",["./AttributeCompression","./barycentricCoordinates","./BoundingSphere","./Cartesian2","./Cartesian3","./Cartesian4","./Cartographic","./ComponentDatatype","./defaultValue","./defined","./DeveloperError","./EncodedCartesian3","./GeographicProjection","./Geometry","./GeometryAttribute","./GeometryType","./IndexDatatype","./Intersect","./IntersectionTests","./Math","./Matrix3","./Matrix4","./Plane","./PrimitiveType","./Tipsify"],function(e,t,n,r,a,i,o,u,s,c,l,E,f,h,d,p,y,_,m,T,R,A,v,S,N){"use strict";function g(e,t,n,r,a){e[t++]=n,e[t++]=r,e[t++]=r,e[t++]=a,e[t++]=a,e[t]=n}function I(e){for(var t=e.length,n=t/3*6,r=y.createTypedArray(t,n),a=0,i=0;i=3){var n=6*(t-2),r=y.createTypedArray(t,n);g(r,0,e[0],e[1],e[2]);for(var a=6,i=3;i0){for(var t=e.length-1,n=6*(t-1),r=y.createTypedArray(t,n),a=e[0],i=0,o=1;ox&&(x=w)}return new h({attributes:_,indices:m,primitiveType:p,boundingSphere:c(O)?new n(O,x):void 0})}function U(e){if(c(e.indices))return e;for(var t=h.computeNumberOfVertices(e),n=y.createTypedArray(t,t),r=0;r3&&(n[3]=0,n[4]=2,n[5]=3);for(var r=6,a=3;ai?a>o?T.sign(e.y):T.sign(n.y):i>o?T.sign(t.y):T.sign(n.y);var u=r<0;V(e,u),V(t,u),V(n,u)}function W(e,t,n,r){a.add(e,a.multiplyByScalar(a.subtract(t,e,Ae),e.y/(e.y-t.y),Ae),n),a.clone(n,r),V(n,!0),V(r,!1)}function H(e,t,n){if(!(e.x>=0||t.x>=0||n.x>=0)){X(e,t,n);var r=e.y<0,a=t.y<0,i=n.y<0,o=0;o+=r?1:0,o+=a?1:0,o+=i?1:0;var u=Ie.indices;1===o?(u[1]=3,u[2]=4,u[5]=6,u[7]=6,u[8]=5,r?(W(e,t,ve,Ne),W(e,n,Se,ge),u[0]=0,u[3]=1,u[4]=2,u[6]=1):a?(W(t,n,ve,Ne),W(t,e,Se,ge),u[0]=1,u[3]=2,u[4]=0,u[6]=2):i&&(W(n,e,ve,Ne),W(n,t,Se,ge),u[0]=2,u[3]=0,u[4]=1,u[6]=0)):2===o&&(u[2]=4,u[4]=4,u[5]=3,u[7]=5,u[8]=6,r?a?i||(W(n,e,ve,Ne),W(n,t,Se,ge),u[0]=0,u[1]=1,u[3]=0,u[6]=2):(W(t,n,ve,Ne),W(t,e,Se,ge),u[0]=2,u[1]=0,u[3]=2,u[6]=1):(W(e,t,ve,Ne),W(e,n,Se,ge),u[0]=1,u[1]=2,u[3]=1,u[6]=0));var s=Ie.positions;return s[0]=e,s[1]=t,s[2]=n,s.length=3,1!==o&&2!==o||(s[3]=ve,s[4]=Se,s[5]=Ne,s[6]=ge,s.length=7),Ie}}function Y(e,t){var r=e.attributes;if(0!==r.position.values.length){for(var a in r)if(r.hasOwnProperty(a)&&c(r[a])&&c(r[a].values)){var i=r[a];i.values=u.createTypedArray(i.componentDatatype,i.values)}var o=h.computeNumberOfVertices(e);return e.indices=y.createTypedArray(o,e.indices),t&&(e.boundingSphere=n.fromVertices(r.position.values)),e}}function k(e){var t=e.attributes,n={};for(var r in t)if(t.hasOwnProperty(r)&&c(t[r])&&c(t[r].values)){var a=t[r];n[r]=new d({componentDatatype:a.componentDatatype,componentsPerAttribute:a.componentsPerAttribute,normalize:a.normalize,values:[]})}return new h({attributes:n,indices:[],primitiveType:e.primitiveType})}function Z(e,t,n){var r=c(e.geometry.boundingSphere);t=Y(t,r),n=Y(n,r),c(n)&&!c(t)?e.geometry=n:!c(n)&&c(t)?e.geometry=t:(e.westHemisphereGeometry=t,e.eastHemisphereGeometry=n,e.geometry=void 0)}function K(e,n,i,o,u,s,l,E,f,h,d,p){if(c(s)||c(l)||c(E)||c(f)||c(h)){var y=a.fromArray(u,3*e,Me),_=a.fromArray(u,3*n,Oe),m=a.fromArray(u,3*i,xe),T=t(o,y,_,m,we);if(c(s)){var R=a.fromArray(s,3*e,Me),A=a.fromArray(s,3*n,Oe),v=a.fromArray(s,3*i,xe);a.multiplyByScalar(R,T.x,R),a.multiplyByScalar(A,T.y,A),a.multiplyByScalar(v,T.z,v);var S=a.add(R,A,R);a.add(S,v,S),a.normalize(S,S),a.pack(S,d.normal.values,3*p)}if(c(h)){var N=a.fromArray(h,3*e,Me),g=a.fromArray(h,3*n,Oe),I=a.fromArray(h,3*i,xe);a.multiplyByScalar(N,T.x,N),a.multiplyByScalar(g,T.y,g),a.multiplyByScalar(I,T.z,I);var M;a.equals(N,a.ZERO)&&a.equals(g,a.ZERO)&&a.equals(I,a.ZERO)?(M=Me,M.x=0,M.y=0,M.z=0):(M=a.add(N,g,N),a.add(M,I,M),a.normalize(M,M)),a.pack(M,d.extrudeDirection.values,3*p)}if(c(l)){var O=a.fromArray(l,3*e,Me),x=a.fromArray(l,3*n,Oe),w=a.fromArray(l,3*i,xe);a.multiplyByScalar(O,T.x,O),a.multiplyByScalar(x,T.y,x),a.multiplyByScalar(w,T.z,w);var C=a.add(O,x,O);a.add(C,w,C),a.normalize(C,C),a.pack(C,d.tangent.values,3*p)}if(c(E)){var P=a.fromArray(E,3*e,Me),L=a.fromArray(E,3*n,Oe),b=a.fromArray(E,3*i,xe);a.multiplyByScalar(P,T.x,P),a.multiplyByScalar(L,T.y,L),a.multiplyByScalar(b,T.z,b);var U=a.add(P,L,P);a.add(U,b,U),a.normalize(U,U),a.pack(U,d.bitangent.values,3*p)}if(c(f)){var F=r.fromArray(f,2*e,Ce),D=r.fromArray(f,2*n,Pe),B=r.fromArray(f,2*i,Le);r.multiplyByScalar(F,T.x,F),r.multiplyByScalar(D,T.y,D),r.multiplyByScalar(B,T.z,B);var z=r.add(F,D,F);r.add(z,B,z),r.pack(z,d.st.values,2*p)}}}function j(e,t,n,r,a,i){var o=e.position.values.length/3;if(-1!==a){var u=r[a],s=n[u];return-1===s?(n[u]=o,e.position.values.push(i.x,i.y,i.z),t.push(o),o):(t.push(s),s)}return e.position.values.push(i.x,i.y,i.z),t.push(o),o}function Q(e){var t,n,r,i,o,u=e.geometry,s=u.attributes,l=s.position.values,E=c(s.normal)?s.normal.values:void 0,f=c(s.bitangent)?s.bitangent.values:void 0,h=c(s.tangent)?s.tangent.values:void 0,d=c(s.st)?s.st.values:void 0,p=c(s.extrudeDirection)?s.extrudeDirection.values:void 0,y=u.indices,_=k(u),m=k(u),T=[];T.length=l.length/3;var R=[];for(R.length=l.length/3,o=0;o3)for(var x=O.positions,w=O.indices,C=w.length,P=0;P0)){var c=a.unpack(r,u,Ge);(s.y<0&&c.y>0||s.y>0&&c.y<0)&&(u-3>0?(r[u]=n[u-3],r[u+1]=n[u-2],r[u+2]=n[u-1]):a.pack(s,r,u));var l=a.unpack(i,u,qe);(s.y<0&&l.y>0||s.y>0&&l.y<0)&&(u+3a&&(a=n[i]);e.indices=N.tipsify({indices:n,maximumIndex:a,cacheSize:t})}return e},te.fitToUnsignedShortIndices=function(e){var t=[],n=h.computeNumberOfVertices(e);if(c(e.indices)&&n>=T.SIXTY_FOUR_KILOBYTES){var r,a=[],i=[],o=0,u=x(e.attributes),s=e.indices,l=s.length;e.primitiveType===S.TRIANGLES?r=3:e.primitiveType===S.LINES?r=2:e.primitiveType===S.POINTS&&(r=1);for(var E=0;E=T.SIXTY_FOUR_KILOBYTES&&(t.push(new h({attributes:u,indices:i,primitiveType:e.primitiveType,boundingSphere:e.boundingSphere,boundingSphereCV:e.boundingSphereCV})),a=[],i=[],o=0,u=x(e.attributes))}0!==i.length&&t.push(new h({attributes:u,indices:i,primitiveType:e.primitiveType,boundingSphere:e.boundingSphere,boundingSphereCV:e.boundingSphereCV}))}else t.push(e);return t};var ne=new a,re=new o;te.projectTo2D=function(e,t,n,r,i){var o=e.attributes[t];i=c(i)?i:new f;for(var s=i.ellipsoid,l=o.values,E=new Float64Array(l.length),h=0,p=0;p0&&o.push(b(t,"geometry")),n.length>0&&(o.push(b(n,"westHemisphereGeometry")),o.push(b(n,"eastHemisphereGeometry"))),o};var ce=new a,le=new a,Ee=new a,fe=new a;te.computeNormal=function(e){var t,n=e.indices,r=e.attributes,i=r.position.values,o=r.position.values.length/3,s=n.length,c=new Array(o),l=new Array(s/3),E=new Array(s);for(t=0;t0){for(f=0;f0||n.intersectPlane(r,v.ORIGIN_ZX_PLANE)!==_.INTERSECTING)return e}if(t.geometryType!==p.NONE)switch(t.geometryType){case p.POLYLINES:ee(e);break;case p.TRIANGLES:Q(e);break;case p.LINES:J(e)}else q(t),t.primitiveType===S.TRIANGLES?Q(e):t.primitiveType===S.LINES&&J(e);return e},te}),define("ThirdParty/earcut-2.1.1",[],function(){"use strict";function e(e,n,a){a=a||2;var i=n&&n.length,o=i?n[0]*a:e.length,u=t(e,0,o,a,!0),c=[];if(!u)return c;var l,E,f,h,d,p,y;if(i&&(u=s(e,n,u,a)),e.length>80*a){l=f=e[0],E=h=e[1];for(var _=a;_f&&(f=d),p>h&&(h=p);y=Math.max(f-l,h-E)}return r(u,c,a,l,E,y),c}function t(e,t,n,r,a){var i,o;if(a===O(e,t,n,r)>0)for(i=t;i=t;i-=r)o=g(i,e[i],e[i+1],o);return o&&T(o,o.next)&&(I(o),o=o.next),o}function n(e,t){if(!e)return e;t||(t=e);var n,r=e;do{if(n=!1,r.steiner||!T(r,r.next)&&0!==m(r.prev,r,r.next))r=r.next;else{if(I(r),(r=t=r.prev)===r.next)return null;n=!0}}while(n||r!==t);return t}function r(e,t,s,c,l,E,h){if(e){!h&&E&&f(e,c,l,E);for(var d,p,y=e;e.prev!==e.next;)if(d=e.prev,p=e.next,E?i(e,c,l,E):a(e))t.push(d.i/s),t.push(e.i/s), t.push(p.i/s),I(e),e=p.next,y=p.next;else if((e=p)===y){h?1===h?(e=o(e,t,s),r(e,t,s,c,l,E,2)):2===h&&u(e,t,s,c,l,E):r(n(e),t,s,c,l,E,1);break}}}function a(e){var t=e.prev,n=e,r=e.next;if(m(t,n,r)>=0)return!1;for(var a=e.next.next;a!==e.prev;){if(y(t.x,t.y,n.x,n.y,r.x,r.y,a.x,a.y)&&m(a.prev,a,a.next)>=0)return!1;a=a.next}return!0}function i(e,t,n,r){var a=e.prev,i=e,o=e.next;if(m(a,i,o)>=0)return!1;for(var u=a.xi.x?a.x>o.x?a.x:o.x:i.x>o.x?i.x:o.x,l=a.y>i.y?a.y>o.y?a.y:o.y:i.y>o.y?i.y:o.y,E=d(u,s,t,n,r),f=d(c,l,t,n,r),h=e.nextZ;h&&h.z<=f;){if(h!==e.prev&&h!==e.next&&y(a.x,a.y,i.x,i.y,o.x,o.y,h.x,h.y)&&m(h.prev,h,h.next)>=0)return!1;h=h.nextZ}for(h=e.prevZ;h&&h.z>=E;){if(h!==e.prev&&h!==e.next&&y(a.x,a.y,i.x,i.y,o.x,o.y,h.x,h.y)&&m(h.prev,h,h.next)>=0)return!1;h=h.prevZ}return!0}function o(e,t,n){var r=e;do{var a=r.prev,i=r.next.next;!T(a,i)&&R(a,r,r.next,i)&&v(a,i)&&v(i,a)&&(t.push(a.i/n),t.push(r.i/n),t.push(i.i/n),I(r),I(r.next),r=e=i),r=r.next}while(r!==e);return r}function u(e,t,a,i,o,u){var s=e;do{for(var c=s.next.next;c!==s.prev;){if(s.i!==c.i&&_(s,c)){var l=N(s,c);return s=n(s,s.next),l=n(l,l.next),r(s,t,a,i,o,u),void r(l,t,a,i,o,u)}c=c.next}s=s.next}while(s!==e)}function s(e,r,a,i){var o,u,s,E,f,h=[];for(o=0,u=r.length;o=r.next.y){var u=r.x+(i-r.y)*(r.next.x-r.x)/(r.next.y-r.y);if(u<=a&&u>o){if(o=u,u===a){if(i===r.y)return r;if(i===r.next.y)return r.next}n=r.x=r.x&&r.x>=l&&y(in.x)&&v(r,e)&&(n=r,f=s),r=r.next;return n}function f(e,t,n,r){var a=e;do{null===a.z&&(a.z=d(a.x,a.y,t,n,r)),a.prevZ=a.prev,a.nextZ=a.next,a=a.next}while(a!==e);a.prevZ.nextZ=null,a.prevZ=null,h(a)}function h(e){var t,n,r,a,i,o,u,s,c=1;do{for(n=e,e=null,i=null,o=0;n;){for(o++,r=n,u=0,t=0;t0||s>0&&r;)0===u?(a=r,r=r.nextZ,s--):0!==s&&r?n.z<=r.z?(a=n,n=n.nextZ,u--):(a=r,r=r.nextZ,s--):(a=n,n=n.nextZ,u--),i?i.nextZ=a:e=a,a.prevZ=i,i=a;n=r}i.nextZ=null,c*=2}while(o>1);return e}function d(e,t,n,r,a){return e=32767*(e-n)/a,t=32767*(t-r)/a,e=16711935&(e|e<<8),e=252645135&(e|e<<4),e=858993459&(e|e<<2),e=1431655765&(e|e<<1),t=16711935&(t|t<<8),t=252645135&(t|t<<4),t=858993459&(t|t<<2),t=1431655765&(t|t<<1),e|t<<1}function p(e){var t=e,n=e;do{t.x=0&&(e-o)*(r-u)-(n-o)*(t-u)>=0&&(n-o)*(i-u)-(a-o)*(r-u)>=0}function _(e,t){return e.next.i!==t.i&&e.prev.i!==t.i&&!A(e,t)&&v(e,t)&&v(t,e)&&S(e,t)}function m(e,t,n){return(t.y-e.y)*(n.x-t.x)-(t.x-e.x)*(n.y-t.y)}function T(e,t){return e.x===t.x&&e.y===t.y}function R(e,t,n,r){return!!(T(e,t)&&T(n,r)||T(e,r)&&T(n,t))||m(e,t,n)>0!=m(e,t,r)>0&&m(n,r,e)>0!=m(n,r,t)>0}function A(e,t){var n=e;do{if(n.i!==e.i&&n.next.i!==e.i&&n.i!==t.i&&n.next.i!==t.i&&R(n,n.next,e,t))return!0;n=n.next}while(n!==e);return!1}function v(e,t){return m(e.prev,e,e.next)<0?m(e,t,e.next)>=0&&m(e,e.prev,t)>=0:m(e,t,e.prev)<0||m(e,e.next,t)<0}function S(e,t){var n=e,r=!1,a=(e.x+t.x)/2,i=(e.y+t.y)/2;do{n.y>i!=n.next.y>i&&a<(n.next.x-n.x)*(i-n.y)/(n.next.y-n.y)+n.x&&(r=!r),n=n.next}while(n!==e);return r}function N(e,t){var n=new M(e.i,e.x,e.y),r=new M(t.i,t.x,t.y),a=e.next,i=t.prev;return e.next=t,t.prev=e,n.next=a,a.prev=n,r.next=n,n.prev=r,i.next=r,r.prev=i,r}function g(e,t,n,r){var a=new M(e,t,n);return r?(a.next=r.next,a.prev=r,r.next.prev=a,r.next=a):(a.prev=a,a.next=a),a}function I(e){e.next.prev=e.prev,e.prev.next=e.next,e.prevZ&&(e.prevZ.nextZ=e.nextZ),e.nextZ&&(e.nextZ.prevZ=e.prevZ)}function M(e,t,n){this.i=e,this.x=t,this.y=n,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1}function O(e,t,n,r){for(var a=0,i=t,o=n-r;i0&&(r+=e[a-1].length,n.holes.push(r))}return n},e}),define("Core/WindingOrder",["./freezeObject","./WebGLConstants"],function(e,t){"use strict";var n={CLOCKWISE:t.CW,COUNTER_CLOCKWISE:t.CCW,validate:function(e){return e===n.CLOCKWISE||e===n.COUNTER_CLOCKWISE}};return e(n)}),define("Core/PolygonPipeline",["../ThirdParty/earcut-2.1.1","./Cartesian2","./Cartesian3","./Check","./ComponentDatatype","./defaultValue","./defined","./Ellipsoid","./Geometry","./GeometryAttribute","./Math","./PrimitiveType","./WindingOrder"],function(e,t,n,r,a,i,o,u,s,c,l,E,f){"use strict";var h=new n,d=new n,p={};p.computeArea2D=function(e){for(var t=e.length,n=0,r=t-1,a=0;a0?f.COUNTER_CLOCKWISE:f.CLOCKWISE},p.triangulate=function(n,r){var a=t.packArray(n);return e(a,r,2)};var y=new n,_=new n,m=new n,T=new n,R=new n,A=new n,v=new n;return p.computeSubdivision=function(e,t,r,u){u=i(u,l.RADIANS_PER_DEGREE);var f,h=r.slice(0),d=t.length,p=new Array(3*d),S=0;for(f=0;f0;){var w,C,P=h.pop(),L=h.pop(),b=h.pop(),U=n.fromArray(p,3*b,y),F=n.fromArray(p,3*L,_),D=n.fromArray(p,3*P,m),B=n.multiplyByScalar(n.normalize(U,T),M,T),z=n.multiplyByScalar(n.normalize(F,R),M,R),G=n.multiplyByScalar(n.normalize(D,A),M,A),q=n.magnitudeSquared(n.subtract(B,z,v)),V=n.magnitudeSquared(n.subtract(z,G,v)),X=n.magnitudeSquared(n.subtract(G,B,v)),W=Math.max(q,V,X);W>x?q===W?(w=Math.min(b,L)+" "+Math.max(b,L),f=I[w],o(f)||(C=n.add(U,F,v),n.multiplyByScalar(C,.5,C),p.push(C.x,C.y,C.z),f=p.length/3-1,I[w]=f),h.push(b,f,P),h.push(f,L,P)):V===W?(w=Math.min(L,P)+" "+Math.max(L,P),f=I[w],o(f)||(C=n.add(F,D,v),n.multiplyByScalar(C,.5,C),p.push(C.x,C.y,C.z),f=p.length/3-1,I[w]=f),h.push(L,f,b),h.push(f,P,b)):X===W&&(w=Math.min(P,b)+" "+Math.max(P,b),f=I[w],o(f)||(C=n.add(D,U,v),n.multiplyByScalar(C,.5,C),p.push(C.x,C.y,C.z),f=p.length/3-1,I[w]=f),h.push(P,f,L),h.push(f,b,L)):(g.push(b),g.push(L),g.push(P))}return new s({attributes:{position:new c({componentDatatype:a.DOUBLE,componentsPerAttribute:3,values:p})},indices:g,primitiveType:E.TRIANGLES})},p.scaleToGeodeticHeight=function(e,t,r,a){r=i(r,u.WGS84);var s=h,c=d;if(t=i(t,0),a=i(a,!0),o(e))for(var l=e.length,E=0;E0)n=Math.sqrt(p+1),u=.5*n,n=.5/n,a=(e[s.COLUMN1ROW2]-e[s.COLUMN2ROW1])*n,i=(e[s.COLUMN2ROW0]-e[s.COLUMN0ROW2])*n,o=(e[s.COLUMN0ROW1]-e[s.COLUMN1ROW0])*n;else{var y=E,_=0;h>l&&(_=1),d>l&&d>h&&(_=2);var m=y[_],T=y[m];n=Math.sqrt(e[s.getElementIndex(_,_)]-e[s.getElementIndex(m,m)]-e[s.getElementIndex(T,T)]+1);var R=f;R[_]=.5*n,n=.5/n,u=(e[s.getElementIndex(T,m)]-e[s.getElementIndex(m,T)])*n,R[m]=(e[s.getElementIndex(m,_)]+e[s.getElementIndex(_,m)])*n,R[T]=(e[s.getElementIndex(T,_)]+e[s.getElementIndex(_,T)])*n,a=-R[0],i=-R[1],o=-R[2]}return r(t)?(t.x=a,t.y=i,t.z=o,t.w=u,t):new c(a,i,o,u)};var h=new c,d=new c,p=new c,y=new c;c.fromHeadingPitchRoll=function(t,n){return y=c.fromAxisAngle(e.UNIT_X,t.roll,h),p=c.fromAxisAngle(e.UNIT_Y,-t.pitch,n),n=c.multiply(p,y,p),d=c.fromAxisAngle(e.UNIT_Z,-t.heading,h),c.multiply(d,n,n)};var _=new e,m=new e,T=new c,R=new c,A=new c;c.packedLength=4,c.pack=function(e,t,r){return r=n(r,0),t[r++]=e.x,t[r++]=e.y,t[r++]=e.z,t[r]=e.w,t},c.unpack=function(e,t,a){return t=n(t,0),r(a)||(a=new c),a.x=e[t],a.y=e[t+1],a.z=e[t+2],a.w=e[t+3],a},c.packedInterpolationLength=3,c.convertPackedArrayForInterpolation=function(e,t,n,r){c.unpack(e,4*n,A),c.conjugate(A,A);for(var a=0,i=n-t+1;a=0?a=1:(a=-1,i=-i);for(var o=i-1,u=1-n,s=n*n,l=u*u,E=7;E>=0;--E)b[E]=(P[E]*s-L[E])*o,U[E]=(P[E]*l-L[E])*o;var f=a*n*(1+b[0]*(1+b[1]*(1+b[2]*(1+b[3]*(1+b[4]*(1+b[5]*(1+b[6]*(1+b[7])))))))),h=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])))))))),d=c.multiplyByScalar(e,h,w);return c.multiplyByScalar(t,f,r),c.add(d,r,r)},c.fastSquad=function(e,t,n,r,a,i){var o=c.fastSlerp(e,t,a,O),u=c.fastSlerp(n,r,a,x);return c.fastSlerp(o,u,2*a*(1-a),i)},c.equals=function(e,t){return e===t||r(e)&&r(t)&&e.x===t.x&&e.y===t.y&&e.z===t.z&&e.w===t.w},c.equalsEpsilon=function(e,t,n){return e===t||r(e)&&r(t)&&Math.abs(e.x-t.x)<=n&&Math.abs(e.y-t.y)<=n&&Math.abs(e.z-t.z)<=n&&Math.abs(e.w-t.w)<=n},c.ZERO=i(new c(0,0,0,0)),c.IDENTITY=i(new c(0,0,0,1)),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.x+", "+this.y+", "+this.z+", "+this.w+")"},c}),define("Core/Matrix2",["./Cartesian2","./Check","./defaultValue","./defined","./defineProperties","./freezeObject"],function(e,t,n,r,a,i){"use strict";function o(e,t,r,a){this[0]=n(e,0),this[1]=n(r,0),this[2]=n(t,0),this[3]=n(a,0)}o.packedLength=4,o.pack=function(e,t,r){return r=n(r,0),t[r++]=e[0],t[r++]=e[1],t[r++]=e[2],t[r++]=e[3],t},o.unpack=function(e,t,a){return t=n(t,0),r(a)||(a=new o),a[0]=e[t++],a[1]=e[t++],a[2]=e[t++],a[3]=e[t++],a},o.clone=function(e,t){if(r(e))return r(t)?(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t):new o(e[0],e[2],e[1],e[3])},o.fromArray=function(e,t,a){return t=n(t,0),r(a)||(a=new o),a[0]=e[t],a[1]=e[t+1],a[2]=e[t+2],a[3]=e[t+3],a},o.fromColumnMajorArray=function(e,t){return o.clone(e,t)},o.fromRowMajorArray=function(e,t){return r(t)?(t[0]=e[0],t[1]=e[2],t[2]=e[1],t[3]=e[3],t):new o(e[0],e[1],e[2],e[3])},o.fromScale=function(e,t){return r(t)?(t[0]=e.x,t[1]=0,t[2]=0,t[3]=e.y,t):new o(e.x,0,0,e.y)},o.fromUniformScale=function(e,t){return r(t)?(t[0]=e,t[1]=0,t[2]=0,t[3]=e,t):new o(e,0,0,e)},o.fromRotation=function(e,t){var n=Math.cos(e),a=Math.sin(e);return r(t)?(t[0]=n,t[1]=a,t[2]=-a,t[3]=n,t):new o(n,-a,a,n)},o.toArray=function(e,t){return r(t)?(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t):[e[0],e[1],e[2],e[3]]},o.getElementIndex=function(e,t){return 2*e+t},o.getColumn=function(e,t,n){var r=2*t,a=e[r],i=e[r+1];return n.x=a,n.y=i,n},o.setColumn=function(e,t,n,r){r=o.clone(e,r);var a=2*t;return r[a]=n.x,r[a+1]=n.y,r},o.getRow=function(e,t,n){var r=e[t],a=e[t+2];return n.x=r,n.y=a,n},o.setRow=function(e,t,n,r){return r=o.clone(e,r),r[t]=n.x,r[t+2]=n.y,r};var u=new e;o.getScale=function(t,n){return n.x=e.magnitude(e.fromElements(t[0],t[1],u)),n.y=e.magnitude(e.fromElements(t[2],t[3],u)),n};var s=new e;return o.getMaximumScale=function(t){return o.getScale(t,s),e.maximumComponent(s)},o.multiply=function(e,t,n){var r=e[0]*t[0]+e[2]*t[1],a=e[0]*t[2]+e[2]*t[3],i=e[1]*t[0]+e[3]*t[1],o=e[1]*t[2]+e[3]*t[3];return n[0]=r,n[1]=i,n[2]=a,n[3]=o,n},o.add=function(e,t,n){return n[0]=e[0]+t[0],n[1]=e[1]+t[1],n[2]=e[2]+t[2],n[3]=e[3]+t[3],n},o.subtract=function(e,t,n){return n[0]=e[0]-t[0],n[1]=e[1]-t[1],n[2]=e[2]-t[2],n[3]=e[3]-t[3],n},o.multiplyByVector=function(e,t,n){var r=e[0]*t.x+e[2]*t.y,a=e[1]*t.x+e[3]*t.y;return n.x=r,n.y=a,n},o.multiplyByScalar=function(e,t,n){return n[0]=e[0]*t,n[1]=e[1]*t,n[2]=e[2]*t,n[3]=e[3]*t,n},o.multiplyByScale=function(e,t,n){return n[0]=e[0]*t.x,n[1]=e[1]*t.x,n[2]=e[2]*t.y,n[3]=e[3]*t.y,n},o.negate=function(e,t){return t[0]=-e[0],t[1]=-e[1],t[2]=-e[2],t[3]=-e[3],t},o.transpose=function(e,t){var n=e[0],r=e[2],a=e[1],i=e[3];return t[0]=n,t[1]=r,t[2]=a,t[3]=i,t},o.abs=function(e,t){return t[0]=Math.abs(e[0]),t[1]=Math.abs(e[1]),t[2]=Math.abs(e[2]),t[3]=Math.abs(e[3]),t},o.equals=function(e,t){return e===t||r(e)&&r(t)&&e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]&&e[3]===t[3]},o.equalsArray=function(e,t,n){return e[0]===t[n]&&e[1]===t[n+1]&&e[2]===t[n+2]&&e[3]===t[n+3]},o.equalsEpsilon=function(e,t,n){return e===t||r(e)&&r(t)&&Math.abs(e[0]-t[0])<=n&&Math.abs(e[1]-t[1])<=n&&Math.abs(e[2]-t[2])<=n&&Math.abs(e[3]-t[3])<=n},o.IDENTITY=i(new o(1,0,0,1)),o.ZERO=i(new o(0,0,0,0)),o.COLUMN0ROW0=0,o.COLUMN0ROW1=1,o.COLUMN1ROW0=2,o.COLUMN1ROW1=3,a(o.prototype,{length:{get:function(){return o.packedLength}}}),o.prototype.clone=function(e){return o.clone(this,e)},o.prototype.equals=function(e){return o.equals(this,e)},o.prototype.equalsEpsilon=function(e,t){return o.equalsEpsilon(this,e,t)},o.prototype.toString=function(){return"("+this[0]+", "+this[2]+")\n("+this[1]+", "+this[3]+")"},o}),define("Core/RectangleGeometryLibrary",["./Cartesian3","./Cartographic","./defined","./DeveloperError","./GeographicProjection","./Math","./Matrix2","./Rectangle"],function(e,t,n,r,a,i,o,u){"use strict";function s(t,n,r,a,i,u,s){var c=Math.cos(n),l=a*c,E=r*c,f=Math.sin(n),p=a*f,m=r*f;d=_.project(t,d),d=e.subtract(d,y,d);var T=o.fromRotation(n,h);d=o.multiplyByVector(T,d,d),d=e.add(d,y,d),t=_.unproject(d,t),u-=1,s-=1;var R=t.latitude,A=R+u*m,v=R-l*s,S=R-l*s+u*m,N=Math.max(R,A,v,S),g=Math.min(R,A,v,S),I=t.longitude,M=I+u*E,O=I+s*p,x=I+s*p+u*E;return{north:N,south:g,east:Math.max(I,M,O,x),west:Math.min(I,M,O,x),granYCos:l,granYSin:p,granXCos:E,granXSin:m,nwCorner:t}}var c=Math.cos,l=Math.sin,E=Math.sqrt,f={};f.computePosition=function(e,t,r,a,i){var o=e.ellipsoid.radiiSquared,u=e.nwCorner,s=e.rectangle,f=u.latitude-e.granYCos*t+r*e.granXSin,h=c(f),d=l(f),p=o.z*d,y=u.longitude+t*e.granYSin+r*e.granXCos,_=h*c(y),m=h*l(y),T=o.x*_,R=o.y*m,A=E(T*_+R*m+p*d);if(a.x=T/A,a.y=R/A,a.z=p/A,n(e.vertexFormat)&&e.vertexFormat.st){var v=e.stNwCorner;n(v)?(f=v.latitude-e.stGranYCos*t+r*e.stGranXSin,y=v.longitude+t*e.stGranYSin+r*e.stGranXCos,i.x=(y-e.stWest)*e.lonScalar,i.y=(f-e.stSouth)*e.latScalar):(i.x=(y-s.west)*e.lonScalar,i.y=(f-s.south)*e.latScalar)}};var h=new o,d=new e,p=new t,y=new e,_=new a;return f.computeOptions=function(e,t,n,r){var a,o,c,l,E,f=e._granularity,h=e._ellipsoid,d=e._surfaceHeight,m=e._rotation,T=e._stRotation,R=e._extrudedHeight,A=t.east,v=t.west,S=t.north,N=t.south,g=S-N;v>A?(E=i.TWO_PI-v+A,a=Math.ceil(E/f)+1,o=Math.ceil(g/f)+1,c=E/(a-1),l=g/(o-1)):(E=A-v,a=Math.ceil(E/f)+1,o=Math.ceil(g/f)+1,c=E/(a-1),l=g/(o-1)),n=u.northwest(t,n);var I=u.center(t,p);0===m&&0===T||(I.longitude1||m>1))for(var A=0;A0;t-=E)Y=3*t,K=x(K,J,Y,R,g),J+=6,a.st&&(Q=w(Q,$,2*t,I),$+=4),r&&(ee+=3,j[ee++]=C[Y],j[ee++]=C[Y+1],j[ee++]=C[Y+2]);for(t=E-1;t>=0;t--)Y=3*t,K=x(K,J,Y,R,g),J+=6,a.st&&(Q=w(Q,$,2*t,I),$+=4),r&&(ee+=3,j[ee++]=C[Y],j[ee++]=C[Y+1],j[ee++]=C[Y+2]);var ne=M(K,a,h);a.st&&(ne.attributes.st=new f({componentDatatype:i.FLOAT,componentsPerAttribute:2,values:Q})),r&&(ne.attributes.extrudeDirection=new f({componentDatatype:i.FLOAT,componentsPerAttribute:3,values:j}));var re,ae,ie,oe,ue=y.createTypedArray(Z,6*k);A=K.length/3;var se=0;for(t=0;t