define(["exports","./Transforms-b51fdb37","./Rectangle-82621db8","./Check-24483042","./when-54335d57","./EllipsoidTangentPlane-3e9e5847","./Math-7a8129d6","./Plane-fd9e13db"],function(a,A,q,t,X,j,Z,G){"use strict";function T(a,t){this.center=q.Cartesian3.clone(X.defaultValue(a,q.Cartesian3.ZERO)),this.halfAxes=A.Matrix3.clone(X.defaultValue(t,A.Matrix3.ZERO))}T.packedLength=q.Cartesian3.packedLength+A.Matrix3.packedLength,T.pack=function(a,t,e){return e=X.defaultValue(e,0),q.Cartesian3.pack(a.center,t,e),A.Matrix3.pack(a.halfAxes,t,e+q.Cartesian3.packedLength),t},T.unpack=function(a,t,e){return t=X.defaultValue(t,0),X.defined(e)||(e=new T),q.Cartesian3.unpack(a,t,e.center),A.Matrix3.unpack(a,t+q.Cartesian3.packedLength,e.halfAxes),e};var R=new q.Cartesian3,I=new q.Cartesian3,E=new q.Cartesian3,L=new q.Cartesian3,z=new q.Cartesian3,S=new q.Cartesian3,U=new A.Matrix3,V={unitary:new A.Matrix3,diagonal:new A.Matrix3};T.fromPoints=function(a,t){if(X.defined(t)||(t=new T),!X.defined(a)||0===a.length)return t.halfAxes=A.Matrix3.ZERO,t.center=q.Cartesian3.ZERO,t;var e,n=a.length,r=q.Cartesian3.clone(a[0],R);for(e=1;eo&&(l+=(d=u.x-o)*d),u.y<-C?l+=(d=u.y+C)*d:u.y>C&&(l+=(d=u.y-C)*d),u.z<-c?l+=(d=u.z+c)*d:u.z>c&&(l+=(d=u.z-c)*d),l};var g=new q.Cartesian3,w=new q.Cartesian3;T.computePlaneDistances=function(a,t,e,n){X.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),d=q.Cartesian3.add(C,c,g);q.Cartesian3.add(d,u,d),q.Cartesian3.add(d,s,d);var l=q.Cartesian3.subtract(d,t,w),h=q.Cartesian3.dot(e,l);return r=Math.min(h,r),i=Math.max(h,i),q.Cartesian3.add(s,C,d),q.Cartesian3.add(d,c,d),q.Cartesian3.subtract(d,u,d),q.Cartesian3.subtract(d,t,l),h=q.Cartesian3.dot(e,l),r=Math.min(h,r),i=Math.max(h,i),q.Cartesian3.add(s,C,d),q.Cartesian3.subtract(d,c,d),q.Cartesian3.add(d,u,d),q.Cartesian3.subtract(d,t,l),h=q.Cartesian3.dot(e,l),r=Math.min(h,r),i=Math.max(h,i),q.Cartesian3.add(s,C,d),q.Cartesian3.subtract(d,c,d),q.Cartesian3.subtract(d,u,d),q.Cartesian3.subtract(d,t,l),h=q.Cartesian3.dot(e,l),r=Math.min(h,r),i=Math.max(h,i),q.Cartesian3.subtract(s,C,d),q.Cartesian3.add(d,c,d),q.Cartesian3.add(d,u,d),q.Cartesian3.subtract(d,t,l),h=q.Cartesian3.dot(e,l),r=Math.min(h,r),i=Math.max(h,i),q.Cartesian3.subtract(s,C,d),q.Cartesian3.add(d,c,d),q.Cartesian3.subtract(d,u,d),q.Cartesian3.subtract(d,t,l),h=q.Cartesian3.dot(e,l),r=Math.min(h,r),i=Math.max(h,i),q.Cartesian3.subtract(s,C,d),q.Cartesian3.subtract(d,c,d),q.Cartesian3.add(d,u,d),q.Cartesian3.subtract(d,t,l),h=q.Cartesian3.dot(e,l),r=Math.min(h,r),i=Math.max(h,i),q.Cartesian3.subtract(s,C,d),q.Cartesian3.subtract(d,c,d),q.Cartesian3.subtract(d,u,d),q.Cartesian3.subtract(d,t,l),h=q.Cartesian3.dot(e,l),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||X.defined(a)&&X.defined(t)&&q.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});