UNPKG

cesium

Version:

CesiumJS is a JavaScript library for creating 3D globes and 2D maps in a web browser without a plugin.

1 lines 4.27 MB
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).Cesium={})}(this,(function(exports){"use strict";function defined(e){return null!=e}function DeveloperError(e){let t;this.name="DeveloperError",this.message=e;try{throw new Error}catch(e){t=e.stack}this.stack=t}defined(Object.create)&&(DeveloperError.prototype=Object.create(Error.prototype),DeveloperError.prototype.constructor=DeveloperError),DeveloperError.prototype.toString=function(){let e=`${this.name}: ${this.message}`;return defined(this.stack)&&(e+=`\n${this.stack.toString()}`),e},DeveloperError.throwInstantiationError=function(){throw new DeveloperError("This function defines an interface and should not be called directly.")};const Check={};function getUndefinedErrorMessage(e){return`${e} is required, actual value was undefined`}function getFailedTypeErrorMessage(e,t,n){return`Expected ${n} to be typeof ${t}, actual typeof was ${e}`}function defaultValue(e,t){return null!=e?e:t}Check.typeOf={},Check.defined=function(e,t){if(!defined(t))throw new DeveloperError(getUndefinedErrorMessage(e))},Check.typeOf.func=function(e,t){if("function"!=typeof t)throw new DeveloperError(getFailedTypeErrorMessage(typeof t,"function",e))},Check.typeOf.string=function(e,t){if("string"!=typeof t)throw new DeveloperError(getFailedTypeErrorMessage(typeof t,"string",e))},Check.typeOf.number=function(e,t){if("number"!=typeof t)throw new DeveloperError(getFailedTypeErrorMessage(typeof t,"number",e))},Check.typeOf.number.lessThan=function(e,t,n){if(Check.typeOf.number(e,t),t>=n)throw new DeveloperError(`Expected ${e} to be less than ${n}, actual value was ${t}`)},Check.typeOf.number.lessThanOrEquals=function(e,t,n){if(Check.typeOf.number(e,t),t>n)throw new DeveloperError(`Expected ${e} to be less than or equal to ${n}, actual value was ${t}`)},Check.typeOf.number.greaterThan=function(e,t,n){if(Check.typeOf.number(e,t),t<=n)throw new DeveloperError(`Expected ${e} to be greater than ${n}, actual value was ${t}`)},Check.typeOf.number.greaterThanOrEquals=function(e,t,n){if(Check.typeOf.number(e,t),t<n)throw new DeveloperError(`Expected ${e} to be greater than or equal to ${n}, actual value was ${t}`)},Check.typeOf.object=function(e,t){if("object"!=typeof t)throw new DeveloperError(getFailedTypeErrorMessage(typeof t,"object",e))},Check.typeOf.bool=function(e,t){if("boolean"!=typeof t)throw new DeveloperError(getFailedTypeErrorMessage(typeof t,"boolean",e))},Check.typeOf.bigint=function(e,t){if("bigint"!=typeof t)throw new DeveloperError(getFailedTypeErrorMessage(typeof t,"bigint",e))},Check.typeOf.number.equals=function(e,t,n,i){if(Check.typeOf.number(e,n),Check.typeOf.number(t,i),n!==i)throw new DeveloperError(`${e} must be equal to ${t}, the actual values are ${n} and ${i}`)},defaultValue.EMPTY_OBJECT=Object.freeze({});var MersenneTwister=function(e){null==e&&(e=(new Date).getTime()),this.N=624,this.M=397,this.MATRIX_A=2567483615,this.UPPER_MASK=2147483648,this.LOWER_MASK=2147483647,this.mt=new Array(this.N),this.mti=this.N+1,e.constructor==Array?this.init_by_array(e,e.length):this.init_seed(e)};MersenneTwister.prototype.init_seed=function(e){for(this.mt[0]=e>>>0,this.mti=1;this.mti<this.N;this.mti++){e=this.mt[this.mti-1]^this.mt[this.mti-1]>>>30;this.mt[this.mti]=(1812433253*((4294901760&e)>>>16)<<16)+1812433253*(65535&e)+this.mti,this.mt[this.mti]>>>=0}},MersenneTwister.prototype.init_by_array=function(e,t){var n,i,r;for(this.init_seed(19650218),n=1,i=0,r=this.N>t?this.N:t;r;r--){var o=this.mt[n-1]^this.mt[n-1]>>>30;this.mt[n]=(this.mt[n]^(1664525*((4294901760&o)>>>16)<<16)+1664525*(65535&o))+e[i]+i,this.mt[n]>>>=0,i++,++n>=this.N&&(this.mt[0]=this.mt[this.N-1],n=1),i>=t&&(i=0)}for(r=this.N-1;r;r--){o=this.mt[n-1]^this.mt[n-1]>>>30;this.mt[n]=(this.mt[n]^(1566083941*((4294901760&o)>>>16)<<16)+1566083941*(65535&o))-n,this.mt[n]>>>=0,++n>=this.N&&(this.mt[0]=this.mt[this.N-1],n=1)}this.mt[0]=2147483648},MersenneTwister.prototype.random_int=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_seed(5489),n=0;n<this.N-this.M;n++)e=this.mt[n]&this.UPPER_MASK|this.mt[n+1]&this.LOWER_MASK,this.mt[n]=this.mt[n+this.M]^e>>>1^t[1&e];for(;n<this.N-1;n++)e=this.mt[n]&this.UPPER_MASK|this.mt[n+1]&this.LOWER_MASK,this.mt[n]=this.mt[n+(this.M-this.N)]^e>>>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},MersenneTwister.prototype.random_int31=function(){return this.random_int()>>>1},MersenneTwister.prototype.random_incl=function(){return this.random_int()*(1/4294967295)},MersenneTwister.prototype.random=function(){return this.random_int()*(1/4294967296)},MersenneTwister.prototype.random_excl=function(){return(this.random_int()+.5)*(1/4294967296)},MersenneTwister.prototype.random_long=function(){return(67108864*(this.random_int()>>>5)+(this.random_int()>>>6))*(1/9007199254740992)};var mersenneTwister=MersenneTwister;const CesiumMath={EPSILON1:.1,EPSILON2:.01,EPSILON3:.001,EPSILON4:1e-4,EPSILON5:1e-5,EPSILON6:1e-6,EPSILON7:1e-7,EPSILON8:1e-8,EPSILON9:1e-9,EPSILON10:1e-10,EPSILON11:1e-11,EPSILON12:1e-12,EPSILON13:1e-13,EPSILON14:1e-14,EPSILON15:1e-15,EPSILON16:1e-16,EPSILON17:1e-17,EPSILON18:1e-18,EPSILON19:1e-19,EPSILON20:1e-20,EPSILON21:1e-21,GRAVITATIONALPARAMETER:3986004418e5,SOLAR_RADIUS:6955e5,LUNAR_RADIUS:1737400,SIXTY_FOUR_KILOBYTES:65536,FOUR_GIGABYTES:4294967296};CesiumMath.sign=defaultValue(Math.sign,(function(e){return 0===(e=+e)||e!=e?e:e>0?1:-1})),CesiumMath.signNotZero=function(e){return e<0?-1:1},CesiumMath.toSNorm=function(e,t){return t=defaultValue(t,255),Math.round((.5*CesiumMath.clamp(e,-1,1)+.5)*t)},CesiumMath.fromSNorm=function(e,t){return t=defaultValue(t,255),CesiumMath.clamp(e,0,t)/t*2-1},CesiumMath.normalize=function(e,t,n){return 0===(n=Math.max(n-t,0))?0:CesiumMath.clamp((e-t)/n,0,1)},CesiumMath.sinh=defaultValue(Math.sinh,(function(e){return(Math.exp(e)-Math.exp(-e))/2})),CesiumMath.cosh=defaultValue(Math.cosh,(function(e){return(Math.exp(e)+Math.exp(-e))/2})),CesiumMath.lerp=function(e,t,n){return(1-n)*e+n*t},CesiumMath.PI=Math.PI,CesiumMath.ONE_OVER_PI=1/Math.PI,CesiumMath.PI_OVER_TWO=Math.PI/2,CesiumMath.PI_OVER_THREE=Math.PI/3,CesiumMath.PI_OVER_FOUR=Math.PI/4,CesiumMath.PI_OVER_SIX=Math.PI/6,CesiumMath.THREE_PI_OVER_TWO=3*Math.PI/2,CesiumMath.TWO_PI=2*Math.PI,CesiumMath.ONE_OVER_TWO_PI=1/(2*Math.PI),CesiumMath.RADIANS_PER_DEGREE=Math.PI/180,CesiumMath.DEGREES_PER_RADIAN=180/Math.PI,CesiumMath.RADIANS_PER_ARCSECOND=CesiumMath.RADIANS_PER_DEGREE/3600,CesiumMath.toRadians=function(e){return e*CesiumMath.RADIANS_PER_DEGREE},CesiumMath.toDegrees=function(e){return e*CesiumMath.DEGREES_PER_RADIAN},CesiumMath.convertLongitudeRange=function(e){const t=CesiumMath.TWO_PI,n=e-Math.floor(e/t)*t;return n<-Math.PI?n+t:n>=Math.PI?n-t:n},CesiumMath.clampToLatitudeRange=function(e){return CesiumMath.clamp(e,-1*CesiumMath.PI_OVER_TWO,CesiumMath.PI_OVER_TWO)},CesiumMath.negativePiToPi=function(e){return e>=-CesiumMath.PI&&e<=CesiumMath.PI?e:CesiumMath.zeroToTwoPi(e+CesiumMath.PI)-CesiumMath.PI},CesiumMath.zeroToTwoPi=function(e){if(e>=0&&e<=CesiumMath.TWO_PI)return e;const t=CesiumMath.mod(e,CesiumMath.TWO_PI);return Math.abs(t)<CesiumMath.EPSILON14&&Math.abs(e)>CesiumMath.EPSILON14?CesiumMath.TWO_PI:t},CesiumMath.mod=function(e,t){return CesiumMath.sign(e)===CesiumMath.sign(t)&&Math.abs(e)<Math.abs(t)?e:(e%t+t)%t},CesiumMath.equalsEpsilon=function(e,t,n,i){n=defaultValue(n,0),i=defaultValue(i,n);const r=Math.abs(e-t);return r<=i||r<=n*Math.max(Math.abs(e),Math.abs(t))},CesiumMath.lessThan=function(e,t,n){return e-t<-n},CesiumMath.lessThanOrEquals=function(e,t,n){return e-t<n},CesiumMath.greaterThan=function(e,t,n){return e-t>n},CesiumMath.greaterThanOrEquals=function(e,t,n){return e-t>-n};const factorials=[1];CesiumMath.factorial=function(e){const t=factorials.length;if(e>=t){let n=factorials[t-1];for(let i=t;i<=e;i++){const e=n*i;factorials.push(e),n=e}}return factorials[e]},CesiumMath.incrementWrap=function(e,t,n){return n=defaultValue(n,0),++e>t&&(e=n),e},CesiumMath.isPowerOfTwo=function(e){return 0!==e&&0==(e&e-1)},CesiumMath.nextPowerOfTwo=function(e){return--e,e|=e>>1,e|=e>>2,e|=e>>4,e|=e>>8,e|=e>>16,++e},CesiumMath.previousPowerOfTwo=function(e){return e|=e>>1,e|=e>>2,e|=e>>4,e|=e>>8,e|=e>>16,e=((e|=e>>32)>>>0)-(e>>>1)},CesiumMath.clamp=function(e,t,n){return e<t?t:e>n?n:e};let randomNumberGenerator$2=new mersenneTwister;function Cartesian3(e,t,n){this.x=defaultValue(e,0),this.y=defaultValue(t,0),this.z=defaultValue(n,0)}CesiumMath.setRandomNumberSeed=function(e){randomNumberGenerator$2=new mersenneTwister(e)},CesiumMath.nextRandomNumber=function(){return randomNumberGenerator$2.random()},CesiumMath.randomBetween=function(e,t){return CesiumMath.nextRandomNumber()*(t-e)+e},CesiumMath.acosClamped=function(e){return Math.acos(CesiumMath.clamp(e,-1,1))},CesiumMath.asinClamped=function(e){return Math.asin(CesiumMath.clamp(e,-1,1))},CesiumMath.chordLength=function(e,t){return 2*t*Math.sin(.5*e)},CesiumMath.logBase=function(e,t){return Math.log(e)/Math.log(t)},CesiumMath.cbrt=defaultValue(Math.cbrt,(function(e){const t=Math.pow(Math.abs(e),1/3);return e<0?-t:t})),CesiumMath.log2=defaultValue(Math.log2,(function(e){return Math.log(e)*Math.LOG2E})),CesiumMath.fog=function(e,t){const n=e*t;return 1-Math.exp(-n*n)},CesiumMath.fastApproximateAtan=function(e){return e*(-.1784*Math.abs(e)-.0663*e*e+1.0301)},CesiumMath.fastApproximateAtan2=function(e,t){let n,i=Math.abs(e);n=Math.abs(t);const r=Math.max(i,n);n=Math.min(i,n);const o=n/r;return i=CesiumMath.fastApproximateAtan(o),i=Math.abs(t)>Math.abs(e)?CesiumMath.PI_OVER_TWO-i:i,i=e<0?CesiumMath.PI-i:i,i=t<0?-i:i,i},Cartesian3.fromSpherical=function(e,t){defined(t)||(t=new Cartesian3);const n=e.clock,i=e.cone,r=defaultValue(e.magnitude,1),o=r*Math.sin(i);return t.x=o*Math.cos(n),t.y=o*Math.sin(n),t.z=r*Math.cos(i),t},Cartesian3.fromElements=function(e,t,n,i){return defined(i)?(i.x=e,i.y=t,i.z=n,i):new Cartesian3(e,t,n)},Cartesian3.clone=function(e,t){if(defined(e))return defined(t)?(t.x=e.x,t.y=e.y,t.z=e.z,t):new Cartesian3(e.x,e.y,e.z)},Cartesian3.fromCartesian4=Cartesian3.clone,Cartesian3.packedLength=3,Cartesian3.pack=function(e,t,n){return n=defaultValue(n,0),t[n++]=e.x,t[n++]=e.y,t[n]=e.z,t},Cartesian3.unpack=function(e,t,n){return t=defaultValue(t,0),defined(n)||(n=new Cartesian3),n.x=e[t++],n.y=e[t++],n.z=e[t],n},Cartesian3.packArray=function(e,t){const n=e.length,i=3*n;defined(t)?(Array.isArray(t)||t.length===i)&&t.length!==i&&(t.length=i):t=new Array(i);for(let i=0;i<n;++i)Cartesian3.pack(e[i],t,3*i);return t},Cartesian3.unpackArray=function(e,t){const n=e.length;defined(t)?t.length=n/3:t=new Array(n/3);for(let i=0;i<n;i+=3){const n=i/3;t[n]=Cartesian3.unpack(e,i,t[n])}return t},Cartesian3.fromArray=Cartesian3.unpack,Cartesian3.maximumComponent=function(e){return Math.max(e.x,e.y,e.z)},Cartesian3.minimumComponent=function(e){return Math.min(e.x,e.y,e.z)},Cartesian3.minimumByComponent=function(e,t,n){return n.x=Math.min(e.x,t.x),n.y=Math.min(e.y,t.y),n.z=Math.min(e.z,t.z),n},Cartesian3.maximumByComponent=function(e,t,n){return n.x=Math.max(e.x,t.x),n.y=Math.max(e.y,t.y),n.z=Math.max(e.z,t.z),n},Cartesian3.clamp=function(e,t,n,i){const r=CesiumMath.clamp(e.x,t.x,n.x),o=CesiumMath.clamp(e.y,t.y,n.y),a=CesiumMath.clamp(e.z,t.z,n.z);return i.x=r,i.y=o,i.z=a,i},Cartesian3.magnitudeSquared=function(e){return e.x*e.x+e.y*e.y+e.z*e.z},Cartesian3.magnitude=function(e){return Math.sqrt(Cartesian3.magnitudeSquared(e))};const distanceScratch$3=new Cartesian3;Cartesian3.distance=function(e,t){return Cartesian3.subtract(e,t,distanceScratch$3),Cartesian3.magnitude(distanceScratch$3)},Cartesian3.distanceSquared=function(e,t){return Cartesian3.subtract(e,t,distanceScratch$3),Cartesian3.magnitudeSquared(distanceScratch$3)},Cartesian3.normalize=function(e,t){const n=Cartesian3.magnitude(e);return t.x=e.x/n,t.y=e.y/n,t.z=e.z/n,t},Cartesian3.dot=function(e,t){return e.x*t.x+e.y*t.y+e.z*t.z},Cartesian3.multiplyComponents=function(e,t,n){return n.x=e.x*t.x,n.y=e.y*t.y,n.z=e.z*t.z,n},Cartesian3.divideComponents=function(e,t,n){return n.x=e.x/t.x,n.y=e.y/t.y,n.z=e.z/t.z,n},Cartesian3.add=function(e,t,n){return n.x=e.x+t.x,n.y=e.y+t.y,n.z=e.z+t.z,n},Cartesian3.subtract=function(e,t,n){return n.x=e.x-t.x,n.y=e.y-t.y,n.z=e.z-t.z,n},Cartesian3.multiplyByScalar=function(e,t,n){return n.x=e.x*t,n.y=e.y*t,n.z=e.z*t,n},Cartesian3.divideByScalar=function(e,t,n){return n.x=e.x/t,n.y=e.y/t,n.z=e.z/t,n},Cartesian3.negate=function(e,t){return t.x=-e.x,t.y=-e.y,t.z=-e.z,t},Cartesian3.abs=function(e,t){return t.x=Math.abs(e.x),t.y=Math.abs(e.y),t.z=Math.abs(e.z),t};const lerpScratch$3=new Cartesian3;Cartesian3.lerp=function(e,t,n,i){return Cartesian3.multiplyByScalar(t,n,lerpScratch$3),i=Cartesian3.multiplyByScalar(e,1-n,i),Cartesian3.add(lerpScratch$3,i,i)};const angleBetweenScratch$1=new Cartesian3,angleBetweenScratch2$1=new Cartesian3;Cartesian3.angleBetween=function(e,t){Cartesian3.normalize(e,angleBetweenScratch$1),Cartesian3.normalize(t,angleBetweenScratch2$1);const n=Cartesian3.dot(angleBetweenScratch$1,angleBetweenScratch2$1),i=Cartesian3.magnitude(Cartesian3.cross(angleBetweenScratch$1,angleBetweenScratch2$1,angleBetweenScratch$1));return Math.atan2(i,n)};const mostOrthogonalAxisScratch$2=new Cartesian3;Cartesian3.mostOrthogonalAxis=function(e,t){const n=Cartesian3.normalize(e,mostOrthogonalAxisScratch$2);return Cartesian3.abs(n,n),t=n.x<=n.y?n.x<=n.z?Cartesian3.clone(Cartesian3.UNIT_X,t):Cartesian3.clone(Cartesian3.UNIT_Z,t):n.y<=n.z?Cartesian3.clone(Cartesian3.UNIT_Y,t):Cartesian3.clone(Cartesian3.UNIT_Z,t)},Cartesian3.projectVector=function(e,t,n){const i=Cartesian3.dot(e,t)/Cartesian3.dot(t,t);return Cartesian3.multiplyByScalar(t,i,n)},Cartesian3.equals=function(e,t){return e===t||defined(e)&&defined(t)&&e.x===t.x&&e.y===t.y&&e.z===t.z},Cartesian3.equalsArray=function(e,t,n){return e.x===t[n]&&e.y===t[n+1]&&e.z===t[n+2]},Cartesian3.equalsEpsilon=function(e,t,n,i){return e===t||defined(e)&&defined(t)&&CesiumMath.equalsEpsilon(e.x,t.x,n,i)&&CesiumMath.equalsEpsilon(e.y,t.y,n,i)&&CesiumMath.equalsEpsilon(e.z,t.z,n,i)},Cartesian3.cross=function(e,t,n){const i=e.x,r=e.y,o=e.z,a=t.x,s=t.y,c=t.z,l=r*c-o*s,u=o*a-i*c,d=i*s-r*a;return n.x=l,n.y=u,n.z=d,n},Cartesian3.midpoint=function(e,t,n){return n.x=.5*(e.x+t.x),n.y=.5*(e.y+t.y),n.z=.5*(e.z+t.z),n},Cartesian3.fromDegrees=function(e,t,n,i,r){return e=CesiumMath.toRadians(e),t=CesiumMath.toRadians(t),Cartesian3.fromRadians(e,t,n,i,r)};let scratchN=new Cartesian3,scratchK=new Cartesian3;const wgs84RadiiSquared=new Cartesian3(40680631590769,40680631590769,40408299984661.445);Cartesian3.fromRadians=function(e,t,n,i,r){n=defaultValue(n,0);const o=defined(i)?i.radiiSquared:wgs84RadiiSquared,a=Math.cos(t);scratchN.x=a*Math.cos(e),scratchN.y=a*Math.sin(e),scratchN.z=Math.sin(t),scratchN=Cartesian3.normalize(scratchN,scratchN),Cartesian3.multiplyComponents(o,scratchN,scratchK);const s=Math.sqrt(Cartesian3.dot(scratchN,scratchK));return scratchK=Cartesian3.divideByScalar(scratchK,s,scratchK),scratchN=Cartesian3.multiplyByScalar(scratchN,n,scratchN),defined(r)||(r=new Cartesian3),Cartesian3.add(scratchK,scratchN,r)},Cartesian3.fromDegreesArray=function(e,t,n){const i=e.length;defined(n)?n.length=i/2:n=new Array(i/2);for(let r=0;r<i;r+=2){const i=e[r],o=e[r+1],a=r/2;n[a]=Cartesian3.fromDegrees(i,o,0,t,n[a])}return n},Cartesian3.fromRadiansArray=function(e,t,n){const i=e.length;defined(n)?n.length=i/2:n=new Array(i/2);for(let r=0;r<i;r+=2){const i=e[r],o=e[r+1],a=r/2;n[a]=Cartesian3.fromRadians(i,o,0,t,n[a])}return n},Cartesian3.fromDegreesArrayHeights=function(e,t,n){const i=e.length;defined(n)?n.length=i/3:n=new Array(i/3);for(let r=0;r<i;r+=3){const i=e[r],o=e[r+1],a=e[r+2],s=r/3;n[s]=Cartesian3.fromDegrees(i,o,a,t,n[s])}return n},Cartesian3.fromRadiansArrayHeights=function(e,t,n){const i=e.length;defined(n)?n.length=i/3:n=new Array(i/3);for(let r=0;r<i;r+=3){const i=e[r],o=e[r+1],a=e[r+2],s=r/3;n[s]=Cartesian3.fromRadians(i,o,a,t,n[s])}return n},Cartesian3.ZERO=Object.freeze(new Cartesian3(0,0,0)),Cartesian3.ONE=Object.freeze(new Cartesian3(1,1,1)),Cartesian3.UNIT_X=Object.freeze(new Cartesian3(1,0,0)),Cartesian3.UNIT_Y=Object.freeze(new Cartesian3(0,1,0)),Cartesian3.UNIT_Z=Object.freeze(new Cartesian3(0,0,1)),Cartesian3.prototype.clone=function(e){return Cartesian3.clone(this,e)},Cartesian3.prototype.equals=function(e){return Cartesian3.equals(this,e)},Cartesian3.prototype.equalsEpsilon=function(e,t,n){return Cartesian3.equalsEpsilon(this,e,t,n)},Cartesian3.prototype.toString=function(){return`(${this.x}, ${this.y}, ${this.z})`};const scaleToGeodeticSurfaceIntersection=new Cartesian3,scaleToGeodeticSurfaceGradient=new Cartesian3;function scaleToGeodeticSurface(e,t,n,i,r){const o=e.x,a=e.y,s=e.z,c=t.x,l=t.y,u=t.z,d=o*o*c*c,h=a*a*l*l,p=s*s*u*u,f=d+h+p,m=Math.sqrt(1/f),g=Cartesian3.multiplyByScalar(e,m,scaleToGeodeticSurfaceIntersection);if(f<i)return isFinite(m)?Cartesian3.clone(g,r):void 0;const _=n.x,y=n.y,C=n.z,T=scaleToGeodeticSurfaceGradient;T.x=g.x*_*2,T.y=g.y*y*2,T.z=g.z*C*2;let S,A,v,E,b,x,P,D,M,w,I,R=(1-m)*Cartesian3.magnitude(e)/(.5*Cartesian3.magnitude(T)),O=0;do{R-=O,v=1/(1+R*_),E=1/(1+R*y),b=1/(1+R*C),x=v*v,P=E*E,D=b*b,M=x*v,w=P*E,I=D*b,S=d*x+h*P+p*D-1,A=d*M*_+h*w*y+p*I*C;O=S/(-2*A)}while(Math.abs(S)>CesiumMath.EPSILON12);return defined(r)?(r.x=o*v,r.y=a*E,r.z=s*b,r):new Cartesian3(o*v,a*E,s*b)}function Cartographic(e,t,n){this.longitude=defaultValue(e,0),this.latitude=defaultValue(t,0),this.height=defaultValue(n,0)}Cartographic.fromRadians=function(e,t,n,i){return n=defaultValue(n,0),defined(i)?(i.longitude=e,i.latitude=t,i.height=n,i):new Cartographic(e,t,n)},Cartographic.fromDegrees=function(e,t,n,i){return e=CesiumMath.toRadians(e),t=CesiumMath.toRadians(t),Cartographic.fromRadians(e,t,n,i)};const cartesianToCartographicN$1=new Cartesian3,cartesianToCartographicP$1=new Cartesian3,cartesianToCartographicH$1=new Cartesian3,wgs84OneOverRadii=new Cartesian3(1/6378137,1/6378137,1/6356752.314245179),wgs84OneOverRadiiSquared=new Cartesian3(1/40680631590769,1/40680631590769,1/40408299984661.445),wgs84CenterToleranceSquared=CesiumMath.EPSILON1;function initialize$n(e,t,n,i){t=defaultValue(t,0),n=defaultValue(n,0),i=defaultValue(i,0),e._radii=new Cartesian3(t,n,i),e._radiiSquared=new Cartesian3(t*t,n*n,i*i),e._radiiToTheFourth=new Cartesian3(t*t*t*t,n*n*n*n,i*i*i*i),e._oneOverRadii=new Cartesian3(0===t?0:1/t,0===n?0:1/n,0===i?0:1/i),e._oneOverRadiiSquared=new Cartesian3(0===t?0:1/(t*t),0===n?0:1/(n*n),0===i?0:1/(i*i)),e._minimumRadius=Math.min(t,n,i),e._maximumRadius=Math.max(t,n,i),e._centerToleranceSquared=CesiumMath.EPSILON1,0!==e._radiiSquared.z&&(e._squaredXOverSquaredZ=e._radiiSquared.x/e._radiiSquared.z)}function Ellipsoid(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,initialize$n(this,e,t,n)}Cartographic.fromCartesian=function(e,t,n){const i=defined(t)?t.oneOverRadii:wgs84OneOverRadii,r=defined(t)?t.oneOverRadiiSquared:wgs84OneOverRadiiSquared,o=scaleToGeodeticSurface(e,i,r,defined(t)?t._centerToleranceSquared:wgs84CenterToleranceSquared,cartesianToCartographicP$1);if(!defined(o))return;let a=Cartesian3.multiplyComponents(o,r,cartesianToCartographicN$1);a=Cartesian3.normalize(a,a);const s=Cartesian3.subtract(e,o,cartesianToCartographicH$1),c=Math.atan2(a.y,a.x),l=Math.asin(a.z),u=CesiumMath.sign(Cartesian3.dot(s,e))*Cartesian3.magnitude(s);return defined(n)?(n.longitude=c,n.latitude=l,n.height=u,n):new Cartographic(c,l,u)},Cartographic.toCartesian=function(e,t,n){return Cartesian3.fromRadians(e.longitude,e.latitude,e.height,t,n)},Cartographic.clone=function(e,t){if(defined(e))return defined(t)?(t.longitude=e.longitude,t.latitude=e.latitude,t.height=e.height,t):new Cartographic(e.longitude,e.latitude,e.height)},Cartographic.equals=function(e,t){return e===t||defined(e)&&defined(t)&&e.longitude===t.longitude&&e.latitude===t.latitude&&e.height===t.height},Cartographic.equalsEpsilon=function(e,t,n){return n=defaultValue(n,0),e===t||defined(e)&&defined(t)&&Math.abs(e.longitude-t.longitude)<=n&&Math.abs(e.latitude-t.latitude)<=n&&Math.abs(e.height-t.height)<=n},Cartographic.ZERO=Object.freeze(new Cartographic(0,0,0)),Cartographic.prototype.clone=function(e){return Cartographic.clone(this,e)},Cartographic.prototype.equals=function(e){return Cartographic.equals(this,e)},Cartographic.prototype.equalsEpsilon=function(e,t){return Cartographic.equalsEpsilon(this,e,t)},Cartographic.prototype.toString=function(){return`(${this.longitude}, ${this.latitude}, ${this.height})`},Object.defineProperties(Ellipsoid.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}}}),Ellipsoid.clone=function(e,t){if(!defined(e))return;const n=e._radii;return defined(t)?(Cartesian3.clone(n,t._radii),Cartesian3.clone(e._radiiSquared,t._radiiSquared),Cartesian3.clone(e._radiiToTheFourth,t._radiiToTheFourth),Cartesian3.clone(e._oneOverRadii,t._oneOverRadii),Cartesian3.clone(e._oneOverRadiiSquared,t._oneOverRadiiSquared),t._minimumRadius=e._minimumRadius,t._maximumRadius=e._maximumRadius,t._centerToleranceSquared=e._centerToleranceSquared,t):new Ellipsoid(n.x,n.y,n.z)},Ellipsoid.fromCartesian3=function(e,t){return defined(t)||(t=new Ellipsoid),defined(e)?(initialize$n(t,e.x,e.y,e.z),t):t},Ellipsoid.WGS84=Object.freeze(new Ellipsoid(6378137,6378137,6356752.314245179)),Ellipsoid.UNIT_SPHERE=Object.freeze(new Ellipsoid(1,1,1)),Ellipsoid.MOON=Object.freeze(new Ellipsoid(CesiumMath.LUNAR_RADIUS,CesiumMath.LUNAR_RADIUS,CesiumMath.LUNAR_RADIUS)),Ellipsoid.prototype.clone=function(e){return Ellipsoid.clone(this,e)},Ellipsoid.packedLength=Cartesian3.packedLength,Ellipsoid.pack=function(e,t,n){return n=defaultValue(n,0),Cartesian3.pack(e._radii,t,n),t},Ellipsoid.unpack=function(e,t,n){t=defaultValue(t,0);const i=Cartesian3.unpack(e,t);return Ellipsoid.fromCartesian3(i,n)},Ellipsoid.prototype.geocentricSurfaceNormal=Cartesian3.normalize,Ellipsoid.prototype.geodeticSurfaceNormalCartographic=function(e,t){const n=e.longitude,i=e.latitude,r=Math.cos(i),o=r*Math.cos(n),a=r*Math.sin(n),s=Math.sin(i);return defined(t)||(t=new Cartesian3),t.x=o,t.y=a,t.z=s,Cartesian3.normalize(t,t)},Ellipsoid.prototype.geodeticSurfaceNormal=function(e,t){if(!Cartesian3.equalsEpsilon(e,Cartesian3.ZERO,CesiumMath.EPSILON14))return defined(t)||(t=new Cartesian3),t=Cartesian3.multiplyComponents(e,this._oneOverRadiiSquared,t),Cartesian3.normalize(t,t)};const cartographicToCartesianNormal=new Cartesian3,cartographicToCartesianK=new Cartesian3;Ellipsoid.prototype.cartographicToCartesian=function(e,t){const n=cartographicToCartesianNormal,i=cartographicToCartesianK;this.geodeticSurfaceNormalCartographic(e,n),Cartesian3.multiplyComponents(this._radiiSquared,n,i);const r=Math.sqrt(Cartesian3.dot(n,i));return Cartesian3.divideByScalar(i,r,i),Cartesian3.multiplyByScalar(n,e.height,n),defined(t)||(t=new Cartesian3),Cartesian3.add(i,n,t)},Ellipsoid.prototype.cartographicArrayToCartesianArray=function(e,t){const n=e.length;defined(t)?t.length=n:t=new Array(n);for(let i=0;i<n;i++)t[i]=this.cartographicToCartesian(e[i],t[i]);return t};const cartesianToCartographicN=new Cartesian3,cartesianToCartographicP=new Cartesian3,cartesianToCartographicH=new Cartesian3;Ellipsoid.prototype.cartesianToCartographic=function(e,t){const n=this.scaleToGeodeticSurface(e,cartesianToCartographicP);if(!defined(n))return;const i=this.geodeticSurfaceNormal(n,cartesianToCartographicN),r=Cartesian3.subtract(e,n,cartesianToCartographicH),o=Math.atan2(i.y,i.x),a=Math.asin(i.z),s=CesiumMath.sign(Cartesian3.dot(r,e))*Cartesian3.magnitude(r);return defined(t)?(t.longitude=o,t.latitude=a,t.height=s,t):new Cartographic(o,a,s)},Ellipsoid.prototype.cartesianArrayToCartographicArray=function(e,t){const n=e.length;defined(t)?t.length=n:t=new Array(n);for(let i=0;i<n;++i)t[i]=this.cartesianToCartographic(e[i],t[i]);return t},Ellipsoid.prototype.scaleToGeodeticSurface=function(e,t){return scaleToGeodeticSurface(e,this._oneOverRadii,this._oneOverRadiiSquared,this._centerToleranceSquared,t)},Ellipsoid.prototype.scaleToGeocentricSurface=function(e,t){defined(t)||(t=new Cartesian3);const n=e.x,i=e.y,r=e.z,o=this._oneOverRadiiSquared,a=1/Math.sqrt(n*n*o.x+i*i*o.y+r*r*o.z);return Cartesian3.multiplyByScalar(e,a,t)},Ellipsoid.prototype.transformPositionToScaledSpace=function(e,t){return defined(t)||(t=new Cartesian3),Cartesian3.multiplyComponents(e,this._oneOverRadii,t)},Ellipsoid.prototype.transformPositionFromScaledSpace=function(e,t){return defined(t)||(t=new Cartesian3),Cartesian3.multiplyComponents(e,this._radii,t)},Ellipsoid.prototype.equals=function(e){return this===e||defined(e)&&Cartesian3.equals(this._radii,e._radii)},Ellipsoid.prototype.toString=function(){return this._radii.toString()},Ellipsoid.prototype.getSurfaceNormalIntersectionWithZAxis=function(e,t,n){t=defaultValue(t,0);const i=this._squaredXOverSquaredZ;if(defined(n)||(n=new Cartesian3),n.x=0,n.y=0,n.z=e.z*(1-i),!(Math.abs(n.z)>=this._radii.z-t))return n};const abscissas=[.14887433898163,.43339539412925,.67940956829902,.86506336668898,.97390652851717,0],weights=[.29552422471475,.26926671930999,.21908636251598,.14945134915058,.066671344308684,0];function gaussLegendreQuadrature(e,t,n){const i=.5*(t+e),r=.5*(t-e);let o=0;for(let e=0;e<5;e++){const t=r*abscissas[e];o+=weights[e]*(n(i+t)+n(i-t))}return o*=r,o}function GeographicProjection(e){this._ellipsoid=defaultValue(e,Ellipsoid.WGS84),this._semimajorAxis=this._ellipsoid.maximumRadius,this._oneOverSemimajorAxis=1/this._semimajorAxis}Ellipsoid.prototype.surfaceArea=function(e){const t=e.west;let n=e.east;const i=e.south,r=e.north;for(;n<t;)n+=CesiumMath.TWO_PI;const o=this._radiiSquared,a=o.x,s=o.y,c=o.z,l=a*s;return gaussLegendreQuadrature(i,r,(function(e){const i=Math.cos(e),r=Math.sin(e);return Math.cos(e)*gaussLegendreQuadrature(t,n,(function(e){const t=Math.cos(e),n=Math.sin(e);return Math.sqrt(l*r*r+c*(s*t*t+a*n*n)*i*i)}))}))},Object.defineProperties(GeographicProjection.prototype,{ellipsoid:{get:function(){return this._ellipsoid}}}),GeographicProjection.prototype.project=function(e,t){const n=this._semimajorAxis,i=e.longitude*n,r=e.latitude*n,o=e.height;return defined(t)?(t.x=i,t.y=r,t.z=o,t):new Cartesian3(i,r,o)},GeographicProjection.prototype.unproject=function(e,t){const n=this._oneOverSemimajorAxis,i=e.x*n,r=e.y*n,o=e.z;return defined(t)?(t.longitude=i,t.latitude=r,t.height=o,t):new Cartographic(i,r,o)};const Intersect={OUTSIDE:-1,INTERSECTING:0,INSIDE:1};var Intersect$1=Object.freeze(Intersect);function Interval(e,t){this.start=defaultValue(e,0),this.stop=defaultValue(t,0)}function Matrix3(e,t,n,i,r,o,a,s,c){this[0]=defaultValue(e,0),this[1]=defaultValue(i,0),this[2]=defaultValue(a,0),this[3]=defaultValue(t,0),this[4]=defaultValue(r,0),this[5]=defaultValue(s,0),this[6]=defaultValue(n,0),this[7]=defaultValue(o,0),this[8]=defaultValue(c,0)}Matrix3.packedLength=9,Matrix3.pack=function(e,t,n){return n=defaultValue(n,0),t[n++]=e[0],t[n++]=e[1],t[n++]=e[2],t[n++]=e[3],t[n++]=e[4],t[n++]=e[5],t[n++]=e[6],t[n++]=e[7],t[n++]=e[8],t},Matrix3.unpack=function(e,t,n){return t=defaultValue(t,0),defined(n)||(n=new Matrix3),n[0]=e[t++],n[1]=e[t++],n[2]=e[t++],n[3]=e[t++],n[4]=e[t++],n[5]=e[t++],n[6]=e[t++],n[7]=e[t++],n[8]=e[t++],n},Matrix3.packArray=function(e,t){const n=e.length,i=9*n;defined(t)?(Array.isArray(t)||t.length===i)&&t.length!==i&&(t.length=i):t=new Array(i);for(let i=0;i<n;++i)Matrix3.pack(e[i],t,9*i);return t},Matrix3.unpackArray=function(e,t){const n=e.length;defined(t)?t.length=n/9:t=new Array(n/9);for(let i=0;i<n;i+=9){const n=i/9;t[n]=Matrix3.unpack(e,i,t[n])}return t},Matrix3.clone=function(e,t){if(defined(e))return defined(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 Matrix3(e[0],e[3],e[6],e[1],e[4],e[7],e[2],e[5],e[8])},Matrix3.fromArray=Matrix3.unpack,Matrix3.fromColumnMajorArray=function(e,t){return Matrix3.clone(e,t)},Matrix3.fromRowMajorArray=function(e,t){return defined(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 Matrix3(e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8])},Matrix3.fromQuaternion=function(e,t){const n=e.x*e.x,i=e.x*e.y,r=e.x*e.z,o=e.x*e.w,a=e.y*e.y,s=e.y*e.z,c=e.y*e.w,l=e.z*e.z,u=e.z*e.w,d=e.w*e.w,h=n-a-l+d,p=2*(i-u),f=2*(r+c),m=2*(i+u),g=-n+a-l+d,_=2*(s-o),y=2*(r-c),C=2*(s+o),T=-n-a+l+d;return defined(t)?(t[0]=h,t[1]=m,t[2]=y,t[3]=p,t[4]=g,t[5]=C,t[6]=f,t[7]=_,t[8]=T,t):new Matrix3(h,p,f,m,g,_,y,C,T)},Matrix3.fromHeadingPitchRoll=function(e,t){const n=Math.cos(-e.pitch),i=Math.cos(-e.heading),r=Math.cos(e.roll),o=Math.sin(-e.pitch),a=Math.sin(-e.heading),s=Math.sin(e.roll),c=n*i,l=-r*a+s*o*i,u=s*a+r*o*i,d=n*a,h=r*i+s*o*a,p=-s*i+r*o*a,f=-o,m=s*n,g=r*n;return defined(t)?(t[0]=c,t[1]=d,t[2]=f,t[3]=l,t[4]=h,t[5]=m,t[6]=u,t[7]=p,t[8]=g,t):new Matrix3(c,l,u,d,h,p,f,m,g)},Matrix3.fromScale=function(e,t){return defined(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 Matrix3(e.x,0,0,0,e.y,0,0,0,e.z)},Matrix3.fromUniformScale=function(e,t){return defined(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 Matrix3(e,0,0,0,e,0,0,0,e)},Matrix3.fromCrossProduct=function(e,t){return defined(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 Matrix3(0,-e.z,e.y,e.z,0,-e.x,-e.y,e.x,0)},Matrix3.fromRotationX=function(e,t){const n=Math.cos(e),i=Math.sin(e);return defined(t)?(t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=n,t[5]=i,t[6]=0,t[7]=-i,t[8]=n,t):new Matrix3(1,0,0,0,n,-i,0,i,n)},Matrix3.fromRotationY=function(e,t){const n=Math.cos(e),i=Math.sin(e);return defined(t)?(t[0]=n,t[1]=0,t[2]=-i,t[3]=0,t[4]=1,t[5]=0,t[6]=i,t[7]=0,t[8]=n,t):new Matrix3(n,0,i,0,1,0,-i,0,n)},Matrix3.fromRotationZ=function(e,t){const n=Math.cos(e),i=Math.sin(e);return defined(t)?(t[0]=n,t[1]=i,t[2]=0,t[3]=-i,t[4]=n,t[5]=0,t[6]=0,t[7]=0,t[8]=1,t):new Matrix3(n,-i,0,i,n,0,0,0,1)},Matrix3.toArray=function(e,t){return defined(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]]},Matrix3.getElementIndex=function(e,t){return 3*e+t},Matrix3.getColumn=function(e,t,n){const i=3*t,r=e[i],o=e[i+1],a=e[i+2];return n.x=r,n.y=o,n.z=a,n},Matrix3.setColumn=function(e,t,n,i){const r=3*t;return(i=Matrix3.clone(e,i))[r]=n.x,i[r+1]=n.y,i[r+2]=n.z,i},Matrix3.getRow=function(e,t,n){const i=e[t],r=e[t+3],o=e[t+6];return n.x=i,n.y=r,n.z=o,n},Matrix3.setRow=function(e,t,n,i){return(i=Matrix3.clone(e,i))[t]=n.x,i[t+3]=n.y,i[t+6]=n.z,i};const scaleScratch1$2=new Cartesian3;Matrix3.setScale=function(e,t,n){const i=Matrix3.getScale(e,scaleScratch1$2),r=t.x/i.x,o=t.y/i.y,a=t.z/i.z;return n[0]=e[0]*r,n[1]=e[1]*r,n[2]=e[2]*r,n[3]=e[3]*o,n[4]=e[4]*o,n[5]=e[5]*o,n[6]=e[6]*a,n[7]=e[7]*a,n[8]=e[8]*a,n};const scaleScratch2$2=new Cartesian3;Matrix3.setUniformScale=function(e,t,n){const i=Matrix3.getScale(e,scaleScratch2$2),r=t/i.x,o=t/i.y,a=t/i.z;return n[0]=e[0]*r,n[1]=e[1]*r,n[2]=e[2]*r,n[3]=e[3]*o,n[4]=e[4]*o,n[5]=e[5]*o,n[6]=e[6]*a,n[7]=e[7]*a,n[8]=e[8]*a,n};const scratchColumn$2=new Cartesian3;Matrix3.getScale=function(e,t){return t.x=Cartesian3.magnitude(Cartesian3.fromElements(e[0],e[1],e[2],scratchColumn$2)),t.y=Cartesian3.magnitude(Cartesian3.fromElements(e[3],e[4],e[5],scratchColumn$2)),t.z=Cartesian3.magnitude(Cartesian3.fromElements(e[6],e[7],e[8],scratchColumn$2)),t};const scaleScratch3$2=new Cartesian3;Matrix3.getMaximumScale=function(e){return Matrix3.getScale(e,scaleScratch3$2),Cartesian3.maximumComponent(scaleScratch3$2)};const scaleScratch4$2=new Cartesian3;Matrix3.setRotation=function(e,t,n){const i=Matrix3.getScale(e,scaleScratch4$2);return n[0]=t[0]*i.x,n[1]=t[1]*i.x,n[2]=t[2]*i.x,n[3]=t[3]*i.y,n[4]=t[4]*i.y,n[5]=t[5]*i.y,n[6]=t[6]*i.z,n[7]=t[7]*i.z,n[8]=t[8]*i.z,n};const scaleScratch5$2=new Cartesian3;function computeFrobeniusNorm(e){let t=0;for(let n=0;n<9;++n){const i=e[n];t+=i*i}return Math.sqrt(t)}Matrix3.getRotation=function(e,t){const n=Matrix3.getScale(e,scaleScratch5$2);return t[0]=e[0]/n.x,t[1]=e[1]/n.x,t[2]=e[2]/n.x,t[3]=e[3]/n.y,t[4]=e[4]/n.y,t[5]=e[5]/n.y,t[6]=e[6]/n.z,t[7]=e[7]/n.z,t[8]=e[8]/n.z,t},Matrix3.multiply=function(e,t,n){const i=e[0]*t[0]+e[3]*t[1]+e[6]*t[2],r=e[1]*t[0]+e[4]*t[1]+e[7]*t[2],o=e[2]*t[0]+e[5]*t[1]+e[8]*t[2],a=e[0]*t[3]+e[3]*t[4]+e[6]*t[5],s=e[1]*t[3]+e[4]*t[4]+e[7]*t[5],c=e[2]*t[3]+e[5]*t[4]+e[8]*t[5],l=e[0]*t[6]+e[3]*t[7]+e[6]*t[8],u=e[1]*t[6]+e[4]*t[7]+e[7]*t[8],d=e[2]*t[6]+e[5]*t[7]+e[8]*t[8];return n[0]=i,n[1]=r,n[2]=o,n[3]=a,n[4]=s,n[5]=c,n[6]=l,n[7]=u,n[8]=d,n},Matrix3.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},Matrix3.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},Matrix3.multiplyByVector=function(e,t,n){const i=t.x,r=t.y,o=t.z,a=e[0]*i+e[3]*r+e[6]*o,s=e[1]*i+e[4]*r+e[7]*o,c=e[2]*i+e[5]*r+e[8]*o;return n.x=a,n.y=s,n.z=c,n},Matrix3.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},Matrix3.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},Matrix3.multiplyByUniformScale=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},Matrix3.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},Matrix3.transpose=function(e,t){const n=e[0],i=e[3],r=e[6],o=e[1],a=e[4],s=e[7],c=e[2],l=e[5],u=e[8];return t[0]=n,t[1]=i,t[2]=r,t[3]=o,t[4]=a,t[5]=s,t[6]=c,t[7]=l,t[8]=u,t};const rowVal=[1,0,0],colVal=[2,2,1];function offDiagonalFrobeniusNorm(e){let t=0;for(let n=0;n<3;++n){const i=e[Matrix3.getElementIndex(colVal[n],rowVal[n])];t+=2*i*i}return Math.sqrt(t)}function shurDecomposition(e,t){const n=CesiumMath.EPSILON15;let i=0,r=1;for(let t=0;t<3;++t){const n=Math.abs(e[Matrix3.getElementIndex(colVal[t],rowVal[t])]);n>i&&(r=t,i=n)}let o=1,a=0;const s=rowVal[r],c=colVal[r];if(Math.abs(e[Matrix3.getElementIndex(c,s)])>n){const t=(e[Matrix3.getElementIndex(c,c)]-e[Matrix3.getElementIndex(s,s)])/2/e[Matrix3.getElementIndex(c,s)];let n;n=t<0?-1/(-t+Math.sqrt(1+t*t)):1/(t+Math.sqrt(1+t*t)),o=1/Math.sqrt(1+n*n),a=n*o}return(t=Matrix3.clone(Matrix3.IDENTITY,t))[Matrix3.getElementIndex(s,s)]=t[Matrix3.getElementIndex(c,c)]=o,t[Matrix3.getElementIndex(c,s)]=a,t[Matrix3.getElementIndex(s,c)]=-a,t}const jMatrix=new Matrix3,jMatrixTranspose=new Matrix3;Matrix3.computeEigenDecomposition=function(e,t){const n=CesiumMath.EPSILON20;let i=0,r=0;defined(t)||(t={});const o=t.unitary=Matrix3.clone(Matrix3.IDENTITY,t.unitary),a=t.diagonal=Matrix3.clone(e,t.diagonal),s=n*computeFrobeniusNorm(a);for(;r<10&&offDiagonalFrobeniusNorm(a)>s;)shurDecomposition(a,jMatrix),Matrix3.transpose(jMatrix,jMatrixTranspose),Matrix3.multiply(a,jMatrix,a),Matrix3.multiply(jMatrixTranspose,a,a),Matrix3.multiply(o,jMatrix,o),++i>2&&(++r,i=0);return t},Matrix3.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},Matrix3.determinant=function(e){const t=e[0],n=e[3],i=e[6],r=e[1],o=e[4],a=e[7],s=e[2],c=e[5],l=e[8];return t*(o*l-c*a)+r*(c*i-n*l)+s*(n*a-o*i)},Matrix3.inverse=function(e,t){const n=e[0],i=e[1],r=e[2],o=e[3],a=e[4],s=e[5],c=e[6],l=e[7],u=e[8],d=Matrix3.determinant(e);t[0]=a*u-l*s,t[1]=l*r-i*u,t[2]=i*s-a*r,t[3]=c*s-o*u,t[4]=n*u-c*r,t[5]=o*r-n*s,t[6]=o*l-c*a,t[7]=c*i-n*l,t[8]=n*a-o*i;const h=1/d;return Matrix3.multiplyByScalar(t,h,t)};const scratchTransposeMatrix$1=new Matrix3;function Cartesian4(e,t,n,i){this.x=defaultValue(e,0),this.y=defaultValue(t,0),this.z=defaultValue(n,0),this.w=defaultValue(i,0)}Matrix3.inverseTranspose=function(e,t){return Matrix3.inverse(Matrix3.transpose(e,scratchTransposeMatrix$1),t)},Matrix3.equals=function(e,t){return e===t||defined(e)&&defined(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]},Matrix3.equalsEpsilon=function(e,t,n){return n=defaultValue(n,0),e===t||defined(e)&&defined(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},Matrix3.IDENTITY=Object.freeze(new Matrix3(1,0,0,0,1,0,0,0,1)),Matrix3.ZERO=Object.freeze(new Matrix3(0,0,0,0,0,0,0,0,0)),Matrix3.COLUMN0ROW0=0,Matrix3.COLUMN0ROW1=1,Matrix3.COLUMN0ROW2=2,Matrix3.COLUMN1ROW0=3,Matrix3.COLUMN1ROW1=4,Matrix3.COLUMN1ROW2=5,Matrix3.COLUMN2ROW0=6,Matrix3.COLUMN2ROW1=7,Matrix3.COLUMN2ROW2=8,Object.defineProperties(Matrix3.prototype,{length:{get:function(){return Matrix3.packedLength}}}),Matrix3.prototype.clone=function(e){return Matrix3.clone(this,e)},Matrix3.prototype.equals=function(e){return Matrix3.equals(this,e)},Matrix3.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]},Matrix3.prototype.equalsEpsilon=function(e,t){return Matrix3.equalsEpsilon(this,e,t)},Matrix3.prototype.toString=function(){return`(${this[0]}, ${this[3]}, ${this[6]})\n(${this[1]}, ${this[4]}, ${this[7]})\n(${this[2]}, ${this[5]}, ${this[8]})`},Cartesian4.fromElements=function(e,t,n,i,r){return defined(r)?(r.x=e,r.y=t,r.z=n,r.w=i,r):new Cartesian4(e,t,n,i)},Cartesian4.fromColor=function(e,t){return defined(t)?(t.x=e.red,t.y=e.green,t.z=e.blue,t.w=e.alpha,t):new Cartesian4(e.red,e.green,e.blue,e.alpha)},Cartesian4.clone=function(e,t){if(defined(e))return defined(t)?(t.x=e.x,t.y=e.y,t.z=e.z,t.w=e.w,t):new Cartesian4(e.x,e.y,e.z,e.w)},Cartesian4.packedLength=4,Cartesian4.pack=function(e,t,n){return n=defaultValue(n,0),t[n++]=e.x,t[n++]=e.y,t[n++]=e.z,t[n]=e.w,t},Cartesian4.unpack=function(e,t,n){return t=defaultValue(t,0),defined(n)||(n=new Cartesian4),n.x=e[t++],n.y=e[t++],n.z=e[t++],n.w=e[t],n},Cartesian4.packArray=function(e,t){const n=e.length,i=4*n;defined(t)?(Array.isArray(t)||t.length===i)&&t.length!==i&&(t.length=i):t=new Array(i);for(let i=0;i<n;++i)Cartesian4.pack(e[i],t,4*i);return t},Cartesian4.unpackArray=function(e,t){const n=e.length;defined(t)?t.length=n/4:t=new Array(n/4);for(let i=0;i<n;i+=4){const n=i/4;t[n]=Cartesian4.unpack(e,i,t[n])}return t},Cartesian4.fromArray=Cartesian4.unpack,Cartesian4.maximumComponent=function(e){return Math.max(e.x,e.y,e.z,e.w)},Cartesian4.minimumComponent=function(e){return Math.min(e.x,e.y,e.z,e.w)},Cartesian4.minimumByComponent=function(e,t,n){return n.x=Math.min(e.x,t.x),n.y=Math.min(e.y,t.y),n.z=Math.min(e.z,t.z),n.w=Math.min(e.w,t.w),n},Cartesian4.maximumByComponent=function(e,t,n){return n.x=Math.max(e.x,t.x),n.y=Math.max(e.y,t.y),n.z=Math.max(e.z,t.z),n.w=Math.max(e.w,t.w),n},Cartesian4.clamp=function(e,t,n,i){const r=CesiumMath.clamp(e.x,t.x,n.x),o=CesiumMath.clamp(e.y,t.y,n.y),a=CesiumMath.clamp(e.z,t.z,n.z),s=CesiumMath.clamp(e.w,t.w,n.w);return i.x=r,i.y=o,i.z=a,i.w=s,i},Cartesian4.magnitudeSquared=function(e){return e.x*e.x+e.y*e.y+e.z*e.z+e.w*e.w},Cartesian4.magnitude=function(e){return Math.sqrt(Cartesian4.magnitudeSquared(e))};const distanceScratch$2=new Cartesian4;Cartesian4.distance=function(e,t){return Cartesian4.subtract(e,t,distanceScratch$2),Cartesian4.magnitude(distanceScratch$2)},Cartesian4.distanceSquared=function(e,t){return Cartesian4.subtract(e,t,distanceScratch$2),Cartesian4.magnitudeSquared(distanceScratch$2)},Cartesian4.normalize=function(e,t){const n=Cartesian4.magnitude(e);return t.x=e.x/n,t.y=e.y/n,t.z=e.z/n,t.w=e.w/n,t},Cartesian4.dot=function(e,t){return e.x*t.x+e.y*t.y+e.z*t.z+e.w*t.w},Cartesian4.multiplyComponents=function(e,t,n){return n.x=e.x*t.x,n.y=e.y*t.y,n.z=e.z*t.z,n.w=e.w*t.w,n},Cartesian4.divideComponents=function(e,t,n){return n.x=e.x/t.x,n.y=e.y/t.y,n.z=e.z/t.z,n.w=e.w/t.w,n},Cartesian4.add=function(e,t,n){return n.x=e.x+t.x,n.y=e.y+t.y,n.z=e.z+t.z,n.w=e.w+t.w,n},Cartesian4.subtract=function(e,t,n){return n.x=e.x-t.x,n.y=e.y-t.y,n.z=e.z-t.z,n.w=e.w-t.w,n},Cartesian4.multiplyByScalar=function(e,t,n){return n.x=e.x*t,n.y=e.y*t,n.z=e.z*t,n.w=e.w*t,n},Cartesian4.divideByScalar=function(e,t,n){return n.x=e.x/t,n.y=e.y/t,n.z=e.z/t,n.w=e.w/t,n},Cartesian4.negate=function(e,t){return t.x=-e.x,t.y=-e.y,t.z=-e.z,t.w=-e.w,t},Cartesian4.abs=function(e,t){return t.x=Math.abs(e.x),t.y=Math.abs(e.y),t.z=Math.abs(e.z),t.w=Math.abs(e.w),t};const lerpScratch$2=new Cartesian4;Cartesian4.lerp=function(e,t,n,i){return Cartesian4.multiplyByScalar(t,n,lerpScratch$2),i=Cartesian4.multiplyByScalar(e,1-n,i),Cartesian4.add(lerpScratch$2,i,i)};const mostOrthogonalAxisScratch$1=new Cartesian4;Cartesian4.mostOrthogonalAxis=function(e,t){const n=Cartesian4.normalize(e,mostOrthogonalAxisScratch$1);return Cartesian4.abs(n,n),t=n.x<=n.y?n.x<=n.z?n.x<=n.w?Cartesian4.clone(Cartesian4.UNIT_X,t):Cartesian4.clone(Cartesian4.UNIT_W,t):n.z<=n.w?Cartesian4.clone(Cartesian4.UNIT_Z,t):Cartesian4.clone(Cartesian4.UNIT_W,t):n.y<=n.z?n.y<=n.w?Cartesian4.clone(Cartesian4.UNIT_Y,t):Cartesian4.clone(Cartesian4.UNIT_W,t):n.z<=n.w?Cartesian4.clone(Cartesian4.UNIT_Z,t):Cartesian4.clone(Cartesian4.UNIT_W,t)},Cartesian4.equals=function(e,t){return e===t||defined(e)&&defined(t)&&e.x===t.x&&e.y===t.y&&e.z===t.z&&e.w===t.w},Cartesian4.equalsArray=function(e,t,n){return e.x===t[n]&&e.y===t[n+1]&&e.z===t[n+2]&&e.w===t[n+3]},Cartesian4.equalsEpsilon=function(e,t,n,i){return e===t||defined(e)&&defined(t)&&CesiumMath.equalsEpsilon(e.x,t.x,n,i)&&CesiumMath.equalsEpsilon(e.y,t.y,n,i)&&CesiumMath.equalsEpsilon(e.z,t.z,n,i)&&CesiumMath.equalsEpsilon(e.w,t.w,n,i)},Cartesian4.ZERO=Object.freeze(new Cartesian4(0,0,0,0)),Cartesian4.ONE=Object.freeze(new Cartesian4(1,1,1,1)),Cartesian4.UNIT_X=Object.freeze(new Cartesian4(1,0,0,0)),Cartesian4.UNIT_Y=Object.freeze(new Cartesian4(0,1,0,0)),Cartesian4.UNIT_Z=Object.freeze(new Cartesian4(0,0,1,0)),Cartesian4.UNIT_W=Object.freeze(new Cartesian4(0,0,0,1)),Cartesian4.prototype.clone=function(e){return Cartesian4.clone(this,e)},Cartesian4.prototype.equals=function(e){return Cartesian4.equals(this,e)},Cartesian4.prototype.equalsEpsilon=function(e,t,n){return Cartesian4.equalsEpsilon(this,e,t,n)},Cartesian4.prototype.toString=function(){return`(${this.x}, ${this.y}, ${this.z}, ${this.w})`};const scratchF32Array=new Float32Array(1),scratchU8Array=new Uint8Array(scratchF32Array.buffer),testU32=new Uint32Array([287454020]),testU8=new Uint8Array(testU32.buffer),littleEndian=68===testU8[0];function RuntimeError(e){let t;this.name="RuntimeError",this.message=e;try{throw new Error}catch(e){t=e.stack}this.stack=t}function Matrix4(e,t,n,i,r,o,a,s,c,l,u,d,h,p,f,m){this[0]=defaultValue(e,0),this[1]=defaultValue(r,0),this[2]=defaultValue(c,0),this[3]=defaultValue(h,0),this[4]=defaultValue(t,0),this[5]=defaultValue(o,0),this[6]=defaultValue(l,0),this[7]=defaultValue(p,0),this[8]=defaultValue(n,0),this[9]=defaultValue(a,0),this[10]=defaultValue(u,0),this[11]=defaultValue(f,0),this[12]=defaultValue(i,0),this[13]=defaultValue(s,0),this[14]=defaultValue(d,0),this[15]=defaultValue(m,0)}Cartesian4.packFloat=function(e,t){return defined(t)||(t=new Cartesian4),scratchF32Array[0]=e,littleEndian?(t.x=scratchU8Array[0],t.y=scratchU8Array[1],t.z=scratchU8Array[2],t.w=scratchU8Array[3]):(t.x=scratchU8Array[3],t.y=scratchU8Array[2],t.z=scratchU8Array[1],t.w=scratchU8Array[0]),t},Cartesian4.unpackFloat=function(e){return littleEndian?(scratchU8Array[0]=e.x,scratchU8Array[1]=e.y,scratchU8Array[2]=e.z,scratchU8Array[3]=e.w):(scratchU8Array[0]=e.w,scratchU8Array[1]=e.z,scratchU8Array[2]=e.y,scratchU8Array[3]=e.x),scratchF32Array[0]},defined(Object.create)&&(RuntimeError.prototype=Object.create(Error.prototype),RuntimeError.prototype.constructor=RuntimeError),RuntimeError.prototype.toString=function(){let e=`${this.name}: ${this.message}`;return defined(this.stack)&&(e+=`\n${this.stack.toString()}`),e},Matrix4.packedLength=16,Matrix4.pack=function(e,t,n){return n=defaultValue(n,0),t[n++]=e[0],t[n++]=e[1],t[n++]=e[2],t[n++]=e[3],t[n++]=e[4],t[n++]=e[5],t[n++]=e[6],t[n++]=e[7],t[n++]=e[8],t[n++]=e[9],t[n++]=e[10],t[n++]=e[11],t[n++]=e[12],t[n++]=e[13],t[n++]=e[14],t[n]=e[15],t},Matrix4.unpack=function(e,t,n){return t=defaultValue(t,0),defined(n)||(n=new Matrix4),n[0]=e[t++],n[1]=e[t++],n[2]=e[t++],n[3]=e[t++],n[4]=e[t++],n[5]=e[t++],n[6]=e[t++],n[7]=e[t++],n[8]=e[t++],n[9]=e[t++],n[10]=e[t++],n[11]=e[t++],n[12]=e[t++],n[13]=e[t++],n[14]=e[t++],n[15]=e[t],n},Matrix4.packArray=function(e,t){const n=e.length,i=16*n;defined(t)?(Array.isArray(t)||t.length===i)&&t.length!==i&&(t.length=i):t=new Array(i);for(let i=0;i<n;++i)Matrix4.pack(e[i],t,16*i);return t},Matrix4.unpackArray=function(e,t){const n=e.length;defined(t)?t.length=n/16:t=new Array(n/16);for(let i=0;i<n;i+=16){const n=i/16;t[n]=Matrix4.unpack(e,i,t[n])}return t},Matrix4.clone=function(e,t){if(defined(e))return defined(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[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t):new Matrix4(e[0],e[4],e[8],e[12],e[1],e[5],e[9],e[13],e[2],e[6],e[10],e[14],e[3],e[7],e[11],e[15])},Matrix4.fromArray=Matrix4.unpack,Matrix4.fromColumnMajorArray=function(e,t){return Matrix4.clone(e,t)},Matrix4.fromRowMajorArray=function(e,t){return defined(t)?(t[0]=e[0],t[1]=e[4],t[2]=e[8],t[3]=e[12],t[4]=e[1],t[5]=e[5],t[6]=e[9],t[7]=e[13],t[8]=e[2],t[9]=e[6],t[10]=e[10],t[11]=e[14],t[12]=e[3],t[13]=e[7],t[14]=e[11],t[15]=e[15],t):new Matrix4(e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8],e[9],e[10],e[11],e[12],e[13],e[14],e[15])},Matrix4.fromRotationTranslation=function(e,t,n){return t=defaultValue(t,Cartesian3.ZERO),defined(n)?(n[0]=e[0],n[1]=e[1],n[2]=e[2],n[3]=0,n[4]=e[3],n[5]=e[4],n[6]=e[5],n[7]=0,n[8]=e[6],n[9]=e[7],n[10]=e[8],n[11]=0,n[12]=t.x,n[13]=t.y,n[14]=t.z,n[15]=1,n):new Matrix4(e[0],e[3],e[6],t.x,e[1],e[4],e[7],t.y,e[2],e[5],e[8],t.z,0,0,0,1)},Matrix4.fromTranslationQuaternionRotationScale=function(e,t,n,i){defined(i)||(i=new Matrix4);const r=n.x,o=n.y,a=n.z,s=t.x*t.x,c=t.x*t.y,l=t.x*t.z,u=t.x*t.w,d=t.y*t.y,h=t.y*t.z,p=t.y*t.w,f=t.z*t.z,m=t.z*t.w,g=t.w*t.w,_=s-d-f+g,y=2*(c-m),C=2*(l+p),T=2*(c+m),S=-s+d-f+g,A=2*(h-u),v=2*(l-p),E=2*(h+u),b=-s-d+f+g;return i[0]=_*r,i[1]=T*r,i[2]=v*r,i[3]=0,i[4]=y*o,i[5]=S*o,i[6]=E*o,i[7]=0,i[8]=C*a,i[9]=A*a,i[10]=b*a,i[11]=0,i[12]=e.x,i[13]=e.y,i[14]=e.z,i[15]=1,i},Matrix4.fromTranslationRotationScale=function(e,t){return Matrix4.fromTranslationQuaternionRotationScale(e.translation,e.rotation,e.scale,t)},Matrix4.fromTranslation=function(e,t){return Matrix4.fromRotationTranslation(Matrix3.IDENTITY,e,t)},Matrix4.fromScale=function(e,t){return defined(t)?(t[0]=e.x,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=e.y,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=e.z,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t):new Matrix4(e.x,0,0,0,0,e.y,0,0,0,0,e.z,0,0,0,0,1)},Matrix4.fromUniformScale=function(e,t){return defined(t)?(t[0]=e,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=e,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=e,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t):new Matrix4(e,0,0,0,0,e,0,0,0,0,e,0,0,0,0,1)},Matrix4.fromRotation=function(e,t){return defined(t)||(t=new Matrix4),t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=0,t[4]=e[3],t[5]=e[4],t[6]=e[5],t[7]=0,t[8]=e[6],t[9]=e[7],t[10]=e[8],t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t};const fromCameraF=new Cartesian3,fromCameraR=new Cartesian3,fromCameraU=new Cartesian3;Matrix4.fromCamera=function(e,t){const n=e.position,i=e.direction,r=e.up;Cartesian3.normalize(i,fromCameraF),Cartesian3.normalize(Cartesian3.cross(fromCameraF,r,fromCameraR),fromCameraR),Cartesian3.normalize(Cartesian3.cross(fromCameraR,fromCameraF,fromCameraU),fromCameraU);const o=fromCameraR.x,a=fromCameraR.y,s=fromCameraR.z,c=fromCameraF.x,l=fromCameraF.y,u=fromCameraF.z,d=fromCameraU.x,h=fromCameraU.y,p=fromCameraU.z,f=n.x,m=n.y,g=n.z,_=o*-f+a*-m+s*-g,y=d*-f+h*-m+p*-g,C=c*f+l*m+u*g;return defined(t)?(t[0]=o,t[1]=d,t[2]=-c,t[3]=0,t[4]=a,t[5]=h,t[6]=-l,t[7]=0,t[8]=s,t[9]=p,t[10]=-u,t[11]=0,t[12]=_,t[13]=y,t[14]=C,t[15]=1,t):new Matrix4(o,a,s,_,d,h,p,y,-c,-l,-u,C,0,0,0,1)},Matrix4.computePerspectiveFieldOfView=function(e,t,n,i,r){const o=1/Math.tan(.5*e),a=o/t,s=(i+n)/(n-i),c=2*i*n/(n-i);return r[0]=a,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=o,r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[10]=s,r[11]=-1,r[12]=0,r[13]=0,r[14]=c,r[15]=0,r},Matrix4.computeOrthographicOffCenter=function(e,t,n,i,r,o,a){let s=1/(t-e),c=1/(i-n),l=1/(o-r);const u=-(t+e)*s,d=-(i+n)*c,h=-(o+r)*l;return s*=2,c*=2,l*=-2,a[0]=s,a[1]=0,a[2]=0,a[3]=0,a[4]=0,a[5]=c,a[6]=0,a[7]=0,a[8]=0,a[9]=0,a[10]=l,a[11]=0,a[12]=u,a[13]=d,a[14]=h,a[15]=1,a},Matrix4.computePerspectiveOffCenter=function(e,t,n,i,r,o,a){const s=2*r/(t-e),c=2*r/(i-n),l=(t+e)/(t-e),u=(i+n)/(i-n),d=-(o+r)/(o-r),h=-2*o*r/(o-r)