define(["exports","./when-54c2dc71","./Check-6c0211bc","./Math-fc8cecf5","./Cartesian2-bddc1162","./Transforms-ec27f304","./Plane-231f1723","./EllipsoidTangentPlane-ed172748"],function(a,q,t,X,j,T,Z,G){"use strict";function v(a,t){this.center=j.Cartesian3.clone(q.defaultValue(a,j.Cartesian3.ZERO)),this.halfAxes=T.Matrix3.clone(q.defaultValue(t,T.Matrix3.ZERO))}v.packedLength=j.Cartesian3.packedLength+T.Matrix3.packedLength,v.pack=function(a,t,e){return e=q.defaultValue(e,0),j.Cartesian3.pack(a.center,t,e),T.Matrix3.pack(a.halfAxes,t,e+j.Cartesian3.packedLength),t},v.unpack=function(a,t,e){return t=q.defaultValue(t,0),q.defined(e)||(e=new v),j.Cartesian3.unpack(a,t,e.center),T.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 T.Matrix3,V={unitary:new T.Matrix3,diagonal:new T.Matrix3};v.fromPoints=function(a,t){if(q.defined(t)||(t=new v),!q.defined(a)||0===a.length)return t.halfAxes=T.Matrix3.ZERO,t.center=j.Cartesian3.ZERO,t;for(var e=a.length,n=j.Cartesian3.clone(a[0],R),r=1;ro&&(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 j.Cartesian3,w=new j.Cartesian3;v.computePlaneDistances=function(a,t,e,n){q.defined(n)||(n=new T.Interval);var r=Number.POSITIVE_INFINITY,i=Number.NEGATIVE_INFINITY,s=a.center,o=a.halfAxes,C=T.Matrix3.getColumn(o,0,x),c=T.Matrix3.getColumn(o,1,f),u=T.Matrix3.getColumn(o,2,p),d=j.Cartesian3.add(C,c,g);j.Cartesian3.add(d,u,d),j.Cartesian3.add(d,s,d);var l=j.Cartesian3.subtract(d,t,w),h=j.Cartesian3.dot(e,l),r=Math.min(h,r),i=Math.max(h,i);return j.Cartesian3.add(s,C,d),j.Cartesian3.add(d,c,d),j.Cartesian3.subtract(d,u,d),j.Cartesian3.subtract(d,t,l),h=j.Cartesian3.dot(e,l),r=Math.min(h,r),i=Math.max(h,i),j.Cartesian3.add(s,C,d),j.Cartesian3.subtract(d,c,d),j.Cartesian3.add(d,u,d),j.Cartesian3.subtract(d,t,l),h=j.Cartesian3.dot(e,l),r=Math.min(h,r),i=Math.max(h,i),j.Cartesian3.add(s,C,d),j.Cartesian3.subtract(d,c,d),j.Cartesian3.subtract(d,u,d),j.Cartesian3.subtract(d,t,l),h=j.Cartesian3.dot(e,l),r=Math.min(h,r),i=Math.max(h,i),j.Cartesian3.subtract(s,C,d),j.Cartesian3.add(d,c,d),j.Cartesian3.add(d,u,d),j.Cartesian3.subtract(d,t,l),h=j.Cartesian3.dot(e,l),r=Math.min(h,r),i=Math.max(h,i),j.Cartesian3.subtract(s,C,d),j.Cartesian3.add(d,c,d),j.Cartesian3.subtract(d,u,d),j.Cartesian3.subtract(d,t,l),h=j.Cartesian3.dot(e,l),r=Math.min(h,r),i=Math.max(h,i),j.Cartesian3.subtract(s,C,d),j.Cartesian3.subtract(d,c,d),j.Cartesian3.add(d,u,d),j.Cartesian3.subtract(d,t,l),h=j.Cartesian3.dot(e,l),r=Math.min(h,r),i=Math.max(h,i),j.Cartesian3.subtract(s,C,d),j.Cartesian3.subtract(d,c,d),j.Cartesian3.subtract(d,u,d),j.Cartesian3.subtract(d,t,l),h=j.Cartesian3.dot(e,l),r=Math.min(h,r),i=Math.max(h,i),n.start=r,n.stop=i,n};var n=new T.BoundingSphere;v.isOccluded=function(a,t){var e=T.BoundingSphere.fromOrientedBoundingBox(a,n);return!t.isBoundingSphereVisible(e)},v.prototype.intersectPlane=function(a){return v.intersectPlane(this,a)},v.prototype.distanceSquaredTo=function(a){return v.distanceSquaredTo(this,a)},v.prototype.computePlaneDistances=function(a,t,e){return v.computePlaneDistances(this,a,t,e)},v.prototype.isOccluded=function(a){return v.isOccluded(this,a)},v.equals=function(a,t){return a===t||q.defined(a)&&q.defined(t)&&j.Cartesian3.equals(a.center,t.center)&&T.Matrix3.equals(a.halfAxes,t.halfAxes)},v.prototype.clone=function(a){return v.clone(this,a)},v.prototype.equals=function(a){return v.equals(this,a)},a.OrientedBoundingBox=v});