define(["exports","./Cartesian2-b4b7b0b3","./Check-5e798bbf","./when-208fe5b0","./Transforms-73e77b72"],function(e,d,n,h,a){"use strict";function b(e,n,i){this.minimum=d.Cartesian3.clone(h.defaultValue(e,d.Cartesian3.ZERO)),this.maximum=d.Cartesian3.clone(h.defaultValue(n,d.Cartesian3.ZERO)),i=h.defined(i)?d.Cartesian3.clone(i):d.Cartesian3.midpoint(this.minimum,this.maximum,new d.Cartesian3),this.center=i}b.fromPoints=function(e,n){if(h.defined(n)||(n=new b),!h.defined(e)||0===e.length)return n.minimum=d.Cartesian3.clone(d.Cartesian3.ZERO,n.minimum),n.maximum=d.Cartesian3.clone(d.Cartesian3.ZERO,n.maximum),n.center=d.Cartesian3.clone(d.Cartesian3.ZERO,n.center),n;for(var i=e[0].x,t=e[0].y,a=e[0].z,m=e[0].x,r=e[0].y,s=e[0].z,u=e.length,c=1;c<u;c++)var o=e[c],l=o.x,C=o.y,o=o.z,i=Math.min(l,i),m=Math.max(l,m),t=Math.min(C,t),r=Math.max(C,r),a=Math.min(o,a),s=Math.max(o,s);var f=n.minimum;f.x=i,f.y=t,f.z=a;var x=n.maximum;return x.x=m,x.y=r,x.z=s,n.center=d.Cartesian3.midpoint(f,x,n.center),n},b.clone=function(e,n){if(h.defined(e))return h.defined(n)?(n.minimum=d.Cartesian3.clone(e.minimum,n.minimum),n.maximum=d.Cartesian3.clone(e.maximum,n.maximum),n.center=d.Cartesian3.clone(e.center,n.center),n):new b(e.minimum,e.maximum,e.center)},b.equals=function(e,n){return e===n||h.defined(e)&&h.defined(n)&&d.Cartesian3.equals(e.center,n.center)&&d.Cartesian3.equals(e.minimum,n.minimum)&&d.Cartesian3.equals(e.maximum,n.maximum)};var m=new d.Cartesian3;b.intersectPlane=function(e,n){m=d.Cartesian3.subtract(e.maximum,e.minimum,m);var i=d.Cartesian3.multiplyByScalar(m,.5,m),t=n.normal,i=i.x*Math.abs(t.x)+i.y*Math.abs(t.y)+i.z*Math.abs(t.z),n=d.Cartesian3.dot(e.center,t)+n.distance;return 0<n-i?a.Intersect.INSIDE:n+i<0?a.Intersect.OUTSIDE:a.Intersect.INTERSECTING},b.prototype.clone=function(e){return b.clone(this,e)},b.prototype.intersectPlane=function(e){return b.intersectPlane(this,e)},b.prototype.equals=function(e){return b.equals(this,e)},e.AxisAlignedBoundingBox=b});
