define(["exports","./when-cbf8cd21","./Check-35e1a91d","./Math-6a1814d8","./Cartesian2-c451a606","./Transforms-e4be2a30","./Plane-929e0674","./EllipsoidTangentPlane-af8ae194"],function(a,q,t,X,j,A,Z,G){"use strict";function T(a,t){this.center=j.Cartesian3.clone(q.defaultValue(a,j.Cartesian3.ZERO)),this.halfAxes=A.Matrix3.clone(q.defaultValue(t,A.Matrix3.ZERO))}T.packedLength=j.Cartesian3.packedLength+A.Matrix3.packedLength,T.pack=function(a,t,e){return e=q.defaultValue(e,0),j.Cartesian3.pack(a.center,t,e),A.Matrix3.pack(a.halfAxes,t,e+j.Cartesian3.packedLength),t},T.unpack=function(a,t,e){return t=q.defaultValue(t,0),q.defined(e)||(e=new T),j.Cartesian3.unpack(a,t,e.center),A.Matrix3.unpack(a,t+j.Cartesian3.packedLength,e.halfAxes),e};var R=new j.Cartesian3,I=new j.Cartesian3,E=new j.Cartesian3,L=new j.Cartesian3,z=new j.Cartesian3,S=new j.Cartesian3,U=new A.Matrix3,V={unitary:new A.Matrix3,diagonal:new A.Matrix3};T.fromPoints=function(a,t){if(q.defined(t)||(t=new T),!q.defined(a)||0===a.length)return t.halfAxes=A.Matrix3.ZERO,t.center=j.Cartesian3.ZERO,t;var e,n=a.length,r=j.Cartesian3.clone(a[0],R);for(e=1;eo&&(d+=(l=u.x-o)*l),u.y<-C?d+=(l=u.y+C)*l:u.y>C&&(d+=(l=u.y-C)*l),u.z<-c?d+=(l=u.z+c)*l:u.z>c&&(d+=(l=u.z-c)*l),d};var g=new j.Cartesian3,w=new j.Cartesian3;T.computePlaneDistances=function(a,t,e,n){q.defined(n)||(n=new A.Interval);var r=Number.POSITIVE_INFINITY,i=Number.NEGATIVE_INFINITY,s=a.center,o=a.halfAxes,C=A.Matrix3.getColumn(o,0,x),c=A.Matrix3.getColumn(o,1,f),u=A.Matrix3.getColumn(o,2,p),l=j.Cartesian3.add(C,c,g);j.Cartesian3.add(l,u,l),j.Cartesian3.add(l,s,l);var d=j.Cartesian3.subtract(l,t,w),h=j.Cartesian3.dot(e,d);return r=Math.min(h,r),i=Math.max(h,i),j.Cartesian3.add(s,C,l),j.Cartesian3.add(l,c,l),j.Cartesian3.subtract(l,u,l),j.Cartesian3.subtract(l,t,d),h=j.Cartesian3.dot(e,d),r=Math.min(h,r),i=Math.max(h,i),j.Cartesian3.add(s,C,l),j.Cartesian3.subtract(l,c,l),j.Cartesian3.add(l,u,l),j.Cartesian3.subtract(l,t,d),h=j.Cartesian3.dot(e,d),r=Math.min(h,r),i=Math.max(h,i),j.Cartesian3.add(s,C,l),j.Cartesian3.subtract(l,c,l),j.Cartesian3.subtract(l,u,l),j.Cartesian3.subtract(l,t,d),h=j.Cartesian3.dot(e,d),r=Math.min(h,r),i=Math.max(h,i),j.Cartesian3.subtract(s,C,l),j.Cartesian3.add(l,c,l),j.Cartesian3.add(l,u,l),j.Cartesian3.subtract(l,t,d),h=j.Cartesian3.dot(e,d),r=Math.min(h,r),i=Math.max(h,i),j.Cartesian3.subtract(s,C,l),j.Cartesian3.add(l,c,l),j.Cartesian3.subtract(l,u,l),j.Cartesian3.subtract(l,t,d),h=j.Cartesian3.dot(e,d),r=Math.min(h,r),i=Math.max(h,i),j.Cartesian3.subtract(s,C,l),j.Cartesian3.subtract(l,c,l),j.Cartesian3.add(l,u,l),j.Cartesian3.subtract(l,t,d),h=j.Cartesian3.dot(e,d),r=Math.min(h,r),i=Math.max(h,i),j.Cartesian3.subtract(s,C,l),j.Cartesian3.subtract(l,c,l),j.Cartesian3.subtract(l,u,l),j.Cartesian3.subtract(l,t,d),h=j.Cartesian3.dot(e,d),r=Math.min(h,r),i=Math.max(h,i),n.start=r,n.stop=i,n};var n=new A.BoundingSphere;T.isOccluded=function(a,t){var e=A.BoundingSphere.fromOrientedBoundingBox(a,n);return!t.isBoundingSphereVisible(e)},T.prototype.intersectPlane=function(a){return T.intersectPlane(this,a)},T.prototype.distanceSquaredTo=function(a){return T.distanceSquaredTo(this,a)},T.prototype.computePlaneDistances=function(a,t,e){return T.computePlaneDistances(this,a,t,e)},T.prototype.isOccluded=function(a){return T.isOccluded(this,a)},T.equals=function(a,t){return a===t||q.defined(a)&&q.defined(t)&&j.Cartesian3.equals(a.center,t.center)&&A.Matrix3.equals(a.halfAxes,t.halfAxes)},T.prototype.clone=function(a){return T.clone(this,a)},T.prototype.equals=function(a){return T.equals(this,a)},a.OrientedBoundingBox=T});