Agriculture-front-end/public/Cesium/Workers/BoundingSphere-561b54d0.js
2023-04-16 22:33:44 +08:00

2 lines
36 KiB
JavaScript

define(["exports","./Cartographic-3309dd0d","./Check-7b2a090c","./when-b60132fc","./Cartesian2-47311507","./Math-119be1a3","./Cartesian4-3ca25aab","./RuntimeError-4a5c8994"],(function(e,n,t,a,r,i,u,s){"use strict";function o(e){this._ellipsoid=a.defaultValue(e,r.Ellipsoid.WGS84),this._semimajorAxis=this._ellipsoid.maximumRadius,this._oneOverSemimajorAxis=1/this._semimajorAxis}Object.defineProperties(o.prototype,{ellipsoid:{get:function(){return this._ellipsoid}}}),o.prototype.project=function(e,t){var r=this._semimajorAxis,i=e.longitude*r,u=e.latitude*r,s=e.height;return a.defined(t)?(t.x=i,t.y=u,t.z=s,t):new n.Cartesian3(i,u,s)},o.prototype.unproject=function(e,t){var r=this._oneOverSemimajorAxis,i=e.x*r,u=e.y*r,s=e.z;return a.defined(t)?(t.longitude=i,t.latitude=u,t.height=s,t):new n.Cartographic(i,u,s)};var c=Object.freeze({OUTSIDE:-1,INTERSECTING:0,INSIDE:1});function l(e,n){this.start=a.defaultValue(e,0),this.stop=a.defaultValue(n,0)}function d(e,n,t,r,i,u,s,o,c){this[0]=a.defaultValue(e,0),this[1]=a.defaultValue(r,0),this[2]=a.defaultValue(s,0),this[3]=a.defaultValue(n,0),this[4]=a.defaultValue(i,0),this[5]=a.defaultValue(o,0),this[6]=a.defaultValue(t,0),this[7]=a.defaultValue(u,0),this[8]=a.defaultValue(c,0)}d.packedLength=9,d.pack=function(e,n,t){return t=a.defaultValue(t,0),n[t++]=e[0],n[t++]=e[1],n[t++]=e[2],n[t++]=e[3],n[t++]=e[4],n[t++]=e[5],n[t++]=e[6],n[t++]=e[7],n[t++]=e[8],n},d.unpack=function(e,n,t){return n=a.defaultValue(n,0),a.defined(t)||(t=new d),t[0]=e[n++],t[1]=e[n++],t[2]=e[n++],t[3]=e[n++],t[4]=e[n++],t[5]=e[n++],t[6]=e[n++],t[7]=e[n++],t[8]=e[n++],t},d.clone=function(e,n){if(a.defined(e))return a.defined(n)?(n[0]=e[0],n[1]=e[1],n[2]=e[2],n[3]=e[3],n[4]=e[4],n[5]=e[5],n[6]=e[6],n[7]=e[7],n[8]=e[8],n):new d(e[0],e[3],e[6],e[1],e[4],e[7],e[2],e[5],e[8])},d.fromArray=function(e,n,t){return n=a.defaultValue(n,0),a.defined(t)||(t=new d),t[0]=e[n],t[1]=e[n+1],t[2]=e[n+2],t[3]=e[n+3],t[4]=e[n+4],t[5]=e[n+5],t[6]=e[n+6],t[7]=e[n+7],t[8]=e[n+8],t},d.fromColumnMajorArray=function(e,n){return d.clone(e,n)},d.fromRowMajorArray=function(e,n){return a.defined(n)?(n[0]=e[0],n[1]=e[3],n[2]=e[6],n[3]=e[1],n[4]=e[4],n[5]=e[7],n[6]=e[2],n[7]=e[5],n[8]=e[8],n):new d(e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8])},d.fromQuaternion=function(e,n){var t=e.x*e.x,r=e.x*e.y,i=e.x*e.z,u=e.x*e.w,s=e.y*e.y,o=e.y*e.z,c=e.y*e.w,l=e.z*e.z,f=e.z*e.w,C=e.w*e.w,h=t-s-l+C,m=2*(r-f),y=2*(i+c),p=2*(r+f),v=-t+s-l+C,x=2*(o-u),w=2*(i-c),g=2*(o+u),z=-t-s+l+C;return a.defined(n)?(n[0]=h,n[1]=p,n[2]=w,n[3]=m,n[4]=v,n[5]=g,n[6]=y,n[7]=x,n[8]=z,n):new d(h,m,y,p,v,x,w,g,z)},d.fromHeadingPitchRoll=function(e,n){var t=Math.cos(-e.pitch),r=Math.cos(-e.heading),i=Math.cos(e.roll),u=Math.sin(-e.pitch),s=Math.sin(-e.heading),o=Math.sin(e.roll),c=t*r,l=-i*s+o*u*r,f=o*s+i*u*r,C=t*s,h=i*r+o*u*s,m=-o*r+i*u*s,y=-u,p=o*t,v=i*t;return a.defined(n)?(n[0]=c,n[1]=C,n[2]=y,n[3]=l,n[4]=h,n[5]=p,n[6]=f,n[7]=m,n[8]=v,n):new d(c,l,f,C,h,m,y,p,v)},d.fromScale=function(e,n){return a.defined(n)?(n[0]=e.x,n[1]=0,n[2]=0,n[3]=0,n[4]=e.y,n[5]=0,n[6]=0,n[7]=0,n[8]=e.z,n):new d(e.x,0,0,0,e.y,0,0,0,e.z)},d.fromUniformScale=function(e,n){return a.defined(n)?(n[0]=e,n[1]=0,n[2]=0,n[3]=0,n[4]=e,n[5]=0,n[6]=0,n[7]=0,n[8]=e,n):new d(e,0,0,0,e,0,0,0,e)},d.fromCrossProduct=function(e,n){return a.defined(n)?(n[0]=0,n[1]=e.z,n[2]=-e.y,n[3]=-e.z,n[4]=0,n[5]=e.x,n[6]=e.y,n[7]=-e.x,n[8]=0,n):new d(0,-e.z,e.y,e.z,0,-e.x,-e.y,e.x,0)},d.fromRotationX=function(e,n){var t=Math.cos(e),r=Math.sin(e);return a.defined(n)?(n[0]=1,n[1]=0,n[2]=0,n[3]=0,n[4]=t,n[5]=r,n[6]=0,n[7]=-r,n[8]=t,n):new d(1,0,0,0,t,-r,0,r,t)},d.fromRotationY=function(e,n){var t=Math.cos(e),r=Math.sin(e);return a.defined(n)?(n[0]=t,n[1]=0,n[2]=-r,n[3]=0,n[4]=1,n[5]=0,n[6]=r,n[7]=0,n[8]=t,n):new d(t,0,r,0,1,0,-r,0,t)},d.fromRotationZ=function(e,n){var t=Math.cos(e),r=Math.sin(e);return a.defined(n)?(n[0]=t,n[1]=r,n[2]=0,n[3]=-r,n[4]=t,n[5]=0,n[6]=0,n[7]=0,n[8]=1,n):new d(t,-r,0,r,t,0,0,0,1)},d.toArray=function(e,n){return a.defined(n)?(n[0]=e[0],n[1]=e[1],n[2]=e[2],n[3]=e[3],n[4]=e[4],n[5]=e[5],n[6]=e[6],n[7]=e[7],n[8]=e[8],n):[e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8]]},d.getElementIndex=function(e,n){return 3*e+n},d.getColumn=function(e,n,t){var a=3*n,r=e[a],i=e[a+1],u=e[a+2];return t.x=r,t.y=i,t.z=u,t},d.setColumn=function(e,n,t,a){var r=3*n;return(a=d.clone(e,a))[r]=t.x,a[r+1]=t.y,a[r+2]=t.z,a},d.getRow=function(e,n,t){var a=e[n],r=e[n+3],i=e[n+6];return t.x=a,t.y=r,t.z=i,t},d.setRow=function(e,n,t,a){return(a=d.clone(e,a))[n]=t.x,a[n+3]=t.y,a[n+6]=t.z,a};var f=new n.Cartesian3;d.getScale=function(e,t){return t.x=n.Cartesian3.magnitude(n.Cartesian3.fromElements(e[0],e[1],e[2],f)),t.y=n.Cartesian3.magnitude(n.Cartesian3.fromElements(e[3],e[4],e[5],f)),t.z=n.Cartesian3.magnitude(n.Cartesian3.fromElements(e[6],e[7],e[8],f)),t};var C=new n.Cartesian3;d.getMaximumScale=function(e){return d.getScale(e,C),n.Cartesian3.maximumComponent(C)},d.multiply=function(e,n,t){var a=e[0]*n[0]+e[3]*n[1]+e[6]*n[2],r=e[1]*n[0]+e[4]*n[1]+e[7]*n[2],i=e[2]*n[0]+e[5]*n[1]+e[8]*n[2],u=e[0]*n[3]+e[3]*n[4]+e[6]*n[5],s=e[1]*n[3]+e[4]*n[4]+e[7]*n[5],o=e[2]*n[3]+e[5]*n[4]+e[8]*n[5],c=e[0]*n[6]+e[3]*n[7]+e[6]*n[8],l=e[1]*n[6]+e[4]*n[7]+e[7]*n[8],d=e[2]*n[6]+e[5]*n[7]+e[8]*n[8];return t[0]=a,t[1]=r,t[2]=i,t[3]=u,t[4]=s,t[5]=o,t[6]=c,t[7]=l,t[8]=d,t},d.add=function(e,n,t){return t[0]=e[0]+n[0],t[1]=e[1]+n[1],t[2]=e[2]+n[2],t[3]=e[3]+n[3],t[4]=e[4]+n[4],t[5]=e[5]+n[5],t[6]=e[6]+n[6],t[7]=e[7]+n[7],t[8]=e[8]+n[8],t},d.subtract=function(e,n,t){return t[0]=e[0]-n[0],t[1]=e[1]-n[1],t[2]=e[2]-n[2],t[3]=e[3]-n[3],t[4]=e[4]-n[4],t[5]=e[5]-n[5],t[6]=e[6]-n[6],t[7]=e[7]-n[7],t[8]=e[8]-n[8],t},d.multiplyByVector=function(e,n,t){var a=n.x,r=n.y,i=n.z,u=e[0]*a+e[3]*r+e[6]*i,s=e[1]*a+e[4]*r+e[7]*i,o=e[2]*a+e[5]*r+e[8]*i;return t.x=u,t.y=s,t.z=o,t},d.multiplyByScalar=function(e,n,t){return t[0]=e[0]*n,t[1]=e[1]*n,t[2]=e[2]*n,t[3]=e[3]*n,t[4]=e[4]*n,t[5]=e[5]*n,t[6]=e[6]*n,t[7]=e[7]*n,t[8]=e[8]*n,t},d.multiplyByScale=function(e,n,t){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},d.negate=function(e,n){return n[0]=-e[0],n[1]=-e[1],n[2]=-e[2],n[3]=-e[3],n[4]=-e[4],n[5]=-e[5],n[6]=-e[6],n[7]=-e[7],n[8]=-e[8],n},d.transpose=function(e,n){var t=e[0],a=e[3],r=e[6],i=e[1],u=e[4],s=e[7],o=e[2],c=e[5],l=e[8];return n[0]=t,n[1]=a,n[2]=r,n[3]=i,n[4]=u,n[5]=s,n[6]=o,n[7]=c,n[8]=l,n};var h=new n.Cartesian3(1,1,1);d.getRotation=function(e,t){var a=n.Cartesian3.divideComponents(h,d.getScale(e,C),C);return t=d.multiplyByScale(e,a,t)};var m=[1,0,0],y=[2,2,1];function p(e){for(var n=0,t=0;t<3;++t){var a=e[d.getElementIndex(y[t],m[t])];n+=2*a*a}return Math.sqrt(n)}function v(e,n){for(var t=i.CesiumMath.EPSILON15,a=0,r=1,u=0;u<3;++u){var s=Math.abs(e[d.getElementIndex(y[u],m[u])]);s>a&&(r=u,a=s)}var o=1,c=0,l=m[r],f=y[r];if(Math.abs(e[d.getElementIndex(f,l)])>t){var C,h=(e[d.getElementIndex(f,f)]-e[d.getElementIndex(l,l)])/2/e[d.getElementIndex(f,l)];c=(C=h<0?-1/(-h+Math.sqrt(1+h*h)):1/(h+Math.sqrt(1+h*h)))*(o=1/Math.sqrt(1+C*C))}return(n=d.clone(d.IDENTITY,n))[d.getElementIndex(l,l)]=n[d.getElementIndex(f,f)]=o,n[d.getElementIndex(f,l)]=c,n[d.getElementIndex(l,f)]=-c,n}var x=new d,w=new d;function g(e,n,t,r,i,u,s,o,c,l,d,f,C,h,m,y){this[0]=a.defaultValue(e,0),this[1]=a.defaultValue(i,0),this[2]=a.defaultValue(c,0),this[3]=a.defaultValue(C,0),this[4]=a.defaultValue(n,0),this[5]=a.defaultValue(u,0),this[6]=a.defaultValue(l,0),this[7]=a.defaultValue(h,0),this[8]=a.defaultValue(t,0),this[9]=a.defaultValue(s,0),this[10]=a.defaultValue(d,0),this[11]=a.defaultValue(m,0),this[12]=a.defaultValue(r,0),this[13]=a.defaultValue(o,0),this[14]=a.defaultValue(f,0),this[15]=a.defaultValue(y,0)}d.computeEigenDecomposition=function(e,n){var t=i.CesiumMath.EPSILON20,r=0,u=0;a.defined(n)||(n={});for(var s=n.unitary=d.clone(d.IDENTITY,n.unitary),o=n.diagonal=d.clone(e,n.diagonal),c=t*function(e){for(var n=0,t=0;t<9;++t){var a=e[t];n+=a*a}return Math.sqrt(n)}(o);u<10&&p(o)>c;)v(o,x),d.transpose(x,w),d.multiply(o,x,o),d.multiply(w,o,o),d.multiply(s,x,s),++r>2&&(++u,r=0);return n},d.abs=function(e,n){return n[0]=Math.abs(e[0]),n[1]=Math.abs(e[1]),n[2]=Math.abs(e[2]),n[3]=Math.abs(e[3]),n[4]=Math.abs(e[4]),n[5]=Math.abs(e[5]),n[6]=Math.abs(e[6]),n[7]=Math.abs(e[7]),n[8]=Math.abs(e[8]),n},d.determinant=function(e){var n=e[0],t=e[3],a=e[6],r=e[1],i=e[4],u=e[7],s=e[2],o=e[5],c=e[8];return n*(i*c-o*u)+r*(o*a-t*c)+s*(t*u-i*a)},d.inverse=function(e,n){var t=e[0],a=e[1],r=e[2],i=e[3],u=e[4],s=e[5],o=e[6],c=e[7],l=e[8],f=d.determinant(e);n[0]=u*l-c*s,n[1]=c*r-a*l,n[2]=a*s-u*r,n[3]=o*s-i*l,n[4]=t*l-o*r,n[5]=i*r-t*s,n[6]=i*c-o*u,n[7]=o*a-t*c,n[8]=t*u-i*a;var C=1/f;return d.multiplyByScalar(n,C,n)},d.equals=function(e,n){return e===n||a.defined(e)&&a.defined(n)&&e[0]===n[0]&&e[1]===n[1]&&e[2]===n[2]&&e[3]===n[3]&&e[4]===n[4]&&e[5]===n[5]&&e[6]===n[6]&&e[7]===n[7]&&e[8]===n[8]},d.equalsEpsilon=function(e,n,t){return e===n||a.defined(e)&&a.defined(n)&&Math.abs(e[0]-n[0])<=t&&Math.abs(e[1]-n[1])<=t&&Math.abs(e[2]-n[2])<=t&&Math.abs(e[3]-n[3])<=t&&Math.abs(e[4]-n[4])<=t&&Math.abs(e[5]-n[5])<=t&&Math.abs(e[6]-n[6])<=t&&Math.abs(e[7]-n[7])<=t&&Math.abs(e[8]-n[8])<=t},d.IDENTITY=Object.freeze(new d(1,0,0,0,1,0,0,0,1)),d.ZERO=Object.freeze(new d(0,0,0,0,0,0,0,0,0)),d.COLUMN0ROW0=0,d.COLUMN0ROW1=1,d.COLUMN0ROW2=2,d.COLUMN1ROW0=3,d.COLUMN1ROW1=4,d.COLUMN1ROW2=5,d.COLUMN2ROW0=6,d.COLUMN2ROW1=7,d.COLUMN2ROW2=8,Object.defineProperties(d.prototype,{length:{get:function(){return d.packedLength}}}),d.prototype.clone=function(e){return d.clone(this,e)},d.prototype.equals=function(e){return d.equals(this,e)},d.equalsArray=function(e,n,t){return e[0]===n[t]&&e[1]===n[t+1]&&e[2]===n[t+2]&&e[3]===n[t+3]&&e[4]===n[t+4]&&e[5]===n[t+5]&&e[6]===n[t+6]&&e[7]===n[t+7]&&e[8]===n[t+8]},d.prototype.equalsEpsilon=function(e,n){return d.equalsEpsilon(this,e,n)},d.prototype.toString=function(){return"("+this[0]+", "+this[3]+", "+this[6]+")\n("+this[1]+", "+this[4]+", "+this[7]+")\n("+this[2]+", "+this[5]+", "+this[8]+")"},g.packedLength=16,g.pack=function(e,n,t){return t=a.defaultValue(t,0),n[t++]=e[0],n[t++]=e[1],n[t++]=e[2],n[t++]=e[3],n[t++]=e[4],n[t++]=e[5],n[t++]=e[6],n[t++]=e[7],n[t++]=e[8],n[t++]=e[9],n[t++]=e[10],n[t++]=e[11],n[t++]=e[12],n[t++]=e[13],n[t++]=e[14],n[t]=e[15],n},g.unpack=function(e,n,t){return n=a.defaultValue(n,0),a.defined(t)||(t=new g),t[0]=e[n++],t[1]=e[n++],t[2]=e[n++],t[3]=e[n++],t[4]=e[n++],t[5]=e[n++],t[6]=e[n++],t[7]=e[n++],t[8]=e[n++],t[9]=e[n++],t[10]=e[n++],t[11]=e[n++],t[12]=e[n++],t[13]=e[n++],t[14]=e[n++],t[15]=e[n],t},g.clone=function(e,n){if(a.defined(e))return a.defined(n)?(n[0]=e[0],n[1]=e[1],n[2]=e[2],n[3]=e[3],n[4]=e[4],n[5]=e[5],n[6]=e[6],n[7]=e[7],n[8]=e[8],n[9]=e[9],n[10]=e[10],n[11]=e[11],n[12]=e[12],n[13]=e[13],n[14]=e[14],n[15]=e[15],n):new g(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])},g.fromArray=g.unpack,g.fromColumnMajorArray=function(e,n){return g.clone(e,n)},g.fromRowMajorArray=function(e,n){return a.defined(n)?(n[0]=e[0],n[1]=e[4],n[2]=e[8],n[3]=e[12],n[4]=e[1],n[5]=e[5],n[6]=e[9],n[7]=e[13],n[8]=e[2],n[9]=e[6],n[10]=e[10],n[11]=e[14],n[12]=e[3],n[13]=e[7],n[14]=e[11],n[15]=e[15],n):new g(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])},g.fromRotationTranslation=function(e,t,r){return t=a.defaultValue(t,n.Cartesian3.ZERO),a.defined(r)?(r[0]=e[0],r[1]=e[1],r[2]=e[2],r[3]=0,r[4]=e[3],r[5]=e[4],r[6]=e[5],r[7]=0,r[8]=e[6],r[9]=e[7],r[10]=e[8],r[11]=0,r[12]=t.x,r[13]=t.y,r[14]=t.z,r[15]=1,r):new g(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)},g.fromTranslationQuaternionRotationScale=function(e,n,t,r){a.defined(r)||(r=new g);var i=t.x,u=t.y,s=t.z,o=n.x*n.x,c=n.x*n.y,l=n.x*n.z,d=n.x*n.w,f=n.y*n.y,C=n.y*n.z,h=n.y*n.w,m=n.z*n.z,y=n.z*n.w,p=n.w*n.w,v=o-f-m+p,x=2*(c-y),w=2*(l+h),z=2*(c+y),M=-o+f-m+p,b=2*(C-d),O=2*(l-h),R=2*(C+d),S=-o-f+m+p;return r[0]=v*i,r[1]=z*i,r[2]=O*i,r[3]=0,r[4]=x*u,r[5]=M*u,r[6]=R*u,r[7]=0,r[8]=w*s,r[9]=b*s,r[10]=S*s,r[11]=0,r[12]=e.x,r[13]=e.y,r[14]=e.z,r[15]=1,r},g.fromTranslationRotationScale=function(e,n){return g.fromTranslationQuaternionRotationScale(e.translation,e.rotation,e.scale,n)},g.fromTranslation=function(e,n){return g.fromRotationTranslation(d.IDENTITY,e,n)},g.fromScale=function(e,n){return a.defined(n)?(n[0]=e.x,n[1]=0,n[2]=0,n[3]=0,n[4]=0,n[5]=e.y,n[6]=0,n[7]=0,n[8]=0,n[9]=0,n[10]=e.z,n[11]=0,n[12]=0,n[13]=0,n[14]=0,n[15]=1,n):new g(e.x,0,0,0,0,e.y,0,0,0,0,e.z,0,0,0,0,1)},g.fromUniformScale=function(e,n){return a.defined(n)?(n[0]=e,n[1]=0,n[2]=0,n[3]=0,n[4]=0,n[5]=e,n[6]=0,n[7]=0,n[8]=0,n[9]=0,n[10]=e,n[11]=0,n[12]=0,n[13]=0,n[14]=0,n[15]=1,n):new g(e,0,0,0,0,e,0,0,0,0,e,0,0,0,0,1)};var z=new n.Cartesian3,M=new n.Cartesian3,b=new n.Cartesian3;g.fromCamera=function(e,t){var r=e.position,i=e.direction,u=e.up;n.Cartesian3.normalize(i,z),n.Cartesian3.normalize(n.Cartesian3.cross(z,u,M),M),n.Cartesian3.normalize(n.Cartesian3.cross(M,z,b),b);var s=M.x,o=M.y,c=M.z,l=z.x,d=z.y,f=z.z,C=b.x,h=b.y,m=b.z,y=r.x,p=r.y,v=r.z,x=s*-y+o*-p+c*-v,w=C*-y+h*-p+m*-v,O=l*y+d*p+f*v;return a.defined(t)?(t[0]=s,t[1]=C,t[2]=-l,t[3]=0,t[4]=o,t[5]=h,t[6]=-d,t[7]=0,t[8]=c,t[9]=m,t[10]=-f,t[11]=0,t[12]=x,t[13]=w,t[14]=O,t[15]=1,t):new g(s,o,c,x,C,h,m,w,-l,-d,-f,O,0,0,0,1)},g.computePerspectiveFieldOfView=function(e,n,t,a,r){var i=1/Math.tan(.5*e),u=i/n,s=(a+t)/(t-a),o=2*a*t/(t-a);return r[0]=u,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=i,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]=o,r[15]=0,r},g.computeOrthographicOffCenter=function(e,n,t,a,r,i,u){var s=1/(n-e),o=1/(a-t),c=1/(i-r),l=-(n+e)*s,d=-(a+t)*o,f=-(i+r)*c;return s*=2,o*=2,c*=-2,u[0]=s,u[1]=0,u[2]=0,u[3]=0,u[4]=0,u[5]=o,u[6]=0,u[7]=0,u[8]=0,u[9]=0,u[10]=c,u[11]=0,u[12]=l,u[13]=d,u[14]=f,u[15]=1,u},g.computePerspectiveOffCenter=function(e,n,t,a,r,i,u){var s=2*r/(n-e),o=2*r/(a-t),c=(n+e)/(n-e),l=(a+t)/(a-t),d=-(i+r)/(i-r),f=-2*i*r/(i-r);return u[0]=s,u[1]=0,u[2]=0,u[3]=0,u[4]=0,u[5]=o,u[6]=0,u[7]=0,u[8]=c,u[9]=l,u[10]=d,u[11]=-1,u[12]=0,u[13]=0,u[14]=f,u[15]=0,u},g.computeInfinitePerspectiveOffCenter=function(e,n,t,a,r,i){var u=2*r/(n-e),s=2*r/(a-t),o=(n+e)/(n-e),c=(a+t)/(a-t),l=-2*r;return i[0]=u,i[1]=0,i[2]=0,i[3]=0,i[4]=0,i[5]=s,i[6]=0,i[7]=0,i[8]=o,i[9]=c,i[10]=-1,i[11]=-1,i[12]=0,i[13]=0,i[14]=l,i[15]=0,i},g.computeViewportTransformation=function(e,n,t,r){e=a.defaultValue(e,a.defaultValue.EMPTY_OBJECT);var i=a.defaultValue(e.x,0),u=a.defaultValue(e.y,0),s=a.defaultValue(e.width,0),o=a.defaultValue(e.height,0);n=a.defaultValue(n,0);var c=.5*s,l=.5*o,d=.5*((t=a.defaultValue(t,1))-n),f=c,C=l,h=d,m=i+c,y=u+l,p=n+d;return r[0]=f,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=C,r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[10]=h,r[11]=0,r[12]=m,r[13]=y,r[14]=p,r[15]=1,r},g.computeView=function(e,t,a,r,i){return i[0]=r.x,i[1]=a.x,i[2]=-t.x,i[3]=0,i[4]=r.y,i[5]=a.y,i[6]=-t.y,i[7]=0,i[8]=r.z,i[9]=a.z,i[10]=-t.z,i[11]=0,i[12]=-n.Cartesian3.dot(r,e),i[13]=-n.Cartesian3.dot(a,e),i[14]=n.Cartesian3.dot(t,e),i[15]=1,i},g.toArray=function(e,n){return a.defined(n)?(n[0]=e[0],n[1]=e[1],n[2]=e[2],n[3]=e[3],n[4]=e[4],n[5]=e[5],n[6]=e[6],n[7]=e[7],n[8]=e[8],n[9]=e[9],n[10]=e[10],n[11]=e[11],n[12]=e[12],n[13]=e[13],n[14]=e[14],n[15]=e[15],n):[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]]},g.getElementIndex=function(e,n){return 4*e+n},g.getColumn=function(e,n,t){var a=4*n,r=e[a],i=e[a+1],u=e[a+2],s=e[a+3];return t.x=r,t.y=i,t.z=u,t.w=s,t},g.setColumn=function(e,n,t,a){var r=4*n;return(a=g.clone(e,a))[r]=t.x,a[r+1]=t.y,a[r+2]=t.z,a[r+3]=t.w,a},g.setTranslation=function(e,n,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[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=n.x,t[13]=n.y,t[14]=n.z,t[15]=e[15],t};var O=new n.Cartesian3;g.setScale=function(e,t,a){var r=g.getScale(e,O),i=n.Cartesian3.divideComponents(t,r,O);return g.multiplyByScale(e,i,a)},g.getRow=function(e,n,t){var a=e[n],r=e[n+4],i=e[n+8],u=e[n+12];return t.x=a,t.y=r,t.z=i,t.w=u,t},g.setRow=function(e,n,t,a){return(a=g.clone(e,a))[n]=t.x,a[n+4]=t.y,a[n+8]=t.z,a[n+12]=t.w,a};var R=new n.Cartesian3;g.getScale=function(e,t){return t.x=n.Cartesian3.magnitude(n.Cartesian3.fromElements(e[0],e[1],e[2],R)),t.y=n.Cartesian3.magnitude(n.Cartesian3.fromElements(e[4],e[5],e[6],R)),t.z=n.Cartesian3.magnitude(n.Cartesian3.fromElements(e[8],e[9],e[10],R)),t};var S=new n.Cartesian3;g.getMaximumScale=function(e){return g.getScale(e,S),n.Cartesian3.maximumComponent(S)},g.multiply=function(e,n,t){var a=e[0],r=e[1],i=e[2],u=e[3],s=e[4],o=e[5],c=e[6],l=e[7],d=e[8],f=e[9],C=e[10],h=e[11],m=e[12],y=e[13],p=e[14],v=e[15],x=n[0],w=n[1],g=n[2],z=n[3],M=n[4],b=n[5],O=n[6],R=n[7],S=n[8],E=n[9],V=n[10],q=n[11],N=n[12],I=n[13],T=n[14],L=n[15],U=a*x+s*w+d*g+m*z,P=r*x+o*w+f*g+y*z,W=i*x+c*w+C*g+p*z,B=u*x+l*w+h*g+v*z,j=a*M+s*b+d*O+m*R,A=r*M+o*b+f*O+y*R,D=i*M+c*b+C*O+p*R,Z=u*M+l*b+h*O+v*R,k=a*S+s*E+d*V+m*q,_=r*S+o*E+f*V+y*q,Y=i*S+c*E+C*V+p*q,G=u*S+l*E+h*V+v*q,H=a*N+s*I+d*T+m*L,Q=r*N+o*I+f*T+y*L,X=i*N+c*I+C*T+p*L,F=u*N+l*I+h*T+v*L;return t[0]=U,t[1]=P,t[2]=W,t[3]=B,t[4]=j,t[5]=A,t[6]=D,t[7]=Z,t[8]=k,t[9]=_,t[10]=Y,t[11]=G,t[12]=H,t[13]=Q,t[14]=X,t[15]=F,t},g.add=function(e,n,t){return t[0]=e[0]+n[0],t[1]=e[1]+n[1],t[2]=e[2]+n[2],t[3]=e[3]+n[3],t[4]=e[4]+n[4],t[5]=e[5]+n[5],t[6]=e[6]+n[6],t[7]=e[7]+n[7],t[8]=e[8]+n[8],t[9]=e[9]+n[9],t[10]=e[10]+n[10],t[11]=e[11]+n[11],t[12]=e[12]+n[12],t[13]=e[13]+n[13],t[14]=e[14]+n[14],t[15]=e[15]+n[15],t},g.subtract=function(e,n,t){return t[0]=e[0]-n[0],t[1]=e[1]-n[1],t[2]=e[2]-n[2],t[3]=e[3]-n[3],t[4]=e[4]-n[4],t[5]=e[5]-n[5],t[6]=e[6]-n[6],t[7]=e[7]-n[7],t[8]=e[8]-n[8],t[9]=e[9]-n[9],t[10]=e[10]-n[10],t[11]=e[11]-n[11],t[12]=e[12]-n[12],t[13]=e[13]-n[13],t[14]=e[14]-n[14],t[15]=e[15]-n[15],t},g.multiplyTransformation=function(e,n,t){var a=e[0],r=e[1],i=e[2],u=e[4],s=e[5],o=e[6],c=e[8],l=e[9],d=e[10],f=e[12],C=e[13],h=e[14],m=n[0],y=n[1],p=n[2],v=n[4],x=n[5],w=n[6],g=n[8],z=n[9],M=n[10],b=n[12],O=n[13],R=n[14],S=a*m+u*y+c*p,E=r*m+s*y+l*p,V=i*m+o*y+d*p,q=a*v+u*x+c*w,N=r*v+s*x+l*w,I=i*v+o*x+d*w,T=a*g+u*z+c*M,L=r*g+s*z+l*M,U=i*g+o*z+d*M,P=a*b+u*O+c*R+f,W=r*b+s*O+l*R+C,B=i*b+o*O+d*R+h;return t[0]=S,t[1]=E,t[2]=V,t[3]=0,t[4]=q,t[5]=N,t[6]=I,t[7]=0,t[8]=T,t[9]=L,t[10]=U,t[11]=0,t[12]=P,t[13]=W,t[14]=B,t[15]=1,t},g.multiplyByMatrix3=function(e,n,t){var a=e[0],r=e[1],i=e[2],u=e[4],s=e[5],o=e[6],c=e[8],l=e[9],d=e[10],f=n[0],C=n[1],h=n[2],m=n[3],y=n[4],p=n[5],v=n[6],x=n[7],w=n[8],g=a*f+u*C+c*h,z=r*f+s*C+l*h,M=i*f+o*C+d*h,b=a*m+u*y+c*p,O=r*m+s*y+l*p,R=i*m+o*y+d*p,S=a*v+u*x+c*w,E=r*v+s*x+l*w,V=i*v+o*x+d*w;return t[0]=g,t[1]=z,t[2]=M,t[3]=0,t[4]=b,t[5]=O,t[6]=R,t[7]=0,t[8]=S,t[9]=E,t[10]=V,t[11]=0,t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t},g.multiplyByTranslation=function(e,n,t){var a=n.x,r=n.y,i=n.z,u=a*e[0]+r*e[4]+i*e[8]+e[12],s=a*e[1]+r*e[5]+i*e[9]+e[13],o=a*e[2]+r*e[6]+i*e[10]+e[14];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[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=u,t[13]=s,t[14]=o,t[15]=e[15],t};var E=new n.Cartesian3;g.multiplyByUniformScale=function(e,n,t){return E.x=n,E.y=n,E.z=n,g.multiplyByScale(e,E,t)},g.multiplyByScale=function(e,n,t){var a=n.x,r=n.y,i=n.z;return 1===a&&1===r&&1===i?g.clone(e,t):(t[0]=a*e[0],t[1]=a*e[1],t[2]=a*e[2],t[3]=0,t[4]=r*e[4],t[5]=r*e[5],t[6]=r*e[6],t[7]=0,t[8]=i*e[8],t[9]=i*e[9],t[10]=i*e[10],t[11]=0,t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=1,t)},g.multiplyByVector=function(e,n,t){var a=n.x,r=n.y,i=n.z,u=n.w,s=e[0]*a+e[4]*r+e[8]*i+e[12]*u,o=e[1]*a+e[5]*r+e[9]*i+e[13]*u,c=e[2]*a+e[6]*r+e[10]*i+e[14]*u,l=e[3]*a+e[7]*r+e[11]*i+e[15]*u;return t.x=s,t.y=o,t.z=c,t.w=l,t},g.multiplyByPointAsVector=function(e,n,t){var a=n.x,r=n.y,i=n.z,u=e[0]*a+e[4]*r+e[8]*i,s=e[1]*a+e[5]*r+e[9]*i,o=e[2]*a+e[6]*r+e[10]*i;return t.x=u,t.y=s,t.z=o,t},g.multiplyByPoint=function(e,n,t){var a=n.x,r=n.y,i=n.z,u=e[0]*a+e[4]*r+e[8]*i+e[12],s=e[1]*a+e[5]*r+e[9]*i+e[13],o=e[2]*a+e[6]*r+e[10]*i+e[14];return t.x=u,t.y=s,t.z=o,t},g.multiplyByScalar=function(e,n,t){return t[0]=e[0]*n,t[1]=e[1]*n,t[2]=e[2]*n,t[3]=e[3]*n,t[4]=e[4]*n,t[5]=e[5]*n,t[6]=e[6]*n,t[7]=e[7]*n,t[8]=e[8]*n,t[9]=e[9]*n,t[10]=e[10]*n,t[11]=e[11]*n,t[12]=e[12]*n,t[13]=e[13]*n,t[14]=e[14]*n,t[15]=e[15]*n,t},g.multiplyByPlane=function(e,t,a){var r=new g,i=new g;g.inverse(e,r),g.transpose(r,i);var s=new u.Cartesian4(t.normal.x,t.normal.y,t.normal.z,t.distance);g.multiplyByVector(i,s,s),a.normal.x=s.x,a.normal.y=s.y,a.normal.z=s.z;var o=n.Cartesian3.magnitude(a.normal);return n.Cartesian3.normalize(a.normal,a.normal),a.distance=s.w/o,a},g.negate=function(e,n){return n[0]=-e[0],n[1]=-e[1],n[2]=-e[2],n[3]=-e[3],n[4]=-e[4],n[5]=-e[5],n[6]=-e[6],n[7]=-e[7],n[8]=-e[8],n[9]=-e[9],n[10]=-e[10],n[11]=-e[11],n[12]=-e[12],n[13]=-e[13],n[14]=-e[14],n[15]=-e[15],n},g.transpose=function(e,n){var t=e[1],a=e[2],r=e[3],i=e[6],u=e[7],s=e[11];return n[0]=e[0],n[1]=e[4],n[2]=e[8],n[3]=e[12],n[4]=t,n[5]=e[5],n[6]=e[9],n[7]=e[13],n[8]=a,n[9]=i,n[10]=e[10],n[11]=e[14],n[12]=r,n[13]=u,n[14]=s,n[15]=e[15],n},g.abs=function(e,n){return n[0]=Math.abs(e[0]),n[1]=Math.abs(e[1]),n[2]=Math.abs(e[2]),n[3]=Math.abs(e[3]),n[4]=Math.abs(e[4]),n[5]=Math.abs(e[5]),n[6]=Math.abs(e[6]),n[7]=Math.abs(e[7]),n[8]=Math.abs(e[8]),n[9]=Math.abs(e[9]),n[10]=Math.abs(e[10]),n[11]=Math.abs(e[11]),n[12]=Math.abs(e[12]),n[13]=Math.abs(e[13]),n[14]=Math.abs(e[14]),n[15]=Math.abs(e[15]),n},g.equals=function(e,n){return e===n||a.defined(e)&&a.defined(n)&&e[12]===n[12]&&e[13]===n[13]&&e[14]===n[14]&&e[0]===n[0]&&e[1]===n[1]&&e[2]===n[2]&&e[4]===n[4]&&e[5]===n[5]&&e[6]===n[6]&&e[8]===n[8]&&e[9]===n[9]&&e[10]===n[10]&&e[3]===n[3]&&e[7]===n[7]&&e[11]===n[11]&&e[15]===n[15]},g.equalsEpsilon=function(e,n,t){return e===n||a.defined(e)&&a.defined(n)&&Math.abs(e[0]-n[0])<=t&&Math.abs(e[1]-n[1])<=t&&Math.abs(e[2]-n[2])<=t&&Math.abs(e[3]-n[3])<=t&&Math.abs(e[4]-n[4])<=t&&Math.abs(e[5]-n[5])<=t&&Math.abs(e[6]-n[6])<=t&&Math.abs(e[7]-n[7])<=t&&Math.abs(e[8]-n[8])<=t&&Math.abs(e[9]-n[9])<=t&&Math.abs(e[10]-n[10])<=t&&Math.abs(e[11]-n[11])<=t&&Math.abs(e[12]-n[12])<=t&&Math.abs(e[13]-n[13])<=t&&Math.abs(e[14]-n[14])<=t&&Math.abs(e[15]-n[15])<=t},g.getTranslation=function(e,n){return n.x=e[12],n.y=e[13],n.z=e[14],n},g.getMatrix3=function(e,n){return n[0]=e[0],n[1]=e[1],n[2]=e[2],n[3]=e[4],n[4]=e[5],n[5]=e[6],n[6]=e[8],n[7]=e[9],n[8]=e[10],n},g.getRotation=function(e,n){return n[0]=e[0],n[1]=e[1],n[2]=e[2],n[3]=e[4],n[4]=e[5],n[5]=e[6],n[6]=e[8],n[7]=e[9],n[8]=e[10],n};var V=new d,q=new d,N=new u.Cartesian4,I=new u.Cartesian4(0,0,0,1);function T(e,t){this.center=n.Cartesian3.clone(a.defaultValue(e,n.Cartesian3.ZERO)),this.radius=a.defaultValue(t,0)}g.inverse=function(e,n){var t=e[0],a=e[4],r=e[8],o=e[12],c=e[1],l=e[5],f=e[9],C=e[13],h=e[2],m=e[6],y=e[10],p=e[14],v=e[3],x=e[7],w=e[11],z=e[15],M=y*z,b=p*w,O=m*z,R=p*x,S=m*w,E=y*x,T=h*z,L=p*v,U=h*w,P=y*v,W=h*x,B=m*v,j=M*l+R*f+S*C-(b*l+O*f+E*C),A=b*c+T*f+P*C-(M*c+L*f+U*C),D=O*c+L*l+W*C-(R*c+T*l+B*C),Z=E*c+U*l+B*f-(S*c+P*l+W*f),k=b*a+O*r+E*o-(M*a+R*r+S*o),_=M*t+L*r+U*o-(b*t+T*r+P*o),Y=R*t+T*a+B*o-(O*t+L*a+W*o),G=S*t+P*a+W*r-(E*t+U*a+B*r),H=(M=r*C)*x+(R=o*l)*w+(S=a*f)*z-((b=o*f)*x+(O=a*C)*w+(E=r*l)*z),Q=b*v+(T=t*C)*w+(P=r*c)*z-(M*v+(L=o*c)*w+(U=t*f)*z),X=O*v+L*x+(W=t*l)*z-(R*v+T*x+(B=a*c)*z),F=E*v+U*x+B*w-(S*v+P*x+W*w),J=O*y+E*p+b*m-(S*p+M*m+R*y),K=U*p+M*h+L*y-(T*y+P*p+b*h),$=T*m+B*p+R*h-(W*p+O*h+L*m),ee=W*y+S*h+P*m-(U*m+B*y+E*h),ne=t*j+a*A+r*D+o*Z;if(Math.abs(ne)<i.CesiumMath.EPSILON21){if(d.equalsEpsilon(g.getRotation(e,V),q,i.CesiumMath.EPSILON7)&&u.Cartesian4.equals(g.getRow(e,3,N),I))return n[0]=0,n[1]=0,n[2]=0,n[3]=0,n[4]=0,n[5]=0,n[6]=0,n[7]=0,n[8]=0,n[9]=0,n[10]=0,n[11]=0,n[12]=-e[12],n[13]=-e[13],n[14]=-e[14],n[15]=1,n;throw new s.RuntimeError("matrix is not invertible because its determinate is zero.")}return ne=1/ne,n[0]=j*ne,n[1]=A*ne,n[2]=D*ne,n[3]=Z*ne,n[4]=k*ne,n[5]=_*ne,n[6]=Y*ne,n[7]=G*ne,n[8]=H*ne,n[9]=Q*ne,n[10]=X*ne,n[11]=F*ne,n[12]=J*ne,n[13]=K*ne,n[14]=$*ne,n[15]=ee*ne,n},g.inverseTransformation=function(e,n){var t=e[0],a=e[1],r=e[2],i=e[4],u=e[5],s=e[6],o=e[8],c=e[9],l=e[10],d=e[12],f=e[13],C=e[14],h=-t*d-a*f-r*C,m=-i*d-u*f-s*C,y=-o*d-c*f-l*C;return n[0]=t,n[1]=i,n[2]=o,n[3]=0,n[4]=a,n[5]=u,n[6]=c,n[7]=0,n[8]=r,n[9]=s,n[10]=l,n[11]=0,n[12]=h,n[13]=m,n[14]=y,n[15]=1,n},g.IDENTITY=Object.freeze(new g(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1)),g.ZERO=Object.freeze(new g(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)),g.COLUMN0ROW0=0,g.COLUMN0ROW1=1,g.COLUMN0ROW2=2,g.COLUMN0ROW3=3,g.COLUMN1ROW0=4,g.COLUMN1ROW1=5,g.COLUMN1ROW2=6,g.COLUMN1ROW3=7,g.COLUMN2ROW0=8,g.COLUMN2ROW1=9,g.COLUMN2ROW2=10,g.COLUMN2ROW3=11,g.COLUMN3ROW0=12,g.COLUMN3ROW1=13,g.COLUMN3ROW2=14,g.COLUMN3ROW3=15,Object.defineProperties(g.prototype,{length:{get:function(){return g.packedLength}}}),g.prototype.clone=function(e){return g.clone(this,e)},g.prototype.equals=function(e){return g.equals(this,e)},g.equalsArray=function(e,n,t){return e[0]===n[t]&&e[1]===n[t+1]&&e[2]===n[t+2]&&e[3]===n[t+3]&&e[4]===n[t+4]&&e[5]===n[t+5]&&e[6]===n[t+6]&&e[7]===n[t+7]&&e[8]===n[t+8]&&e[9]===n[t+9]&&e[10]===n[t+10]&&e[11]===n[t+11]&&e[12]===n[t+12]&&e[13]===n[t+13]&&e[14]===n[t+14]&&e[15]===n[t+15]},g.prototype.equalsEpsilon=function(e,n){return g.equalsEpsilon(this,e,n)},g.prototype.toString=function(){return"("+this[0]+", "+this[4]+", "+this[8]+", "+this[12]+")\n("+this[1]+", "+this[5]+", "+this[9]+", "+this[13]+")\n("+this[2]+", "+this[6]+", "+this[10]+", "+this[14]+")\n("+this[3]+", "+this[7]+", "+this[11]+", "+this[15]+")"};var L=new n.Cartesian3,U=new n.Cartesian3,P=new n.Cartesian3,W=new n.Cartesian3,B=new n.Cartesian3,j=new n.Cartesian3,A=new n.Cartesian3,D=new n.Cartesian3,Z=new n.Cartesian3,k=new n.Cartesian3,_=new n.Cartesian3,Y=new n.Cartesian3,G=4/3*i.CesiumMath.PI;T.fromPoints=function(e,t){if(a.defined(t)||(t=new T),!a.defined(e)||0===e.length)return t.center=n.Cartesian3.clone(n.Cartesian3.ZERO,t.center),t.radius=0,t;var r,i=n.Cartesian3.clone(e[0],A),u=n.Cartesian3.clone(i,L),s=n.Cartesian3.clone(i,U),o=n.Cartesian3.clone(i,P),c=n.Cartesian3.clone(i,W),l=n.Cartesian3.clone(i,B),d=n.Cartesian3.clone(i,j),f=e.length;for(r=1;r<f;r++){n.Cartesian3.clone(e[r],i);var C=i.x,h=i.y,m=i.z;C<u.x&&n.Cartesian3.clone(i,u),C>c.x&&n.Cartesian3.clone(i,c),h<s.y&&n.Cartesian3.clone(i,s),h>l.y&&n.Cartesian3.clone(i,l),m<o.z&&n.Cartesian3.clone(i,o),m>d.z&&n.Cartesian3.clone(i,d)}var y=n.Cartesian3.magnitudeSquared(n.Cartesian3.subtract(c,u,D)),p=n.Cartesian3.magnitudeSquared(n.Cartesian3.subtract(l,s,D)),v=n.Cartesian3.magnitudeSquared(n.Cartesian3.subtract(d,o,D)),x=u,w=c,g=y;p>g&&(g=p,x=s,w=l),v>g&&(g=v,x=o,w=d);var z=Z;z.x=.5*(x.x+w.x),z.y=.5*(x.y+w.y),z.z=.5*(x.z+w.z);var M=n.Cartesian3.magnitudeSquared(n.Cartesian3.subtract(w,z,D)),b=Math.sqrt(M),O=k;O.x=u.x,O.y=s.y,O.z=o.z;var R=_;R.x=c.x,R.y=l.y,R.z=d.z;var S=n.Cartesian3.midpoint(O,R,Y),E=0;for(r=0;r<f;r++){n.Cartesian3.clone(e[r],i);var V=n.Cartesian3.magnitude(n.Cartesian3.subtract(i,S,D));V>E&&(E=V);var q=n.Cartesian3.magnitudeSquared(n.Cartesian3.subtract(i,z,D));if(q>M){var N=Math.sqrt(q);M=(b=.5*(b+N))*b;var I=N-b;z.x=(b*z.x+I*i.x)/N,z.y=(b*z.y+I*i.y)/N,z.z=(b*z.z+I*i.z)/N}}return b<E?(n.Cartesian3.clone(z,t.center),t.radius=b):(n.Cartesian3.clone(S,t.center),t.radius=E),t};var H=new o,Q=new n.Cartesian3,X=new n.Cartesian3,F=new n.Cartographic,J=new n.Cartographic;T.fromRectangle2D=function(e,n,t){return T.fromRectangleWithHeights2D(e,n,0,0,t)},T.fromRectangleWithHeights2D=function(e,t,i,u,s){if(a.defined(s)||(s=new T),!a.defined(e))return s.center=n.Cartesian3.clone(n.Cartesian3.ZERO,s.center),s.radius=0,s;t=a.defaultValue(t,H),r.Rectangle.southwest(e,F),F.height=i,r.Rectangle.northeast(e,J),J.height=u;var o=t.project(F,Q),c=t.project(J,X),l=c.x-o.x,d=c.y-o.y,f=c.z-o.z;s.radius=.5*Math.sqrt(l*l+d*d+f*f);var C=s.center;return C.x=o.x+.5*l,C.y=o.y+.5*d,C.z=o.z+.5*f,s};var K=[];T.fromRectangle3D=function(e,t,i,u){if(t=a.defaultValue(t,r.Ellipsoid.WGS84),i=a.defaultValue(i,0),a.defined(u)||(u=new T),!a.defined(e))return u.center=n.Cartesian3.clone(n.Cartesian3.ZERO,u.center),u.radius=0,u;var s=r.Rectangle.subsample(e,t,i,K);return T.fromPoints(s,u)},T.fromVertices=function(e,t,r,i){if(a.defined(i)||(i=new T),!a.defined(e)||0===e.length)return i.center=n.Cartesian3.clone(n.Cartesian3.ZERO,i.center),i.radius=0,i;t=a.defaultValue(t,n.Cartesian3.ZERO),r=a.defaultValue(r,3);var u=A;u.x=e[0]+t.x,u.y=e[1]+t.y,u.z=e[2]+t.z;var s,o=n.Cartesian3.clone(u,L),c=n.Cartesian3.clone(u,U),l=n.Cartesian3.clone(u,P),d=n.Cartesian3.clone(u,W),f=n.Cartesian3.clone(u,B),C=n.Cartesian3.clone(u,j),h=e.length;for(s=0;s<h;s+=r){var m=e[s]+t.x,y=e[s+1]+t.y,p=e[s+2]+t.z;u.x=m,u.y=y,u.z=p,m<o.x&&n.Cartesian3.clone(u,o),m>d.x&&n.Cartesian3.clone(u,d),y<c.y&&n.Cartesian3.clone(u,c),y>f.y&&n.Cartesian3.clone(u,f),p<l.z&&n.Cartesian3.clone(u,l),p>C.z&&n.Cartesian3.clone(u,C)}var v=n.Cartesian3.magnitudeSquared(n.Cartesian3.subtract(d,o,D)),x=n.Cartesian3.magnitudeSquared(n.Cartesian3.subtract(f,c,D)),w=n.Cartesian3.magnitudeSquared(n.Cartesian3.subtract(C,l,D)),g=o,z=d,M=v;x>M&&(M=x,g=c,z=f),w>M&&(M=w,g=l,z=C);var b=Z;b.x=.5*(g.x+z.x),b.y=.5*(g.y+z.y),b.z=.5*(g.z+z.z);var O=n.Cartesian3.magnitudeSquared(n.Cartesian3.subtract(z,b,D)),R=Math.sqrt(O),S=k;S.x=o.x,S.y=c.y,S.z=l.z;var E=_;E.x=d.x,E.y=f.y,E.z=C.z;var V=n.Cartesian3.midpoint(S,E,Y),q=0;for(s=0;s<h;s+=r){u.x=e[s]+t.x,u.y=e[s+1]+t.y,u.z=e[s+2]+t.z;var N=n.Cartesian3.magnitude(n.Cartesian3.subtract(u,V,D));N>q&&(q=N);var I=n.Cartesian3.magnitudeSquared(n.Cartesian3.subtract(u,b,D));if(I>O){var G=Math.sqrt(I);O=(R=.5*(R+G))*R;var H=G-R;b.x=(R*b.x+H*u.x)/G,b.y=(R*b.y+H*u.y)/G,b.z=(R*b.z+H*u.z)/G}}return R<q?(n.Cartesian3.clone(b,i.center),i.radius=R):(n.Cartesian3.clone(V,i.center),i.radius=q),i},T.fromEncodedCartesianVertices=function(e,t,r){if(a.defined(r)||(r=new T),!a.defined(e)||!a.defined(t)||e.length!==t.length||0===e.length)return r.center=n.Cartesian3.clone(n.Cartesian3.ZERO,r.center),r.radius=0,r;var i=A;i.x=e[0]+t[0],i.y=e[1]+t[1],i.z=e[2]+t[2];var u,s=n.Cartesian3.clone(i,L),o=n.Cartesian3.clone(i,U),c=n.Cartesian3.clone(i,P),l=n.Cartesian3.clone(i,W),d=n.Cartesian3.clone(i,B),f=n.Cartesian3.clone(i,j),C=e.length;for(u=0;u<C;u+=3){var h=e[u]+t[u],m=e[u+1]+t[u+1],y=e[u+2]+t[u+2];i.x=h,i.y=m,i.z=y,h<s.x&&n.Cartesian3.clone(i,s),h>l.x&&n.Cartesian3.clone(i,l),m<o.y&&n.Cartesian3.clone(i,o),m>d.y&&n.Cartesian3.clone(i,d),y<c.z&&n.Cartesian3.clone(i,c),y>f.z&&n.Cartesian3.clone(i,f)}var p=n.Cartesian3.magnitudeSquared(n.Cartesian3.subtract(l,s,D)),v=n.Cartesian3.magnitudeSquared(n.Cartesian3.subtract(d,o,D)),x=n.Cartesian3.magnitudeSquared(n.Cartesian3.subtract(f,c,D)),w=s,g=l,z=p;v>z&&(z=v,w=o,g=d),x>z&&(z=x,w=c,g=f);var M=Z;M.x=.5*(w.x+g.x),M.y=.5*(w.y+g.y),M.z=.5*(w.z+g.z);var b=n.Cartesian3.magnitudeSquared(n.Cartesian3.subtract(g,M,D)),O=Math.sqrt(b),R=k;R.x=s.x,R.y=o.y,R.z=c.z;var S=_;S.x=l.x,S.y=d.y,S.z=f.z;var E=n.Cartesian3.midpoint(R,S,Y),V=0;for(u=0;u<C;u+=3){i.x=e[u]+t[u],i.y=e[u+1]+t[u+1],i.z=e[u+2]+t[u+2];var q=n.Cartesian3.magnitude(n.Cartesian3.subtract(i,E,D));q>V&&(V=q);var N=n.Cartesian3.magnitudeSquared(n.Cartesian3.subtract(i,M,D));if(N>b){var I=Math.sqrt(N);b=(O=.5*(O+I))*O;var G=I-O;M.x=(O*M.x+G*i.x)/I,M.y=(O*M.y+G*i.y)/I,M.z=(O*M.z+G*i.z)/I}}return O<V?(n.Cartesian3.clone(M,r.center),r.radius=O):(n.Cartesian3.clone(E,r.center),r.radius=V),r},T.fromCornerPoints=function(e,t,r){a.defined(r)||(r=new T);var i=n.Cartesian3.midpoint(e,t,r.center);return r.radius=n.Cartesian3.distance(i,t),r},T.fromEllipsoid=function(e,t){return a.defined(t)||(t=new T),n.Cartesian3.clone(n.Cartesian3.ZERO,t.center),t.radius=e.maximumRadius,t};var $=new n.Cartesian3;T.fromBoundingSpheres=function(e,t){if(a.defined(t)||(t=new T),!a.defined(e)||0===e.length)return t.center=n.Cartesian3.clone(n.Cartesian3.ZERO,t.center),t.radius=0,t;var r=e.length;if(1===r)return T.clone(e[0],t);if(2===r)return T.union(e[0],e[1],t);var i,u=[];for(i=0;i<r;i++)u.push(e[i].center);var s=(t=T.fromPoints(u,t)).center,o=t.radius;for(i=0;i<r;i++){var c=e[i];o=Math.max(o,n.Cartesian3.distance(s,c.center,$)+c.radius)}return t.radius=o,t};var ee=new n.Cartesian3,ne=new n.Cartesian3,te=new n.Cartesian3;T.fromOrientedBoundingBox=function(e,t){a.defined(t)||(t=new T);var r=e.halfAxes,i=d.getColumn(r,0,ee),u=d.getColumn(r,1,ne),s=d.getColumn(r,2,te);return n.Cartesian3.add(i,u,i),n.Cartesian3.add(i,s,i),t.center=n.Cartesian3.clone(e.center,t.center),t.radius=n.Cartesian3.magnitude(i),t},T.clone=function(e,t){if(a.defined(e))return a.defined(t)?(t.center=n.Cartesian3.clone(e.center,t.center),t.radius=e.radius,t):new T(e.center,e.radius)},T.packedLength=4,T.pack=function(e,n,t){t=a.defaultValue(t,0);var r=e.center;return n[t++]=r.x,n[t++]=r.y,n[t++]=r.z,n[t]=e.radius,n},T.unpack=function(e,n,t){n=a.defaultValue(n,0),a.defined(t)||(t=new T);var r=t.center;return r.x=e[n++],r.y=e[n++],r.z=e[n++],t.radius=e[n],t};var ae=new n.Cartesian3,re=new n.Cartesian3;T.union=function(e,t,r){a.defined(r)||(r=new T);var i=e.center,u=e.radius,s=t.center,o=t.radius,c=n.Cartesian3.subtract(s,i,ae),l=n.Cartesian3.magnitude(c);if(u>=l+o)return e.clone(r),r;if(o>=l+u)return t.clone(r),r;var d=.5*(u+l+o),f=n.Cartesian3.multiplyByScalar(c,(-u+d)/l,re);return n.Cartesian3.add(f,i,f),n.Cartesian3.clone(f,r.center),r.radius=d,r};var ie=new n.Cartesian3;T.expand=function(e,t,a){a=T.clone(e,a);var r=n.Cartesian3.magnitude(n.Cartesian3.subtract(t,a.center,ie));return r>a.radius&&(a.radius=r),a},T.intersectPlane=function(e,t){var a=e.center,r=e.radius,i=t.normal,u=n.Cartesian3.dot(i,a)+t.distance;return u<-r?c.OUTSIDE:u<r?c.INTERSECTING:c.INSIDE},T.transform=function(e,n,t){return a.defined(t)||(t=new T),t.center=g.multiplyByPoint(n,e.center,t.center),t.radius=g.getMaximumScale(n)*e.radius,t};var ue=new n.Cartesian3;T.distanceSquaredTo=function(e,t){var a=n.Cartesian3.subtract(e.center,t,ue);return n.Cartesian3.magnitudeSquared(a)-e.radius*e.radius},T.transformWithoutScale=function(e,n,t){return a.defined(t)||(t=new T),t.center=g.multiplyByPoint(n,e.center,t.center),t.radius=e.radius,t};var se=new n.Cartesian3;T.computePlaneDistances=function(e,t,r,i){a.defined(i)||(i=new l);var u=n.Cartesian3.subtract(e.center,t,se),s=n.Cartesian3.dot(r,u);return i.start=s-e.radius,i.stop=s+e.radius,i};for(var oe=new n.Cartesian3,ce=new n.Cartesian3,le=new n.Cartesian3,de=new n.Cartesian3,fe=new n.Cartesian3,Ce=new n.Cartographic,he=new Array(8),me=0;me<8;++me)he[me]=new n.Cartesian3;var ye=new o;T.projectTo2D=function(e,t,r){var i,u=(t=a.defaultValue(t,ye)).ellipsoid,s=e.center,o=e.radius;i=n.Cartesian3.equals(s,n.Cartesian3.ZERO)?n.Cartesian3.clone(n.Cartesian3.UNIT_X,oe):u.geodeticSurfaceNormal(s,oe);var c=n.Cartesian3.cross(n.Cartesian3.UNIT_Z,i,ce);n.Cartesian3.normalize(c,c);var l=n.Cartesian3.cross(i,c,le);n.Cartesian3.normalize(l,l),n.Cartesian3.multiplyByScalar(i,o,i),n.Cartesian3.multiplyByScalar(l,o,l),n.Cartesian3.multiplyByScalar(c,o,c);var d=n.Cartesian3.negate(l,fe),f=n.Cartesian3.negate(c,de),C=he,h=C[0];n.Cartesian3.add(i,l,h),n.Cartesian3.add(h,c,h),h=C[1],n.Cartesian3.add(i,l,h),n.Cartesian3.add(h,f,h),h=C[2],n.Cartesian3.add(i,d,h),n.Cartesian3.add(h,f,h),h=C[3],n.Cartesian3.add(i,d,h),n.Cartesian3.add(h,c,h),n.Cartesian3.negate(i,i),h=C[4],n.Cartesian3.add(i,l,h),n.Cartesian3.add(h,c,h),h=C[5],n.Cartesian3.add(i,l,h),n.Cartesian3.add(h,f,h),h=C[6],n.Cartesian3.add(i,d,h),n.Cartesian3.add(h,f,h),h=C[7],n.Cartesian3.add(i,d,h),n.Cartesian3.add(h,c,h);for(var m=C.length,y=0;y<m;++y){var p=C[y];n.Cartesian3.add(s,p,p);var v=u.cartesianToCartographic(p,Ce);t.project(v,p)}var x=(s=(r=T.fromPoints(C,r)).center).x,w=s.y,g=s.z;return s.x=g,s.y=x,s.z=w,r},T.isOccluded=function(e,n){return!n.isBoundingSphereVisible(e)},T.equals=function(e,t){return e===t||a.defined(e)&&a.defined(t)&&n.Cartesian3.equals(e.center,t.center)&&e.radius===t.radius},T.prototype.intersectPlane=function(e){return T.intersectPlane(this,e)},T.prototype.distanceSquaredTo=function(e){return T.distanceSquaredTo(this,e)},T.prototype.computePlaneDistances=function(e,n,t){return T.computePlaneDistances(this,e,n,t)},T.prototype.isOccluded=function(e){return T.isOccluded(this,e)},T.prototype.equals=function(e){return T.equals(this,e)},T.prototype.clone=function(e){return T.clone(this,e)},T.prototype.volume=function(){var e=this.radius;return G*e*e*e},e.BoundingSphere=T,e.GeographicProjection=o,e.Intersect=c,e.Interval=l,e.Matrix3=d,e.Matrix4=g}));