/** * Cesium - https://github.com/AnalyticalGraphicsInc/cesium * * Copyright 2011-2016 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/freezeObject",["./defined"],function(e){"use strict";var t=Object.freeze;return e(t)||(t=function(e){return e}),t}),define("Core/defaultValue",["./freezeObject"],function(e){"use strict";function t(e,t){return void 0!==e?e:t}return t.EMPTY_OBJECT=e({}),t}),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/isArray",["./defined"],function(e){"use strict";var t=Array.isArray;return e(t)||(t=function(e){return"[object Array]"===Object.prototype.toString.call(e)}),t}),define("Core/Check",["./defaultValue","./defined","./DeveloperError","./isArray"],function(e,t,n,r){"use strict";function i(e){return e+" was required but undefined."}function a(e,t,n){return"Expected "+n+" to be typeof "+t+", got "+e}var o={};return o.typeOf={},o.numeric={},o.defined=function(e,r){if(!t(e))throw new n(i(r))},o.numeric.maximum=function(e,t){if(o.typeOf.number(e),o.typeOf.number(t),e>t)throw new n("Expected "+e+" to be at most "+t)},o.numeric.minimum=function(e,t){if(o.typeOf.number(e),o.typeOf.number(t),e>>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,e>>>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 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(e){return e>0?1:e<0?-1:0},i.signNotZero=function(e){return e<0?-1:1},i.toSNorm=function(e,n){return n=t(n,255),Math.round((.5*i.clamp(e,-1,1)+.5)*n)},i.fromSNorm=function(e,n){return n=t(n,255),i.clamp(e,0,n)/n*2-1},i.sinh=function(e){var t=Math.pow(Math.E,e),n=Math.pow(Math.E,-1*e);return.5*(t-n)},i.cosh=function(e){var t=Math.pow(Math.E,e),n=Math.pow(Math.E,-1*e);return.5*(t+n)},i.lerp=function(e,t,n){return(1-n)*e+n*t},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(e){return e*i.RADIANS_PER_DEGREE},i.toDegrees=function(e){return e*i.DEGREES_PER_RADIAN},i.convertLongitudeRange=function(e){var t=i.TWO_PI,n=e-Math.floor(e/t)*t;return n<-Math.PI?n+t:n>=Math.PI?n-t:n},i.clampToLatitudeRange=function(e){return i.clamp(e,-1*i.PI_OVER_TWO,i.PI_OVER_TWO)},i.negativePiToPi=function(e){return i.zeroToTwoPi(e+i.PI)-i.PI},i.zeroToTwoPi=function(e){var t=i.mod(e,i.TWO_PI);return Math.abs(t)i.EPSILON14?i.TWO_PI:t},i.mod=function(e,t){return(e%t+t)%t},i.equalsEpsilon=function(e,n,r,i){i=t(i,r);var a=Math.abs(e-n);return a<=i||a<=r*Math.max(Math.abs(e),Math.abs(n))};var a=[1];i.factorial=function(e){var t=a.length;if(e>=t)for(var n=a[t-1],r=t;r<=e;r++)a.push(n*r);return a[e]},i.incrementWrap=function(e,n,r){return r=t(r,0),++e,e>n&&(e=r),e},i.isPowerOfTwo=function(e){return 0!==e&&0===(e&e-1)},i.nextPowerOfTwo=function(e){return--e,e|=e>>1,e|=e>>2,e|=e>>4,e|=e>>8,e|=e>>16,++e,e},i.clamp=function(e,t,n){return en?n:e};var o=new e;return i.setRandomNumberSeed=function(t){o=new e(t)},i.nextRandomNumber=function(){return o.random()},i.acosClamped=function(e){return Math.acos(i.clamp(e,-1,1))},i.asinClamped=function(e){return Math.asin(i.clamp(e,-1,1))},i.chordLength=function(e,t){return 2*t*Math.sin(.5*e)},i.logBase=function(e,t){return Math.log(e)/Math.log(t)},i.fog=function(e,t){var n=e*t;return 1-Math.exp(-(n*n))},i}),define("Core/Cartesian3",["./Check","./defaultValue","./defined","./DeveloperError","./freezeObject","./Math"],function(e,t,n,r,i,a){"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 i=e.clock,a=e.cone,u=t(e.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(e,t,r,i){return n(i)?(i.x=e,i.y=t,i.z=r,i):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,i){return r=t(r,0),n(i)||(i=new o),i.x=e[r++],i.y=e[r++],i.z=e[r],i},o.packArray=function(e,t){var r=e.length;n(t)?t.length=3*r:t=new Array(3*r);for(var i=0;ir.EPSILON12);return t(c)?(c.x=E*C,c.y=l*g,c.z=_*v,c):new e(E*C,l*g,_*v)}var a=new e,o=new e;return i}),define("Core/Cartographic",["./Cartesian3","./defaultValue","./defined","./DeveloperError","./freezeObject","./Math","./scaleToGeodeticSurface"],function(e,t,n,r,i,a,o){"use strict";function u(e,n,r){this.longitude=t(e,0),this.latitude=t(n,0),this.height=t(r,0)}u.fromRadians=function(e,r,i,a){return i=t(i,0),n(a)?(a.longitude=e,a.latitude=r,a.height=i,a):new u(e,r,i)},u.fromDegrees=function(e,t,n,r){return e=a.toRadians(e),t=a.toRadians(t),u.fromRadians(e,t,n,r)};var s=new e,c=new e,E=new e,l=new e(1/6378137,1/6378137,1/6356752.314245179),_=new e(1/40680631590769,1/40680631590769,1/40408299984661.445),f=a.EPSILON1;return u.fromCartesian=function(t,r,i){var T=n(r)?r.oneOverRadii:l,R=n(r)?r.oneOverRadiiSquared:_,h=n(r)?r._centerToleranceSquared:f,d=o(t,T,R,h,c);if(n(d)){var A=e.multiplyComponents(d,R,s);A=e.normalize(A,A);var N=e.subtract(t,d,E),y=Math.atan2(A.y,A.x),S=Math.asin(A.z),I=a.sign(e.dot(N,t))*e.magnitude(N);return n(i)?(i.longitude=y,i.latitude=S,i.height=I,i):new u(y,S,I)}},u.clone=function(e,t){if(n(e))return n(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||n(e)&&n(t)&&e.longitude===t.longitude&&e.latitude===t.latitude&&e.height===t.height},u.equalsEpsilon=function(e,t,r){return e===t||n(e)&&n(t)&&Math.abs(e.longitude-t.longitude)<=r&&Math.abs(e.latitude-t.latitude)<=r&&Math.abs(e.height-t.height)<=r},u.ZERO=i(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","./defaultValue","./defined","./defineProperties","./DeveloperError","./freezeObject","./Math","./scaleToGeodeticSurface"],function(e,t,n,r,i,a,o,u,s){"use strict";function c(t,r,i,a){r=n(r,0),i=n(i,0),a=n(a,0),t._radii=new e(r,i,a),t._radiiSquared=new e(r*r,i*i,a*a),t._radiiToTheFourth=new e(r*r*r*r,i*i*i*i,a*a*a*a),t._oneOverRadii=new e(0===r?0:1/r,0===i?0:1/i,0===a?0:1/a),t._oneOverRadiiSquared=new e(0===r?0:1/(r*r),0===i?0:1/(i*i),0===a?0:1/(a*a)),t._minimumRadius=Math.min(r,i,a),t._maximumRadius=Math.max(r,i,a),t._centerToleranceSquared=u.EPSILON1,0!==t._radiiSquared.z&&(t._sqauredXOverSquaredZ=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._sqauredXOverSquaredZ=void 0,c(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(r(t)){var i=t._radii;return r(n)?(e.clone(i,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(i.x,i.y,i.z)}},E.fromCartesian3=function(e,t){return r(t)||(t=new E),r(e)?(c(t,e.x,e.y,e.z),t):t},E.WGS84=o(new E(6378137,6378137,6356752.314245179)),E.UNIT_SPHERE=o(new E(1,1,1)),E.MOON=o(new E(u.LUNAR_RADIUS,u.LUNAR_RADIUS,u.LUNAR_RADIUS)),E.prototype.clone=function(e){return E.clone(this,e)},E.packedLength=e.packedLength,E.pack=function(t,r,i){return i=n(i,0),e.pack(t._radii,r,i),r},E.unpack=function(t,r,i){r=n(r,0);var a=e.unpack(t,r);return E.fromCartesian3(a,i)},E.prototype.geocentricSurfaceNormal=e.normalize,E.prototype.geodeticSurfaceNormalCartographic=function(t,n){var i=t.longitude,a=t.latitude,o=Math.cos(a),u=o*Math.cos(i),s=o*Math.sin(i),c=Math.sin(a);return r(n)||(n=new e),n.x=u,n.y=s,n.z=c,e.normalize(n,n)},E.prototype.geodeticSurfaceNormal=function(t,n){return r(n)||(n=new e),n=e.multiplyComponents(t,this._oneOverRadiiSquared,n),e.normalize(n,n)};var l=new e,_=new e;E.prototype.cartographicToCartesian=function(t,n){var i=l,a=_;this.geodeticSurfaceNormalCartographic(t,i),e.multiplyComponents(this._radiiSquared,i,a);var o=Math.sqrt(e.dot(i,a));return e.divideByScalar(a,o,a),e.multiplyByScalar(i,t.height,i),r(n)||(n=new e),e.add(a,i,n)},E.prototype.cartographicArrayToCartesianArray=function(e,t){var n=e.length;r(t)?t.length=n:t=new Array(n);for(var i=0;i=this._radii.z-i))return a},E}),define("Core/Rectangle",["./Cartographic","./defaultValue","./defined","./defineProperties","./DeveloperError","./Ellipsoid","./freezeObject","./Math"],function(e,t,n,r,i,a,o,u){"use strict";function s(e,n,r,i){this.west=t(e,0),this.south=t(n,0),this.east=t(r,0),this.north=t(i,0)}r(s.prototype,{width:{get:function(){return s.computeWidth(this)}},height:{get:function(){return s.computeHeight(this)}}}),s.packedLength=4,s.pack=function(e,n,r){return r=t(r,0),n[r++]=e.west,n[r++]=e.south,n[r++]=e.east,n[r]=e.north,n},s.unpack=function(e,r,i){return r=t(r,0),n(i)||(i=new s),i.west=e[r++],i.south=e[r++],i.east=e[r++],i.north=e[r],i},s.computeWidth=function(e){var t=e.east,n=e.west;return t=0?f.longitude:f.longitude+u.TWO_PI;a=Math.min(a,T),o=Math.max(o,T)}return i-r>o-a&&(r=a,i=o,i>u.PI&&(i-=u.TWO_PI),r>u.PI&&(r-=u.TWO_PI)),n(t)?(t.west=r,t.south=c,t.east=i,t.north=E,t):new s(r,c,i,E)},s.fromCartesianArray=function(e,t,r){for(var i=Number.MAX_VALUE,a=-Number.MAX_VALUE,o=Number.MAX_VALUE,c=-Number.MAX_VALUE,E=Number.MAX_VALUE,l=-Number.MAX_VALUE,_=0,f=e.length;_=0?T.longitude:T.longitude+u.TWO_PI;o=Math.min(o,R),c=Math.max(c,R)}return a-i>c-o&&(i=o,a=c,a>u.PI&&(a-=u.TWO_PI),i>u.PI&&(i-=u.TWO_PI)),n(r)?(r.west=i,r.south=E,r.east=a,r.north=l,r):new s(i,E,a,l)},s.clone=function(e,t){if(n(e))return n(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||n(e)&&n(t)&&e.west===t.west&&e.south===t.south&&e.east===t.east&&e.north===t.north},s.prototype.equalsEpsilon=function(e,t){return n(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,r){return n(r)?(r.longitude=t.west,r.latitude=t.south,r.height=0,r):new e(t.west,t.south)},s.northwest=function(t,r){return n(r)?(r.longitude=t.west,r.latitude=t.north,r.height=0,r):new e(t.west,t.north)},s.northeast=function(t,r){return n(r)?(r.longitude=t.east,r.latitude=t.north,r.height=0,r):new e(t.east,t.north)},s.southeast=function(t,r){return n(r)?(r.longitude=t.east,r.latitude=t.south,r.height=0,r):new e(t.east,t.south)},s.center=function(t,r){var i=t.east,a=t.west;i0?i+=u.TWO_PI:o0&&(o+=u.TWO_PI),i=f))return n(r)?(r.west=E,r.south=_,r.east=l,r.north=f,r):new s(E,_,l,f)}},s.simpleIntersection=function(e,t,r){var i=Math.max(e.west,t.west),a=Math.max(e.south,t.south),o=Math.min(e.east,t.east),u=Math.min(e.north,t.north);if(!(a>=u||i>=o))return n(r)?(r.west=i,r.south=a,r.east=o,r.north=u,r):new s(i,a,o,u)},s.union=function(e,t,r){n(r)||(r=new s);var i=e.east,a=e.west,o=t.east,c=t.west;i0?i+=u.TWO_PI:o0&&(o+=u.TWO_PI),ii||u.equalsEpsilon(n,i,u.EPSILON14))&&(n=e.south&&r<=e.north};var c=new e;return s.subsample=function(e,r,i,o){r=t(r,a.WGS84),i=t(i,0),n(o)||(o=[]);var E=0,l=e.north,_=e.south,f=e.east,T=e.west,R=c;R.height=i,R.longitude=T,R.latitude=l,o[E]=r.cartographicToCartesian(R,o[E]),E++,R.longitude=f,o[E]=r.cartographicToCartesian(R,o[E]),E++,R.latitude=_,o[E]=r.cartographicToCartesian(R,o[E]),E++,R.longitude=T,o[E]=r.cartographicToCartesian(R,o[E]),E++,l<0?R.latitude=l:_>0?R.latitude=_:R.latitude=0;for(var h=1;h<8;++h)R.longitude=-Math.PI+h*u.PI_OVER_TWO,s.contains(e,R)&&(o[E]=r.cartographicToCartesian(R,o[E]),E++);return 0===R.latitude&&(R.longitude=T,o[E]=r.cartographicToCartesian(R,o[E]),E++,R.longitude=f,o[E]=r.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/GeographicProjection",["./Cartesian3","./Cartographic","./defaultValue","./defined","./defineProperties","./DeveloperError","./Ellipsoid"],function(e,t,n,r,i,a,o){"use strict";function u(e){this._ellipsoid=n(e,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(t,n){var i=this._semimajorAxis,a=t.longitude*i,o=t.latitude*i,u=t.height;return r(n)?(n.x=a,n.y=o,n.z=u,n):new e(a,o,u)},u.prototype.unproject=function(e,n){var i=this._oneOverSemimajorAxis,a=e.x*i,o=e.y*i,u=e.z;return r(n)?(n.longitude=a,n.latitude=o,n.height=u,n):new t(a,o,u)},u}),define("Core/Intersect",["./freezeObject"],function(e){"use strict";var t={OUTSIDE:-1,INTERSECTING:0,INSIDE:1};return e(t)}),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","./defaultValue","./defined","./defineProperties","./DeveloperError","./freezeObject","./Math"],function(e,t,n,r,i,a,o){"use strict";function u(e,n,r,i,a,o,u,s,c){this[0]=t(e,0),this[1]=t(i,0),this[2]=t(u,0),this[3]=t(n,0),this[4]=t(a,0),this[5]=t(s,0),this[6]=t(r,0),this[7]=t(o,0),this[8]=t(c,0)}function s(e){for(var t=0,n=0;n<9;++n){var r=e[n];t+=r*r}return Math.sqrt(t)}function c(e){for(var t=0,n=0;n<3;++n){var r=e[u.getElementIndex(T[n],f[n])];t+=2*r*r}return Math.sqrt(t)}function E(e,t){for(var n=o.EPSILON15,r=0,i=1,a=0;a<3;++a){var s=Math.abs(e[u.getElementIndex(T[a],f[a])]);s>r&&(i=a,r=s)}var c=1,E=0,l=f[i],_=T[i];if(Math.abs(e[u.getElementIndex(_,l)])>n){var R,h=e[u.getElementIndex(_,_)],d=e[u.getElementIndex(l,l)],A=e[u.getElementIndex(_,l)],N=(h-d)/2/A;R=N<0?-1/(-N+Math.sqrt(1+N*N)):1/(N+Math.sqrt(1+N*N)),c=1/Math.sqrt(1+R*R),E=R*c}return t=u.clone(u.IDENTITY,t),t[u.getElementIndex(l,l)]=t[u.getElementIndex(_,_)]=c,t[u.getElementIndex(_,l)]=E,t[u.getElementIndex(l,_)]=-E,t}u.packedLength=9,u.pack=function(e,n,r){return r=t(r,0),n[r++]=e[0],n[r++]=e[1],n[r++]=e[2],n[r++]=e[3],n[r++]=e[4],n[r++]=e[5],n[r++]=e[6],n[r++]=e[7],n[r++]=e[8],n},u.unpack=function(e,r,i){return r=t(r,0),n(i)||(i=new u),i[0]=e[r++],i[1]=e[r++],i[2]=e[r++],i[3]=e[r++],i[4]=e[r++],i[5]=e[r++],i[6]=e[r++],i[7]=e[r++],i[8]=e[r++],i},u.clone=function(e,t){if(n(e))return n(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 u(e[0],e[3],e[6],e[1],e[4],e[7],e[2],e[5],e[8])},u.fromArray=function(e,r,i){return r=t(r,0),n(i)||(i=new u),i[0]=e[r],i[1]=e[r+1],i[2]=e[r+2],i[3]=e[r+3],i[4]=e[r+4],i[5]=e[r+5],i[6]=e[r+6],i[7]=e[r+7],i[8]=e[r+8],i},u.fromColumnMajorArray=function(e,t){return u.clone(e,t)},u.fromRowMajorArray=function(e,t){return n(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 u(e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8])},u.fromQuaternion=function(e,t){var r=e.x*e.x,i=e.x*e.y,a=e.x*e.z,o=e.x*e.w,s=e.y*e.y,c=e.y*e.z,E=e.y*e.w,l=e.z*e.z,_=e.z*e.w,f=e.w*e.w,T=r-s-l+f,R=2*(i-_),h=2*(a+E),d=2*(i+_),A=-r+s-l+f,N=2*(c-o),y=2*(a-E),S=2*(c+o),I=-r-s+l+f;return n(t)?(t[0]=T,t[1]=d,t[2]=y,t[3]=R,t[4]=A,t[5]=S,t[6]=h,t[7]=N,t[8]=I,t):new u(T,R,h,d,A,N,y,S,I)},u.fromHeadingPitchRoll=function(e,t){var r=Math.cos(-e.pitch),i=Math.cos(-e.heading),a=Math.cos(e.roll),o=Math.sin(-e.pitch),s=Math.sin(-e.heading),c=Math.sin(e.roll),E=r*i,l=-a*s+c*o*i,_=c*s+a*o*i,f=r*s,T=a*i+c*o*s,R=-o*a+a*o*s,h=-o,d=c*r,A=a*r;return n(t)?(t[0]=E,t[1]=f,t[2]=h,t[3]=l,t[4]=T,t[5]=d,t[6]=_,t[7]=R,t[8]=A,t):new u(E,l,_,f,T,R,h,d,A)},u.fromScale=function(e,t){return n(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 u(e.x,0,0,0,e.y,0,0,0,e.z)},u.fromUniformScale=function(e,t){return n(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 u(e,0,0,0,e,0,0,0,e)},u.fromCrossProduct=function(e,t){return n(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 u(0,-e.z,e.y,e.z,0,-e.x,-e.y,e.x,0)},u.fromRotationX=function(e,t){var r=Math.cos(e),i=Math.sin(e);return n(t)?(t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=r,t[5]=i,t[6]=0,t[7]=-i,t[8]=r,t):new u(1,0,0,0,r,-i,0,i,r)},u.fromRotationY=function(e,t){var r=Math.cos(e),i=Math.sin(e);return n(t)?(t[0]=r,t[1]=0,t[2]=-i,t[3]=0,t[4]=1,t[5]=0,t[6]=i,t[7]=0,t[8]=r,t):new u(r,0,i,0,1,0,-i,0,r)},u.fromRotationZ=function(e,t){var r=Math.cos(e),i=Math.sin(e);return n(t)?(t[0]=r,t[1]=i,t[2]=0,t[3]=-i,t[4]=r,t[5]=0,t[6]=0,t[7]=0,t[8]=1,t):new u(r,-i,0,i,r,0,0,0,1)},u.toArray=function(e,t){return n(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]]},u.getElementIndex=function(e,t){return 3*e+t},u.getColumn=function(e,t,n){var r=3*t,i=e[r],a=e[r+1],o=e[r+2];return n.x=i,n.y=a,n.z=o,n},u.setColumn=function(e,t,n,r){r=u.clone(e,r);var i=3*t;return r[i]=n.x,r[i+1]=n.y,r[i+2]=n.z,r},u.getRow=function(e,t,n){var r=e[t],i=e[t+3],a=e[t+6];return n.x=r,n.y=i,n.z=a,n},u.setRow=function(e,t,n,r){return r=u.clone(e,r),r[t]=n.x,r[t+3]=n.y,r[t+6]=n.z,r};var l=new e;u.getScale=function(t,n){return n.x=e.magnitude(e.fromElements(t[0],t[1],t[2],l)),n.y=e.magnitude(e.fromElements(t[3],t[4],t[5],l)),n.z=e.magnitude(e.fromElements(t[6],t[7],t[8],l)),n};var _=new e;u.getMaximumScale=function(t){return u.getScale(t,_),e.maximumComponent(_)},u.multiply=function(e,t,n){var r=e[0]*t[0]+e[3]*t[1]+e[6]*t[2],i=e[1]*t[0]+e[4]*t[1]+e[7]*t[2],a=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],E=e[1]*t[6]+e[4]*t[7]+e[7]*t[8],l=e[2]*t[6]+e[5]*t[7]+e[8]*t[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]=l,n},u.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},u.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},u.multiplyByVector=function(e,t,n){var r=t.x,i=t.y,a=t.z,o=e[0]*r+e[3]*i+e[6]*a,u=e[1]*r+e[4]*i+e[7]*a,s=e[2]*r+e[5]*i+e[8]*a;return n.x=o,n.y=u,n.z=s,n},u.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},u.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},u.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},u.transpose=function(e,t){var n=e[0],r=e[3],i=e[6],a=e[1],o=e[4],u=e[7],s=e[2],c=e[5],E=e[8];return t[0]=n,t[1]=r,t[2]=i,t[3]=a,t[4]=o,t[5]=u,t[6]=s,t[7]=c,t[8]=E,t};var f=[1,0,0],T=[2,2,1],R=new u,h=new u;return u.computeEigenDecomposition=function(e,t){var r=o.EPSILON20,i=10,a=0,l=0;n(t)||(t={});for(var _=t.unitary=u.clone(u.IDENTITY,t.unitary),f=t.diagonal=u.clone(e,t.diagonal),T=r*s(f);lT;)E(f,R),u.transpose(R,h),u.multiply(f,R,f),u.multiply(h,f,f),u.multiply(_,R,_),++a>2&&(++l,a=0);return t},u.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},u.determinant=function(e){var t=e[0],n=e[3],r=e[6],i=e[1],a=e[4],o=e[7],u=e[2],s=e[5],c=e[8];return t*(a*c-s*o)+i*(s*r-n*c)+u*(n*o-a*r)},u.inverse=function(e,t){var n=e[0],r=e[1],i=e[2],a=e[3],o=e[4],s=e[5],c=e[6],E=e[7],l=e[8],_=u.determinant(e);t[0]=o*l-E*s,t[1]=E*i-r*l,t[2]=r*s-o*i,t[3]=c*s-a*l,t[4]=n*l-c*i,t[5]=a*i-n*s,t[6]=a*E-c*o,t[7]=c*r-n*E,t[8]=n*o-a*r;var f=1/_;return u.multiplyByScalar(t,f,t)},u.equals=function(e,t){return e===t||n(e)&&n(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]},u.equalsEpsilon=function(e,t,r){return e===t||n(e)&&n(t)&&Math.abs(e[0]-t[0])<=r&&Math.abs(e[1]-t[1])<=r&&Math.abs(e[2]-t[2])<=r&&Math.abs(e[3]-t[3])<=r&&Math.abs(e[4]-t[4])<=r&&Math.abs(e[5]-t[5])<=r&&Math.abs(e[6]-t[6])<=r&&Math.abs(e[7]-t[7])<=r&&Math.abs(e[8]-t[8])<=r; },u.IDENTITY=a(new u(1,0,0,0,1,0,0,0,1)),u.ZERO=a(new u(0,0,0,0,0,0,0,0,0)),u.COLUMN0ROW0=0,u.COLUMN0ROW1=1,u.COLUMN0ROW2=2,u.COLUMN1ROW0=3,u.COLUMN1ROW1=4,u.COLUMN1ROW2=5,u.COLUMN2ROW0=6,u.COLUMN2ROW1=7,u.COLUMN2ROW2=8,r(u.prototype,{length:{get:function(){return u.packedLength}}}),u.prototype.clone=function(e){return u.clone(this,e)},u.prototype.equals=function(e){return u.equals(this,e)},u.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]},u.prototype.equalsEpsilon=function(e,t){return u.equalsEpsilon(this,e,t)},u.prototype.toString=function(){return"("+this[0]+", "+this[3]+", "+this[6]+")\n("+this[1]+", "+this[4]+", "+this[7]+")\n("+this[2]+", "+this[5]+", "+this[8]+")"},u}),define("Core/Cartesian4",["./defaultValue","./defined","./DeveloperError","./freezeObject","./Math"],function(e,t,n,r,i){"use strict";function a(t,n,r,i){this.x=e(t,0),this.y=e(n,0),this.z=e(r,0),this.w=e(i,0)}a.fromElements=function(e,n,r,i,o){return t(o)?(o.x=e,o.y=n,o.z=r,o.w=i,o):new a(e,n,r,i)},a.fromColor=function(e,n){return t(n)?(n.x=e.red,n.y=e.green,n.z=e.blue,n.w=e.alpha,n):new a(e.red,e.green,e.blue,e.alpha)},a.clone=function(e,n){if(t(e))return t(n)?(n.x=e.x,n.y=e.y,n.z=e.z,n.w=e.w,n):new a(e.x,e.y,e.z,e.w)},a.packedLength=4,a.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},a.unpack=function(n,r,i){return r=e(r,0),t(i)||(i=new a),i.x=n[r++],i.y=n[r++],i.z=n[r++],i.w=n[r],i},a.packArray=function(e,n){var r=e.length;t(n)?n.length=4*r:n=new Array(4*r);for(var i=0;is.x&&e.clone(i,s),xc.y&&e.clone(i,c),CE.z&&e.clone(i,E)}var g=e.magnitudeSquared(e.subtract(s,a,y)),v=e.magnitudeSquared(e.subtract(c,o,y)),U=e.magnitudeSquared(e.subtract(E,u,y)),L=a,w=s,F=g;v>F&&(F=v,L=o,w=c),U>F&&(F=U,L=u,w=E);var P=S;P.x=.5*(L.x+w.x),P.y=.5*(L.y+w.y),P.z=.5*(L.z+w.z);var D=e.magnitudeSquared(e.subtract(w,P,y)),B=Math.sqrt(D),z=I;z.x=a.x,z.y=o.y,z.z=u.z;var G=m;G.x=s.x,G.y=c.y,G.z=E.z;var b=e.multiplyByScalar(e.add(z,G,y),.5,p),X=0;for(M=0;MX&&(X=H);var q=e.magnitudeSquared(e.subtract(i,P,y));if(q>D){var V=Math.sqrt(q);B=.5*(B+V),D=B*B;var W=V-B;P.x=(B*P.x+W*i.x)/V,P.y=(B*P.y+W*i.y)/V,P.z=(B*P.z+W*i.z)/V}}return Bl.x&&e.clone(u,l),vM.y&&e.clone(u,M),UO.z&&e.clone(u,O)}var L=e.magnitudeSquared(e.subtract(l,s,y)),w=e.magnitudeSquared(e.subtract(M,c,y)),F=e.magnitudeSquared(e.subtract(O,E,y)),P=s,D=l,B=L;w>B&&(B=w,P=c,D=M),F>B&&(B=F,P=E,D=O);var z=S;z.x=.5*(P.x+D.x),z.y=.5*(P.y+D.y),z.z=.5*(P.z+D.z);var G=e.magnitudeSquared(e.subtract(D,z,y)),b=Math.sqrt(G),X=I;X.x=s.x,X.y=c.y,X.z=E.z;var H=m;H.x=l.x,H.y=M.y,H.z=O.z;var q=e.multiplyByScalar(e.add(X,H,y),.5,p),V=0;for(C=0;CV&&(V=W);var Y=e.magnitudeSquared(e.subtract(u,z,y));if(Y>G){var Z=Math.sqrt(Y);b=.5*(b+Z),G=b*b;var k=Z-b;z.x=(b*z.x+k*u.x)/Z,z.y=(b*z.y+k*u.y)/Z,z.z=(b*z.z+k*u.z)/Z}}return bc.x&&e.clone(a,c),CE.y&&e.clone(a,E),gl.z&&e.clone(a,l)}var v=e.magnitudeSquared(e.subtract(c,o,y)),U=e.magnitudeSquared(e.subtract(E,u,y)),L=e.magnitudeSquared(e.subtract(l,s,y)),w=o,F=c,P=v;U>P&&(P=U,w=u,F=E),L>P&&(P=L,w=s,F=l);var D=S;D.x=.5*(w.x+F.x),D.y=.5*(w.y+F.y),D.z=.5*(w.z+F.z);var B=e.magnitudeSquared(e.subtract(F,D,y)),z=Math.sqrt(B),G=I;G.x=o.x,G.y=u.y,G.z=s.z;var b=m;b.x=c.x,b.y=E.y,b.z=l.z;var X=e.multiplyByScalar(e.add(G,b,y),.5,p),H=0;for(O=0;OH&&(H=q);var V=e.magnitudeSquared(e.subtract(a,D,y));if(V>B){var W=Math.sqrt(V);z=.5*(z+W),B=z*z;var Y=W-z;D.x=(z*D.x+Y*a.x)/W,D.y=(z*D.y+Y*a.y)/W,D.z=(z*D.z+Y*a.z)/W}}return z=E+s)return t.clone(i),i;if(s>=E+o)return n.clone(i),i;var l=.5*(o+E+s),f=e.multiplyByScalar(c,(-o+l)/E,D);return e.add(f,a,f),e.clone(f,i.center),i.radius=l,i};var B=new e;_.expand=function(t,n,r){r=_.clone(t,r);var i=e.magnitude(e.subtract(n,r.center,B));return i>r.radius&&(r.radius=i),r},_.intersectPlane=function(t,n){var r=t.center,i=t.radius,a=n.normal,o=e.dot(a,r)+n.distance;return o<-i?u.OUTSIDE:o=r.SIXTY_FOUR_KILOBYTES?new Uint32Array(t):new Uint16Array(t)},a.createTypedArrayFromArrayBuffer=function(e,t,n,i){return e>=r.SIXTY_FOUR_KILOBYTES?new Uint32Array(t,n,i):new Uint16Array(t,n,i)},n(a)}),define("ThirdParty/earcut-2.1.1",[],function(){"use strict";function e(e,n,i){i=i||2;var a=n&&n.length,o=a?n[0]*i:e.length,u=t(e,0,o,i,!0),c=[];if(!u)return c;var E,l,_,f,T,R,h;if(a&&(u=s(e,n,u,i)),e.length>80*i){E=_=e[0],l=f=e[1];for(var d=i;d_&&(_=T),R>f&&(f=R);h=Math.max(_-E,f-l)}return r(u,c,i,E,l,h),c}function t(e,t,n,r,i){var a,o;if(i===C(e,t,n,r)>0)for(a=t;a=t;a-=r)o=M(a,e[a],e[a+1],o);return o&&N(o,o.next)&&(O(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||!N(r,r.next)&&0!==A(r.prev,r,r.next))r=r.next;else{if(O(r),r=t=r.prev,r===r.next)return null;n=!0}while(n||r!==t);return t}function r(e,t,s,c,E,l,f){if(e){!f&&l&&_(e,c,E,l);for(var T,R,h=e;e.prev!==e.next;)if(T=e.prev,R=e.next,l?a(e,c,E,l):i(e))t.push(T.i/s),t.push(e.i/s),t.push(R.i/s),O(e),e=R.next,h=R.next;else if(e=R,e===h){f?1===f?(e=o(e,t,s),r(e,t,s,c,E,l,2)):2===f&&u(e,t,s,c,E,l):r(n(e),t,s,c,E,l,1);break}}}function i(e){var t=e.prev,n=e,r=e.next;if(A(t,n,r)>=0)return!1;for(var i=e.next.next;i!==e.prev;){if(h(t.x,t.y,n.x,n.y,r.x,r.y,i.x,i.y)&&A(i.prev,i,i.next)>=0)return!1;i=i.next}return!0}function a(e,t,n,r){var i=e.prev,a=e,o=e.next;if(A(i,a,o)>=0)return!1;for(var u=i.xa.x?i.x>o.x?i.x:o.x:a.x>o.x?a.x:o.x,E=i.y>a.y?i.y>o.y?i.y:o.y:a.y>o.y?a.y:o.y,l=T(u,s,t,n,r),_=T(c,E,t,n,r),f=e.nextZ;f&&f.z<=_;){if(f!==e.prev&&f!==e.next&&h(i.x,i.y,a.x,a.y,o.x,o.y,f.x,f.y)&&A(f.prev,f,f.next)>=0)return!1;f=f.nextZ}for(f=e.prevZ;f&&f.z>=l;){if(f!==e.prev&&f!==e.next&&h(i.x,i.y,a.x,a.y,o.x,o.y,f.x,f.y)&&A(f.prev,f,f.next)>=0)return!1;f=f.prevZ}return!0}function o(e,t,n){var r=e;do{var i=r.prev,a=r.next.next;!N(i,a)&&y(i,r,r.next,a)&&I(i,a)&&I(a,i)&&(t.push(i.i/n),t.push(r.i/n),t.push(a.i/n),O(r),O(r.next),r=e=a),r=r.next}while(r!==e);return r}function u(e,t,i,a,o,u){var s=e;do{for(var c=s.next.next;c!==s.prev;){if(s.i!==c.i&&d(s,c)){var E=p(s,c);return s=n(s,s.next),E=n(E,E.next),r(s,t,i,a,o,u),void r(E,t,i,a,o,u)}c=c.next}s=s.next}while(s!==e)}function s(e,r,i,a){var o,u,s,l,_,f=[];for(o=0,u=r.length;o=r.next.y){var u=r.x+(a-r.y)*(r.next.x-r.x)/(r.next.y-r.y);if(u<=i&&u>o){if(o=u,u===i){if(a===r.y)return r;if(a===r.next.y)return r.next}n=r.x=r.x&&r.x>=E&&h(an.x)&&I(r,e)&&(n=r,_=s)),r=r.next;return n}function _(e,t,n,r){var i=e;do null===i.z&&(i.z=T(i.x,i.y,t,n,r)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next;while(i!==e);i.prevZ.nextZ=null,i.prevZ=null,f(i)}function f(e){var t,n,r,i,a,o,u,s,c=1;do{for(n=e,e=null,a=null,o=0;n;){for(o++,r=n,u=0,t=0;t0||s>0&&r;)0===u?(i=r,r=r.nextZ,s--):0!==s&&r?n.z<=r.z?(i=n,n=n.nextZ,u--):(i=r,r=r.nextZ,s--):(i=n,n=n.nextZ,u--),a?a.nextZ=i:e=i,i.prevZ=a,a=i;n=r}a.nextZ=null,c*=2}while(o>1);return e}function T(e,t,n,r,i){return e=32767*(e-n)/i,t=32767*(t-r)/i,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 R(e){var t=e,n=e;do t.x=0&&(e-o)*(r-u)-(n-o)*(t-u)>=0&&(n-o)*(a-u)-(i-o)*(r-u)>=0}function d(e,t){return e.next.i!==t.i&&e.prev.i!==t.i&&!S(e,t)&&I(e,t)&&I(t,e)&&m(e,t)}function A(e,t,n){return(t.y-e.y)*(n.x-t.x)-(t.x-e.x)*(n.y-t.y)}function N(e,t){return e.x===t.x&&e.y===t.y}function y(e,t,n,r){return!!(N(e,t)&&N(n,r)||N(e,r)&&N(n,t))||A(e,t,n)>0!=A(e,t,r)>0&&A(n,r,e)>0!=A(n,r,t)>0}function S(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&&y(n,n.next,e,t))return!0;n=n.next}while(n!==e);return!1}function I(e,t){return A(e.prev,e,e.next)<0?A(e,t,e.next)>=0&&A(e,e.prev,t)>=0:A(e,t,e.prev)<0||A(e,e.next,t)<0}function m(e,t){var n=e,r=!1,i=(e.x+t.x)/2,a=(e.y+t.y)/2;do n.y>a!=n.next.y>a&&i<(n.next.x-n.x)*(a-n.y)/(n.next.y-n.y)+n.x&&(r=!r),n=n.next;while(n!==e);return r}function p(e,t){var n=new x(e.i,e.x,e.y),r=new x(t.i,t.x,t.y),i=e.next,a=t.prev;return e.next=t,t.prev=e,n.next=i,i.prev=n,r.next=n,n.prev=r,a.next=r,r.prev=a,r}function M(e,t,n,r){var i=new x(e,t,n);return r?(i.next=r.next,i.prev=r,r.next.prev=i,r.next=i):(i.prev=i,i.next=i),i}function O(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 x(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 C(e,t,n,r){for(var i=0,a=t,o=n-r;a0&&(r+=e[i-1].length,n.holes.push(r))}return n},e}),define("Core/Cartesian2",["./defaultValue","./defined","./DeveloperError","./freezeObject","./Math"],function(e,t,n,r,i){"use strict";function a(t,n){this.x=e(t,0),this.y=e(n,0)}a.fromElements=function(e,n,r){return t(r)?(r.x=e,r.y=n,r):new a(e,n)},a.clone=function(e,n){if(t(e))return t(n)?(n.x=e.x,n.y=e.y,n):new a(e.x,e.y)},a.fromCartesian3=a.clone,a.fromCartesian4=a.clone,a.packedLength=2,a.pack=function(t,n,r){return r=e(r,0),n[r++]=t.x,n[r]=t.y,n},a.unpack=function(n,r,i){return r=e(r,0),t(i)||(i=new a),i.x=n[r++],i.y=n[r],i},a.packArray=function(e,n){var r=e.length;t(n)?n.length=2*r:n=new Array(2*r);for(var i=0;i0?_.COUNTER_CLOCKWISE:_.CLOCKWISE},R.triangulate=function(n,r){var i=t.packArray(n);return e(i,r,2)};var h=new n,d=new n,A=new n,N=new n,y=new n,S=new n,I=new n;return R.computeSubdivision=function(e,t,o,u){u=i(u,E.RADIANS_PER_DEGREE);var _,f=o.slice(0),T=t.length,R=new Array(3*T),m=0;for(_=0;_0;){var v,U,L=f.pop(),w=f.pop(),F=f.pop(),P=n.fromArray(R,3*F,h),D=n.fromArray(R,3*w,d),B=n.fromArray(R,3*L,A),z=n.multiplyByScalar(n.normalize(P,N),x,N),G=n.multiplyByScalar(n.normalize(D,y),x,y),b=n.multiplyByScalar(n.normalize(B,S),x,S),X=n.magnitudeSquared(n.subtract(z,G,I)),H=n.magnitudeSquared(n.subtract(G,b,I)),q=n.magnitudeSquared(n.subtract(b,z,I)),V=Math.max(X,H,q);V>g?X===V?(v=Math.min(F,w)+" "+Math.max(F,w),_=O[v],a(_)||(U=n.add(P,D,I),n.multiplyByScalar(U,.5,U),R.push(U.x,U.y,U.z),_=R.length/3-1,O[v]=_),f.push(F,_,L),f.push(_,w,L)):H===V?(v=Math.min(w,L)+" "+Math.max(w,L),_=O[v],a(_)||(U=n.add(D,B,I),n.multiplyByScalar(U,.5,U),R.push(U.x,U.y,U.z),_=R.length/3-1,O[v]=_),f.push(w,_,F),f.push(_,L,F)):q===V&&(v=Math.min(L,F)+" "+Math.max(L,F),_=O[v],a(_)||(U=n.add(B,P,I),n.multiplyByScalar(U,.5,U),R.push(U.x,U.y,U.z),_=R.length/3-1,O[v]=_),f.push(L,_,w),f.push(_,F,w)):(M.push(F),M.push(w),M.push(L))}return new s({attributes:{position:new c({componentDatatype:r.DOUBLE,componentsPerAttribute:3,values:R})},indices:M,primitiveType:l.TRIANGLES})},R.scaleToGeodeticHeight=function(e,t,r,o){r=i(r,u.WGS84);var s=f,c=T;if(t=i(t,0),o=i(o,!0),a(e))for(var E=e.length,l=0;lS?(l=a.TWO_PI-I+S,i=Math.ceil(l/_)+1,o=Math.ceil(M/_)+1,c=l/(i-1),E=M/(o-1)):(l=S-I,i=Math.ceil(l/_)+1,o=Math.ceil(M/_)+1,c=l/(i-1),E=M/(o-1)),n=u.northwest(t,n);var O=u.center(t,R);0===A&&0===N||(O.longitude=0;t--)h.computePosition(e,_,t,f),o[u++]=f.x,o[u++]=f.y,o[u++]=f.z;for(t=0,_=i-2;_>0;_--)h.computePosition(e,_,t,f),o[u++]=f.x,o[u++]=f.y,o[u++]=f.z;for(var R=o.length/3*2,d=l.createTypedArray(o.length/3,R),A=0,N=0;N