define(["exports","./BoundingSphere-9a3b5656","./Cartesian2-bd414876","./Cartesian3-e0307675","./Check-741c5f3c","./defaultValue-81eec7ed","./EllipsoidTangentPlane-4d138901","./Math-e73894ab","./Matrix4-4c545f70","./Plane-bc8b6777","./Rectangle-cf3e0e3e"],(function(a,t,e,n,r,i,s,o,c,C,u){"use strict";function l(a,t){this.center=n.Cartesian3.clone(i.defaultValue(a,n.Cartesian3.ZERO)),this.halfAxes=c.Matrix3.clone(i.defaultValue(t,c.Matrix3.ZERO))}l.packedLength=n.Cartesian3.packedLength+c.Matrix3.packedLength,l.pack=function(a,t,e){return e=i.defaultValue(e,0),n.Cartesian3.pack(a.center,t,e),c.Matrix3.pack(a.halfAxes,t,e+n.Cartesian3.packedLength),t},l.unpack=function(a,t,e){return t=i.defaultValue(t,0),i.defined(e)||(e=new l),n.Cartesian3.unpack(a,t,e.center),c.Matrix3.unpack(a,t+n.Cartesian3.packedLength,e.halfAxes),e};const d=new n.Cartesian3,h=new n.Cartesian3,x=new n.Cartesian3,m=new n.Cartesian3,M=new n.Cartesian3,f=new n.Cartesian3,p=new c.Matrix3,w={unitary:new c.Matrix3,diagonal:new c.Matrix3};l.fromPoints=function(a,t){if(i.defined(t)||(t=new l),!i.defined(a)||0===a.length)return t.halfAxes=c.Matrix3.ZERO,t.center=n.Cartesian3.ZERO,t;let e;const r=a.length,s=n.Cartesian3.clone(a[0],d);for(e=1;e0?0:n.latitude,b=e.Cartographic.fromRadians(w,a.north,r,T),X=e.Cartographic.fromRadians(a.west,a.north,r,A),q=e.Cartographic.fromRadians(a.west,g,r,P),D=e.Cartographic.fromRadians(a.west,a.south,r,I),j=e.Cartographic.fromRadians(w,a.south,r,R),Z=c.cartographicToCartesian(b,S);let v=c.cartographicToCartesian(X,E);const Y=c.cartographicToCartesian(q,U);let G=c.cartographicToCartesian(D,L);const F=c.cartographicToCartesian(j,B),H=o.projectPointToNearestOnPlane(Z,z),J=o.projectPointToNearestOnPlane(v,V),K=o.projectPointToNearestOnPlane(Y,_),Q=o.projectPointToNearestOnPlane(G,k),$=o.projectPointToNearestOnPlane(F,W);return d=Math.min(J.x,K.x,Q.x),h=-d,m=Math.max(J.y,H.y),x=Math.min(Q.y,$.y),X.height=D.height=t,v=c.cartographicToCartesian(X,E),G=c.cartographicToCartesian(D,L),M=Math.min(C.Plane.getPointDistance(p,v),C.Plane.getPointDistance(p,G)),f=r,y(o.origin,o.xAxis,o.yAxis,o.zAxis,d,h,x,m,M,f,l)}const w=a.south>0,g=a.north<0,b=w?a.south:g?a.north:0,H=u.Rectangle.center(a,N).longitude,J=n.Cartesian3.fromRadians(H,b,r,c,X);J.z=0;const K=Math.abs(J.x)=l?t.Intersect.INSIDE:t.Intersect.INTERSECTING};const H=new n.Cartesian3,J=new n.Cartesian3,K=new n.Cartesian3,Q=new n.Cartesian3,$=new n.Cartesian3,aa=new n.Cartesian3;l.distanceSquaredTo=function(a,t){const e=n.Cartesian3.subtract(t,a.center,g),r=a.halfAxes;let i=c.Matrix3.getColumn(r,0,H),s=c.Matrix3.getColumn(r,1,J),C=c.Matrix3.getColumn(r,2,K);const u=n.Cartesian3.magnitude(i),l=n.Cartesian3.magnitude(s),d=n.Cartesian3.magnitude(C);let h=!0,x=!0,m=!0;u>0?n.Cartesian3.divideByScalar(i,u,i):h=!1,l>0?n.Cartesian3.divideByScalar(s,l,s):x=!1,d>0?n.Cartesian3.divideByScalar(C,d,C):m=!1;const M=!h+!x+!m;let f,p,w;if(1===M){let a=i;f=s,p=C,x?m||(a=C,p=i):(a=s,f=i),w=n.Cartesian3.cross(f,p,$),a===i?i=w:a===s?s=w:a===C&&(C=w)}else if(2===M){f=i,x?f=s:m&&(f=C);let a=n.Cartesian3.UNIT_Y;a.equalsEpsilon(f,o.CesiumMath.EPSILON3)&&(a=n.Cartesian3.UNIT_X),p=n.Cartesian3.cross(f,a,Q),n.Cartesian3.normalize(p,p),w=n.Cartesian3.cross(f,p,$),n.Cartesian3.normalize(w,w),f===i?(s=p,C=w):f===s?(C=p,i=w):f===C&&(i=p,s=w)}else 3===M&&(i=n.Cartesian3.UNIT_X,s=n.Cartesian3.UNIT_Y,C=n.Cartesian3.UNIT_Z);const b=aa;b.x=n.Cartesian3.dot(e,i),b.y=n.Cartesian3.dot(e,s),b.z=n.Cartesian3.dot(e,C);let y,N=0;return b.x<-u?(y=b.x+u,N+=y*y):b.x>u&&(y=b.x-u,N+=y*y),b.y<-l?(y=b.y+l,N+=y*y):b.y>l&&(y=b.y-l,N+=y*y),b.z<-d?(y=b.z+d,N+=y*y):b.z>d&&(y=b.z-d,N+=y*y),N};const ta=new n.Cartesian3,ea=new n.Cartesian3;l.computePlaneDistances=function(a,e,r,s){i.defined(s)||(s=new t.Interval);let o=Number.POSITIVE_INFINITY,C=Number.NEGATIVE_INFINITY;const u=a.center,l=a.halfAxes,d=c.Matrix3.getColumn(l,0,H),h=c.Matrix3.getColumn(l,1,J),x=c.Matrix3.getColumn(l,2,K),m=n.Cartesian3.add(d,h,ta);n.Cartesian3.add(m,x,m),n.Cartesian3.add(m,u,m);const M=n.Cartesian3.subtract(m,e,ea);let f=n.Cartesian3.dot(r,M);return o=Math.min(f,o),C=Math.max(f,C),n.Cartesian3.add(u,d,m),n.Cartesian3.add(m,h,m),n.Cartesian3.subtract(m,x,m),n.Cartesian3.subtract(m,e,M),f=n.Cartesian3.dot(r,M),o=Math.min(f,o),C=Math.max(f,C),n.Cartesian3.add(u,d,m),n.Cartesian3.subtract(m,h,m),n.Cartesian3.add(m,x,m),n.Cartesian3.subtract(m,e,M),f=n.Cartesian3.dot(r,M),o=Math.min(f,o),C=Math.max(f,C),n.Cartesian3.add(u,d,m),n.Cartesian3.subtract(m,h,m),n.Cartesian3.subtract(m,x,m),n.Cartesian3.subtract(m,e,M),f=n.Cartesian3.dot(r,M),o=Math.min(f,o),C=Math.max(f,C),n.Cartesian3.subtract(u,d,m),n.Cartesian3.add(m,h,m),n.Cartesian3.add(m,x,m),n.Cartesian3.subtract(m,e,M),f=n.Cartesian3.dot(r,M),o=Math.min(f,o),C=Math.max(f,C),n.Cartesian3.subtract(u,d,m),n.Cartesian3.add(m,h,m),n.Cartesian3.subtract(m,x,m),n.Cartesian3.subtract(m,e,M),f=n.Cartesian3.dot(r,M),o=Math.min(f,o),C=Math.max(f,C),n.Cartesian3.subtract(u,d,m),n.Cartesian3.subtract(m,h,m),n.Cartesian3.add(m,x,m),n.Cartesian3.subtract(m,e,M),f=n.Cartesian3.dot(r,M),o=Math.min(f,o),C=Math.max(f,C),n.Cartesian3.subtract(u,d,m),n.Cartesian3.subtract(m,h,m),n.Cartesian3.subtract(m,x,m),n.Cartesian3.subtract(m,e,M),f=n.Cartesian3.dot(r,M),o=Math.min(f,o),C=Math.max(f,C),s.start=o,s.stop=C,s};const na=new n.Cartesian3,ra=new n.Cartesian3,ia=new n.Cartesian3;l.computeCorners=function(a,t){i.defined(t)||(t=[new n.Cartesian3,new n.Cartesian3,new n.Cartesian3,new n.Cartesian3,new n.Cartesian3,new n.Cartesian3,new n.Cartesian3,new n.Cartesian3]);const e=a.center,r=a.halfAxes,s=c.Matrix3.getColumn(r,0,na),o=c.Matrix3.getColumn(r,1,ra),C=c.Matrix3.getColumn(r,2,ia);return n.Cartesian3.clone(e,t[0]),n.Cartesian3.subtract(t[0],s,t[0]),n.Cartesian3.subtract(t[0],o,t[0]),n.Cartesian3.subtract(t[0],C,t[0]),n.Cartesian3.clone(e,t[1]),n.Cartesian3.subtract(t[1],s,t[1]),n.Cartesian3.subtract(t[1],o,t[1]),n.Cartesian3.add(t[1],C,t[1]),n.Cartesian3.clone(e,t[2]),n.Cartesian3.subtract(t[2],s,t[2]),n.Cartesian3.add(t[2],o,t[2]),n.Cartesian3.subtract(t[2],C,t[2]),n.Cartesian3.clone(e,t[3]),n.Cartesian3.subtract(t[3],s,t[3]),n.Cartesian3.add(t[3],o,t[3]),n.Cartesian3.add(t[3],C,t[3]),n.Cartesian3.clone(e,t[4]),n.Cartesian3.add(t[4],s,t[4]),n.Cartesian3.subtract(t[4],o,t[4]),n.Cartesian3.subtract(t[4],C,t[4]),n.Cartesian3.clone(e,t[5]),n.Cartesian3.add(t[5],s,t[5]),n.Cartesian3.subtract(t[5],o,t[5]),n.Cartesian3.add(t[5],C,t[5]),n.Cartesian3.clone(e,t[6]),n.Cartesian3.add(t[6],s,t[6]),n.Cartesian3.add(t[6],o,t[6]),n.Cartesian3.subtract(t[6],C,t[6]),n.Cartesian3.clone(e,t[7]),n.Cartesian3.add(t[7],s,t[7]),n.Cartesian3.add(t[7],o,t[7]),n.Cartesian3.add(t[7],C,t[7]),t};const sa=new c.Matrix3;l.computeTransformation=function(a,t){i.defined(t)||(t=new c.Matrix4);const e=a.center,n=c.Matrix3.multiplyByUniformScale(a.halfAxes,2,sa);return c.Matrix4.fromRotationTranslation(n,e,t)};const oa=new t.BoundingSphere;l.isOccluded=function(a,e){const n=t.BoundingSphere.fromOrientedBoundingBox(a,oa);return!e.isBoundingSphereVisible(n)},l.prototype.intersectPlane=function(a){return l.intersectPlane(this,a)},l.prototype.distanceSquaredTo=function(a){return l.distanceSquaredTo(this,a)},l.prototype.computePlaneDistances=function(a,t,e){return l.computePlaneDistances(this,a,t,e)},l.prototype.computeCorners=function(a){return l.computeCorners(this,a)},l.prototype.computeTransformation=function(a){return l.computeTransformation(this,a)},l.prototype.isOccluded=function(a){return l.isOccluded(this,a)},l.equals=function(a,t){return a===t||i.defined(a)&&i.defined(t)&&n.Cartesian3.equals(a.center,t.center)&&c.Matrix3.equals(a.halfAxes,t.halfAxes)},l.prototype.clone=function(a){return l.clone(this,a)},l.prototype.equals=function(a){return l.equals(this,a)},a.OrientedBoundingBox=l}));