define(["exports","./Transforms-d5c6ad6e","./Matrix2-ccd5b911","./RuntimeError-346a3079","./when-4bbc8319","./EllipsoidTangentPlane-e000bae1","./ComponentDatatype-93750d1a","./Plane-18bb00f8"],function(a,l,N,t,O,w,y,b){"use strict";function P(a,t){this.center=N.Cartesian3.clone(O.defaultValue(a,N.Cartesian3.ZERO)),this.halfAxes=N.Matrix3.clone(O.defaultValue(t,N.Matrix3.ZERO))}P.packedLength=N.Cartesian3.packedLength+N.Matrix3.packedLength,P.pack=function(a,t,e){return e=O.defaultValue(e,0),N.Cartesian3.pack(a.center,t,e),N.Matrix3.pack(a.halfAxes,t,e+N.Cartesian3.packedLength),t},P.unpack=function(a,t,e){return t=O.defaultValue(t,0),O.defined(e)||(e=new P),N.Cartesian3.unpack(a,t,e.center),N.Matrix3.unpack(a,t+N.Cartesian3.packedLength,e.halfAxes),e};var T=new N.Cartesian3,A=new N.Cartesian3,I=new N.Cartesian3,R=new N.Cartesian3,E=new N.Cartesian3,S=new N.Cartesian3,U=new N.Matrix3,L={unitary:new N.Matrix3,diagonal:new N.Matrix3};P.fromPoints=function(a,t){if(O.defined(t)||(t=new P),!O.defined(a)||0===a.length)return t.halfAxes=N.Matrix3.ZERO,t.center=N.Cartesian3.ZERO,t;for(var e=a.length,n=N.Cartesian3.clone(a[0],T),r=1;ro&&(s+=(x=n.x-o)*x),n.y<-C?s+=(x=n.y+C)*x:n.y>C&&(s+=(x=n.y-C)*x),n.z<-c?s+=(x=n.z+c)*x:n.z>c&&(s+=(x=n.z-c)*x),s};var x=new N.Cartesian3,ca=new N.Cartesian3;P.computePlaneDistances=function(a,t,e,n){O.defined(n)||(n=new l.Interval);var r=Number.POSITIVE_INFINITY,i=Number.NEGATIVE_INFINITY,s=a.center,o=a.halfAxes,C=N.Matrix3.getColumn(o,0,M),c=N.Matrix3.getColumn(o,1,f),u=N.Matrix3.getColumn(o,2,p),d=N.Cartesian3.add(C,c,x);N.Cartesian3.add(d,u,d),N.Cartesian3.add(d,s,d);a=N.Cartesian3.subtract(d,t,ca),o=N.Cartesian3.dot(e,a),r=Math.min(o,r),i=Math.max(o,i);return N.Cartesian3.add(s,C,d),N.Cartesian3.add(d,c,d),N.Cartesian3.subtract(d,u,d),N.Cartesian3.subtract(d,t,a),o=N.Cartesian3.dot(e,a),r=Math.min(o,r),i=Math.max(o,i),N.Cartesian3.add(s,C,d),N.Cartesian3.subtract(d,c,d),N.Cartesian3.add(d,u,d),N.Cartesian3.subtract(d,t,a),o=N.Cartesian3.dot(e,a),r=Math.min(o,r),i=Math.max(o,i),N.Cartesian3.add(s,C,d),N.Cartesian3.subtract(d,c,d),N.Cartesian3.subtract(d,u,d),N.Cartesian3.subtract(d,t,a),o=N.Cartesian3.dot(e,a),r=Math.min(o,r),i=Math.max(o,i),N.Cartesian3.subtract(s,C,d),N.Cartesian3.add(d,c,d),N.Cartesian3.add(d,u,d),N.Cartesian3.subtract(d,t,a),o=N.Cartesian3.dot(e,a),r=Math.min(o,r),i=Math.max(o,i),N.Cartesian3.subtract(s,C,d),N.Cartesian3.add(d,c,d),N.Cartesian3.subtract(d,u,d),N.Cartesian3.subtract(d,t,a),o=N.Cartesian3.dot(e,a),r=Math.min(o,r),i=Math.max(o,i),N.Cartesian3.subtract(s,C,d),N.Cartesian3.subtract(d,c,d),N.Cartesian3.add(d,u,d),N.Cartesian3.subtract(d,t,a),o=N.Cartesian3.dot(e,a),r=Math.min(o,r),i=Math.max(o,i),N.Cartesian3.subtract(s,C,d),N.Cartesian3.subtract(d,c,d),N.Cartesian3.subtract(d,u,d),N.Cartesian3.subtract(d,t,a),o=N.Cartesian3.dot(e,a),r=Math.min(o,r),i=Math.max(o,i),n.start=r,n.stop=i,n};var e=new l.BoundingSphere;P.isOccluded=function(a,t){a=l.BoundingSphere.fromOrientedBoundingBox(a,e);return!t.isBoundingSphereVisible(a)},P.prototype.intersectPlane=function(a){return P.intersectPlane(this,a)},P.prototype.distanceSquaredTo=function(a){return P.distanceSquaredTo(this,a)},P.prototype.computePlaneDistances=function(a,t,e){return P.computePlaneDistances(this,a,t,e)},P.prototype.isOccluded=function(a){return P.isOccluded(this,a)},P.equals=function(a,t){return a===t||O.defined(a)&&O.defined(t)&&N.Cartesian3.equals(a.center,t.center)&&N.Matrix3.equals(a.halfAxes,t.halfAxes)},P.prototype.clone=function(a){return P.clone(this,a)},P.prototype.equals=function(a){return P.equals(this,a)},a.OrientedBoundingBox=P});