/** * Cesium - https://github.com/CesiumGS/cesium * * Copyright 2011-2020 Cesium Contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * Columbus View (Pat. Pend.) * * Portions licensed separately. * See https://github.com/CesiumGS/cesium/blob/master/LICENSE.md for full licensing details. */ define(["exports","./when-8d13db60","./Check-70bec281","./Math-61ede240","./Cartographic-f27b0939","./Cartesian2-09435a6c","./BoundingSphere-c409f092","./Plane-2bcb9154","./EllipsoidTangentPlane-9c25b2da"],function(a,W,X,j,Z,G,N,Y,F){function A(a,e){this.center=Z.Cartesian3.clone(W.defaultValue(a,Z.Cartesian3.ZERO)),this.halfAxes=N.Matrix3.clone(W.defaultValue(e,N.Matrix3.ZERO))}A.packedLength=Z.Cartesian3.packedLength+N.Matrix3.packedLength,A.pack=function(a,e,t){return X.Check.typeOf.object("value",a),X.Check.defined("array",e),t=W.defaultValue(t,0),Z.Cartesian3.pack(a.center,e,t),N.Matrix3.pack(a.halfAxes,e,t+Z.Cartesian3.packedLength),e},A.unpack=function(a,e,t){return X.Check.defined("array",a),e=W.defaultValue(e,0),W.defined(t)||(t=new A),Z.Cartesian3.unpack(a,e,t.center),N.Matrix3.unpack(a,e+Z.Cartesian3.packedLength,t.halfAxes),t};var R=new Z.Cartesian3,T=new Z.Cartesian3,I=new Z.Cartesian3,D=new Z.Cartesian3,L=new Z.Cartesian3,S=new Z.Cartesian3,z=new N.Matrix3,q={unitary:new N.Matrix3,diagonal:new N.Matrix3};A.fromPoints=function(a,e){if(W.defined(e)||(e=new A),!W.defined(a)||0===a.length)return e.halfAxes=N.Matrix3.ZERO,e.center=Z.Cartesian3.ZERO,e;var t,r=a.length,n=Z.Cartesian3.clone(a[0],R);for(t=1;tj.CesiumMath.TWO_PI)throw new X.DeveloperError("Rectangle width must be between 0 and 2*pi");if(a.height<0||a.height>j.CesiumMath.PI)throw new X.DeveloperError("Rectangle height must be between 0 and pi");if(W.defined(r)&&!j.CesiumMath.equalsEpsilon(r.radii.x,r.radii.y,j.CesiumMath.EPSILON15))throw new X.DeveloperError("Ellipsoid must be an ellipsoid of revolution (radii.x == radii.y)");var i,s,o,d,C,u,c;if(e=W.defaultValue(e,0),t=W.defaultValue(t,0),r=W.defaultValue(r,G.Ellipsoid.WGS84),a.width<=j.CesiumMath.PI){var l=G.Rectangle.center(a,J),h=r.cartographicToCartesian(l,K),f=new F.EllipsoidTangentPlane(h,r);c=f.plane;var m=l.longitude,x=a.south<0&&0o&&(l+=(c=u.x-o)*c),u.y<-d?l+=(c=u.y+d)*c:u.y>d&&(l+=(c=u.y-d)*c),u.z<-C?l+=(c=u.z+C)*c:u.z>C&&(l+=(c=u.z-C)*c),l};var w=new Z.Cartesian3,g=new Z.Cartesian3;A.computePlaneDistances=function(a,e,t,r){if(!W.defined(a))throw new X.DeveloperError("box is required.");if(!W.defined(e))throw new X.DeveloperError("position is required.");if(!W.defined(t))throw new X.DeveloperError("direction is required.");W.defined(r)||(r=new N.Interval);var n=Number.POSITIVE_INFINITY,i=Number.NEGATIVE_INFINITY,s=a.center,o=a.halfAxes,d=N.Matrix3.getColumn(o,0,f),C=N.Matrix3.getColumn(o,1,p),u=N.Matrix3.getColumn(o,2,M),c=Z.Cartesian3.add(d,C,w);Z.Cartesian3.add(c,u,c),Z.Cartesian3.add(c,s,c);var l=Z.Cartesian3.subtract(c,e,g),h=Z.Cartesian3.dot(t,l);return n=Math.min(h,n),i=Math.max(h,i),Z.Cartesian3.add(s,d,c),Z.Cartesian3.add(c,C,c),Z.Cartesian3.subtract(c,u,c),Z.Cartesian3.subtract(c,e,l),h=Z.Cartesian3.dot(t,l),n=Math.min(h,n),i=Math.max(h,i),Z.Cartesian3.add(s,d,c),Z.Cartesian3.subtract(c,C,c),Z.Cartesian3.add(c,u,c),Z.Cartesian3.subtract(c,e,l),h=Z.Cartesian3.dot(t,l),n=Math.min(h,n),i=Math.max(h,i),Z.Cartesian3.add(s,d,c),Z.Cartesian3.subtract(c,C,c),Z.Cartesian3.subtract(c,u,c),Z.Cartesian3.subtract(c,e,l),h=Z.Cartesian3.dot(t,l),n=Math.min(h,n),i=Math.max(h,i),Z.Cartesian3.subtract(s,d,c),Z.Cartesian3.add(c,C,c),Z.Cartesian3.add(c,u,c),Z.Cartesian3.subtract(c,e,l),h=Z.Cartesian3.dot(t,l),n=Math.min(h,n),i=Math.max(h,i),Z.Cartesian3.subtract(s,d,c),Z.Cartesian3.add(c,C,c),Z.Cartesian3.subtract(c,u,c),Z.Cartesian3.subtract(c,e,l),h=Z.Cartesian3.dot(t,l),n=Math.min(h,n),i=Math.max(h,i),Z.Cartesian3.subtract(s,d,c),Z.Cartesian3.subtract(c,C,c),Z.Cartesian3.add(c,u,c),Z.Cartesian3.subtract(c,e,l),h=Z.Cartesian3.dot(t,l),n=Math.min(h,n),i=Math.max(h,i),Z.Cartesian3.subtract(s,d,c),Z.Cartesian3.subtract(c,C,c),Z.Cartesian3.subtract(c,u,c),Z.Cartesian3.subtract(c,e,l),h=Z.Cartesian3.dot(t,l),n=Math.min(h,n),i=Math.max(h,i),r.start=n,r.stop=i,r};var r=new N.BoundingSphere;A.isOccluded=function(a,e){if(!W.defined(a))throw new X.DeveloperError("box is required.");if(!W.defined(e))throw new X.DeveloperError("occluder is required.");var t=N.BoundingSphere.fromOrientedBoundingBox(a,r);return!e.isBoundingSphereVisible(t)},A.prototype.intersectPlane=function(a){return A.intersectPlane(this,a)},A.prototype.distanceSquaredTo=function(a){return A.distanceSquaredTo(this,a)},A.prototype.computePlaneDistances=function(a,e,t){return A.computePlaneDistances(this,a,e,t)},A.prototype.isOccluded=function(a){return A.isOccluded(this,a)},A.equals=function(a,e){return a===e||W.defined(a)&&W.defined(e)&&Z.Cartesian3.equals(a.center,e.center)&&N.Matrix3.equals(a.halfAxes,e.halfAxes)},A.prototype.clone=function(a){return A.clone(this,a)},A.prototype.equals=function(a){return A.equals(this,a)},a.OrientedBoundingBox=A});