/** * 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-a55a8a4c","./Check-bc1d37d9","./Math-73a8bd13","./Cartesian2-8c9f79ed","./Transforms-7a81c8c2","./Plane-a6a20716","./EllipsoidTangentPlane-7f2f6dd6"],function(a,q,t,X,j,A,Z,G){"use strict";function T(a,t){this.center=j.Cartesian3.clone(q.defaultValue(a,j.Cartesian3.ZERO)),this.halfAxes=A.Matrix3.clone(q.defaultValue(t,A.Matrix3.ZERO))}T.packedLength=j.Cartesian3.packedLength+A.Matrix3.packedLength,T.pack=function(a,t,e){return e=q.defaultValue(e,0),j.Cartesian3.pack(a.center,t,e),A.Matrix3.pack(a.halfAxes,t,e+j.Cartesian3.packedLength),t},T.unpack=function(a,t,e){return t=q.defaultValue(t,0),q.defined(e)||(e=new T),j.Cartesian3.unpack(a,t,e.center),A.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 A.Matrix3,V={unitary:new A.Matrix3,diagonal:new A.Matrix3};T.fromPoints=function(a,t){if(q.defined(t)||(t=new T),!q.defined(a)||0===a.length)return t.halfAxes=A.Matrix3.ZERO,t.center=j.Cartesian3.ZERO,t;var e,n=a.length,r=j.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 j.Cartesian3,w=new j.Cartesian3;T.computePlaneDistances=function(a,t,e,n){q.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=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);return r=Math.min(h,r),i=Math.max(h,i),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 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||q.defined(a)&&q.defined(t)&&j.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});