define(["exports","./BoundingSphere-561b54d0","./Cartesian2-47311507","./Cartographic-3309dd0d","./Check-7b2a090c","./when-b60132fc","./EllipsoidTangentPlane-b2b18d75","./Math-119be1a3","./Plane-097b3a8f"],(function(a,t,e,n,r,i,s,o,C){"use strict";function c(a,e){this.center=n.Cartesian3.clone(i.defaultValue(a,n.Cartesian3.ZERO)),this.halfAxes=t.Matrix3.clone(i.defaultValue(e,t.Matrix3.ZERO))}c.packedLength=n.Cartesian3.packedLength+t.Matrix3.packedLength,c.pack=function(a,e,r){return r=i.defaultValue(r,0),n.Cartesian3.pack(a.center,e,r),t.Matrix3.pack(a.halfAxes,e,r+n.Cartesian3.packedLength),e},c.unpack=function(a,e,r){return e=i.defaultValue(e,0),i.defined(r)||(r=new c),n.Cartesian3.unpack(a,e,r.center),t.Matrix3.unpack(a,e+n.Cartesian3.packedLength,r.halfAxes),r};var u=new n.Cartesian3,d=new n.Cartesian3,l=new n.Cartesian3,h=new n.Cartesian3,x=new n.Cartesian3,M=new n.Cartesian3,m=new t.Matrix3,f={unitary:new t.Matrix3,diagonal:new t.Matrix3};c.fromPoints=function(a,e){if(i.defined(e)||(e=new c),!i.defined(a)||0===a.length)return e.halfAxes=t.Matrix3.ZERO,e.center=n.Cartesian3.ZERO,e;var r,s=a.length,o=n.Cartesian3.clone(a[0],u);for(r=1;r0?0:p.latitude,J=n.Cartographic.fromRadians(Y,a.north,r,O),K=n.Cartographic.fromRadians(a.west,a.north,r,P),Q=n.Cartographic.fromRadians(a.west,H,r,N),$=n.Cartographic.fromRadians(a.west,a.south,r,v),aa=n.Cartographic.fromRadians(Y,a.south,r,A),ta=c.cartographicToCartesian(J,T),ea=c.cartographicToCartesian(K,R),na=c.cartographicToCartesian(Q,I),ra=c.cartographicToCartesian($,E),ia=c.cartographicToCartesian(aa,L),sa=F.projectPointToNearestOnPlane(ta,z),oa=F.projectPointToNearestOnPlane(ea,S),Ca=F.projectPointToNearestOnPlane(na,U),ca=F.projectPointToNearestOnPlane(ra,V),ua=F.projectPointToNearestOnPlane(ia,B);return l=-(d=Math.min(oa.x,Ca.x,ca.x)),x=Math.max(oa.y,sa.y),h=Math.min(ca.y,ua.y),K.height=$.height=t,ea=c.cartographicToCartesian(K,R),ra=c.cartographicToCartesian($,E),M=Math.min(C.Plane.getPointDistance(f,ea),C.Plane.getPointDistance(f,ra)),m=r,w(F.origin,F.xAxis,F.yAxis,F.zAxis,d,l,h,x,M,m,u)}var da=a.south>0,la=a.north<0,ha=da?a.south:la?a.north:0,xa=e.Rectangle.center(a,b).longitude,Ma=n.Cartesian3.fromRadians(xa,ha,r,c,_);Ma.z=0;var ma=Math.abs(Ma.x)=u?t.Intersect.INSIDE:t.Intersect.INTERSECTING};var F=new n.Cartesian3,Y=new n.Cartesian3,H=new n.Cartesian3,J=new n.Cartesian3;c.distanceSquaredTo=function(a,e){var r=n.Cartesian3.subtract(e,a.center,p),i=a.halfAxes,s=t.Matrix3.getColumn(i,0,F),o=t.Matrix3.getColumn(i,1,Y),C=t.Matrix3.getColumn(i,2,H),c=n.Cartesian3.magnitude(s),u=n.Cartesian3.magnitude(o),d=n.Cartesian3.magnitude(C);n.Cartesian3.normalize(s,s),n.Cartesian3.normalize(o,o),n.Cartesian3.normalize(C,C);var l=J;l.x=n.Cartesian3.dot(r,s),l.y=n.Cartesian3.dot(r,o),l.z=n.Cartesian3.dot(r,C);var h,x=0;return l.x<-c?x+=(h=l.x+c)*h:l.x>c&&(x+=(h=l.x-c)*h),l.y<-u?x+=(h=l.y+u)*h:l.y>u&&(x+=(h=l.y-u)*h),l.z<-d?x+=(h=l.z+d)*h:l.z>d&&(x+=(h=l.z-d)*h),x};var K=new n.Cartesian3,Q=new n.Cartesian3;c.computePlaneDistances=function(a,e,r,s){i.defined(s)||(s=new t.Interval);var o=Number.POSITIVE_INFINITY,C=Number.NEGATIVE_INFINITY,c=a.center,u=a.halfAxes,d=t.Matrix3.getColumn(u,0,F),l=t.Matrix3.getColumn(u,1,Y),h=t.Matrix3.getColumn(u,2,H),x=n.Cartesian3.add(d,l,K);n.Cartesian3.add(x,h,x),n.Cartesian3.add(x,c,x);var M=n.Cartesian3.subtract(x,e,Q),m=n.Cartesian3.dot(r,M);return o=Math.min(m,o),C=Math.max(m,C),n.Cartesian3.add(c,d,x),n.Cartesian3.add(x,l,x),n.Cartesian3.subtract(x,h,x),n.Cartesian3.subtract(x,e,M),m=n.Cartesian3.dot(r,M),o=Math.min(m,o),C=Math.max(m,C),n.Cartesian3.add(c,d,x),n.Cartesian3.subtract(x,l,x),n.Cartesian3.add(x,h,x),n.Cartesian3.subtract(x,e,M),m=n.Cartesian3.dot(r,M),o=Math.min(m,o),C=Math.max(m,C),n.Cartesian3.add(c,d,x),n.Cartesian3.subtract(x,l,x),n.Cartesian3.subtract(x,h,x),n.Cartesian3.subtract(x,e,M),m=n.Cartesian3.dot(r,M),o=Math.min(m,o),C=Math.max(m,C),n.Cartesian3.subtract(c,d,x),n.Cartesian3.add(x,l,x),n.Cartesian3.add(x,h,x),n.Cartesian3.subtract(x,e,M),m=n.Cartesian3.dot(r,M),o=Math.min(m,o),C=Math.max(m,C),n.Cartesian3.subtract(c,d,x),n.Cartesian3.add(x,l,x),n.Cartesian3.subtract(x,h,x),n.Cartesian3.subtract(x,e,M),m=n.Cartesian3.dot(r,M),o=Math.min(m,o),C=Math.max(m,C),n.Cartesian3.subtract(c,d,x),n.Cartesian3.subtract(x,l,x),n.Cartesian3.add(x,h,x),n.Cartesian3.subtract(x,e,M),m=n.Cartesian3.dot(r,M),o=Math.min(m,o),C=Math.max(m,C),n.Cartesian3.subtract(c,d,x),n.Cartesian3.subtract(x,l,x),n.Cartesian3.subtract(x,h,x),n.Cartesian3.subtract(x,e,M),m=n.Cartesian3.dot(r,M),o=Math.min(m,o),C=Math.max(m,C),s.start=o,s.stop=C,s};var $=new t.BoundingSphere;c.isOccluded=function(a,e){var n=t.BoundingSphere.fromOrientedBoundingBox(a,$);return!e.isBoundingSphereVisible(n)},c.prototype.intersectPlane=function(a){return c.intersectPlane(this,a)},c.prototype.distanceSquaredTo=function(a){return c.distanceSquaredTo(this,a)},c.prototype.computePlaneDistances=function(a,t,e){return c.computePlaneDistances(this,a,t,e)},c.prototype.isOccluded=function(a){return c.isOccluded(this,a)},c.equals=function(a,e){return a===e||i.defined(a)&&i.defined(e)&&n.Cartesian3.equals(a.center,e.center)&&t.Matrix3.equals(a.halfAxes,e.halfAxes)},c.prototype.clone=function(a){return c.clone(this,a)},c.prototype.equals=function(a){return c.equals(this,a)},a.OrientedBoundingBox=c}));