/** * @license * Cesium - https://github.com/CesiumGS/cesium * Version 1.110.1 * * Copyright 2011-2022 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/main/LICENSE.md for full licensing details. */ import{a as K}from"./chunk-BV3RKX5O.js";import{a as L}from"./chunk-BXMC6F3B.js";import{b as v,c as J,d as Z}from"./chunk-O5E7EBKP.js";import{b as B,c as k,d as I}from"./chunk-GMFQULD7.js";import{a as t,b as T,c as F,d}from"./chunk-4ZQSV4FU.js";import{a as g}from"./chunk-CLQ5X6HS.js";import{a as W}from"./chunk-FOJGNIAW.js";import{a as b,b as z}from"./chunk-UGI536VH.js";import{e as p}from"./chunk-BQUQ5TPM.js";function m(n,e){this.center=t.clone(W(n,t.ZERO)),this.halfAxes=d.clone(W(e,d.ZERO))}m.packedLength=t.packedLength+d.packedLength;m.pack=function(n,e,c){return z.typeOf.object("value",n),z.defined("array",e),c=W(c,0),t.pack(n.center,e,c),d.pack(n.halfAxes,e,c+t.packedLength),e};m.unpack=function(n,e,c){return z.defined("array",n),e=W(e,0),p(c)||(c=new m),t.unpack(n,e,c.center),d.unpack(n,e+t.packedLength,c.halfAxes),c};var Ct=new t,ut=new t,Pt=new t,xt=new t,yt=new t,At=new t,Nt=new d,Mt={unitary:new d,diagonal:new d};m.fromPoints=function(n,e){if(p(e)||(e=new m),!p(n)||n.length===0)return e.halfAxes=d.ZERO,e.center=t.ZERO,e;let c,h=n.length,r=t.clone(n[0],Ct);for(c=1;cg.TWO_PI)throw new b("Rectangle width must be between 0 and 2 * pi");if(n.height<0||n.height>g.PI)throw new b("Rectangle height must be between 0 and pi");if(p(h)&&!g.equalsEpsilon(h.radii.x,h.radii.y,g.EPSILON15))throw new b("Ellipsoid must be an ellipsoid of revolution (radii.x == radii.y)");e=W(e,0),c=W(c,0),h=W(h,F.WGS84);let o,i,C,w,l,u,a;if(n.width<=g.PI){let R=k.center(n,$),j=h.cartographicToCartesian(R,bt),S=new K(j,h);a=S.plane;let E=R.longitude,ot=n.south<0&&n.north>0?0:R.latitude,st=T.fromRadians(E,n.north,c,St),V=T.fromRadians(n.west,n.north,c,Tt),it=T.fromRadians(n.west,ot,c,gt),_=T.fromRadians(n.west,n.south,c,Et),ht=T.fromRadians(E,n.south,c,Rt),ft=h.cartographicToCartesian(st,Wt),D=h.cartographicToCartesian(V,H),dt=h.cartographicToCartesian(it,zt),X=h.cartographicToCartesian(_,tt),mt=h.cartographicToCartesian(ht,It),wt=S.projectPointToNearestOnPlane(ft,Lt),Y=S.projectPointToNearestOnPlane(D,Ut),lt=S.projectPointToNearestOnPlane(dt,qt),G=S.projectPointToNearestOnPlane(X,jt),pt=S.projectPointToNearestOnPlane(mt,Bt);return o=Math.min(Y.x,lt.x,G.x),i=-o,w=Math.max(Y.y,wt.y),C=Math.min(G.y,pt.y),V.height=_.height=e,D=h.cartographicToCartesian(V,H),X=h.cartographicToCartesian(_,tt),l=Math.min(L.getPointDistance(a,D),L.getPointDistance(a,X)),u=c,Q(S.origin,S.xAxis,S.yAxis,S.zAxis,o,i,C,w,l,u,r)}let s=n.south>0,f=n.north<0,A=s?n.south:f?n.north:0,M=k.center(n,$).longitude,x=t.fromRadians(M,A,c,h,vt);x.z=0;let N=Math.abs(x.x)=w?v.INSIDE:v.INTERSECTING};var at=new t,ct=new t,rt=new t,Ft=new t,et=new t,Jt=new t;m.distanceSquaredTo=function(n,e){if(!p(n))throw new b("box is required.");if(!p(e))throw new b("cartesian is required.");let c=t.subtract(e,n.center,nt),h=n.halfAxes,r=d.getColumn(h,0,at),o=d.getColumn(h,1,ct),i=d.getColumn(h,2,rt),C=t.magnitude(r),w=t.magnitude(o),l=t.magnitude(i),u=!0,a=!0,s=!0;C>0?t.divideByScalar(r,C,r):u=!1,w>0?t.divideByScalar(o,w,o):a=!1,l>0?t.divideByScalar(i,l,i):s=!1;let f=!u+!a+!s,A,M,x;if(f===1){let O=r;A=o,M=i,a?s||(O=i,M=r):(O=o,A=r),x=t.cross(A,M,et),O===r?r=x:O===o?o=x:O===i&&(i=x)}else if(f===2){A=r,a?A=o:s&&(A=i);let O=t.UNIT_Y;O.equalsEpsilon(A,g.EPSILON3)&&(O=t.UNIT_X),M=t.cross(A,O,Ft),t.normalize(M,M),x=t.cross(A,M,et),t.normalize(x,x),A===r?(o=M,i=x):A===o?(i=M,r=x):A===i&&(r=M,o=x)}else f===3&&(r=t.UNIT_X,o=t.UNIT_Y,i=t.UNIT_Z);let y=Jt;y.x=t.dot(c,r),y.y=t.dot(c,o),y.z=t.dot(c,i);let N=0,P;return y.x<-C?(P=y.x+C,N+=P*P):y.x>C&&(P=y.x-C,N+=P*P),y.y<-w?(P=y.y+w,N+=P*P):y.y>w&&(P=y.y-w,N+=P*P),y.z<-l?(P=y.z+l,N+=P*P):y.z>l&&(P=y.z-l,N+=P*P),N};var Kt=new t,Qt=new t;m.computePlaneDistances=function(n,e,c,h){if(!p(n))throw new b("box is required.");if(!p(e))throw new b("position is required.");if(!p(c))throw new b("direction is required.");p(h)||(h=new J);let r=Number.POSITIVE_INFINITY,o=Number.NEGATIVE_INFINITY,i=n.center,C=n.halfAxes,w=d.getColumn(C,0,at),l=d.getColumn(C,1,ct),u=d.getColumn(C,2,rt),a=t.add(w,l,Kt);t.add(a,u,a),t.add(a,i,a);let s=t.subtract(a,e,Qt),f=t.dot(c,s);return r=Math.min(f,r),o=Math.max(f,o),t.add(i,w,a),t.add(a,l,a),t.subtract(a,u,a),t.subtract(a,e,s),f=t.dot(c,s),r=Math.min(f,r),o=Math.max(f,o),t.add(i,w,a),t.subtract(a,l,a),t.add(a,u,a),t.subtract(a,e,s),f=t.dot(c,s),r=Math.min(f,r),o=Math.max(f,o),t.add(i,w,a),t.subtract(a,l,a),t.subtract(a,u,a),t.subtract(a,e,s),f=t.dot(c,s),r=Math.min(f,r),o=Math.max(f,o),t.subtract(i,w,a),t.add(a,l,a),t.add(a,u,a),t.subtract(a,e,s),f=t.dot(c,s),r=Math.min(f,r),o=Math.max(f,o),t.subtract(i,w,a),t.add(a,l,a),t.subtract(a,u,a),t.subtract(a,e,s),f=t.dot(c,s),r=Math.min(f,r),o=Math.max(f,o),t.subtract(i,w,a),t.subtract(a,l,a),t.add(a,u,a),t.subtract(a,e,s),f=t.dot(c,s),r=Math.min(f,r),o=Math.max(f,o),t.subtract(i,w,a),t.subtract(a,l,a),t.subtract(a,u,a),t.subtract(a,e,s),f=t.dot(c,s),r=Math.min(f,r),o=Math.max(f,o),h.start=r,h.stop=o,h};var $t=new t,Ht=new t,te=new t;m.computeCorners=function(n,e){z.typeOf.object("box",n),p(e)||(e=[new t,new t,new t,new t,new t,new t,new t,new t]);let c=n.center,h=n.halfAxes,r=d.getColumn(h,0,$t),o=d.getColumn(h,1,Ht),i=d.getColumn(h,2,te);return t.clone(c,e[0]),t.subtract(e[0],r,e[0]),t.subtract(e[0],o,e[0]),t.subtract(e[0],i,e[0]),t.clone(c,e[1]),t.subtract(e[1],r,e[1]),t.subtract(e[1],o,e[1]),t.add(e[1],i,e[1]),t.clone(c,e[2]),t.subtract(e[2],r,e[2]),t.add(e[2],o,e[2]),t.subtract(e[2],i,e[2]),t.clone(c,e[3]),t.subtract(e[3],r,e[3]),t.add(e[3],o,e[3]),t.add(e[3],i,e[3]),t.clone(c,e[4]),t.add(e[4],r,e[4]),t.subtract(e[4],o,e[4]),t.subtract(e[4],i,e[4]),t.clone(c,e[5]),t.add(e[5],r,e[5]),t.subtract(e[5],o,e[5]),t.add(e[5],i,e[5]),t.clone(c,e[6]),t.add(e[6],r,e[6]),t.add(e[6],o,e[6]),t.subtract(e[6],i,e[6]),t.clone(c,e[7]),t.add(e[7],r,e[7]),t.add(e[7],o,e[7]),t.add(e[7],i,e[7]),e};var ee=new d;m.computeTransformation=function(n,e){z.typeOf.object("box",n),p(e)||(e=new B);let c=n.center,h=d.multiplyByUniformScale(n.halfAxes,2,ee);return B.fromRotationTranslation(h,c,e)};var ne=new Z;m.isOccluded=function(n,e){if(!p(n))throw new b("box is required.");if(!p(e))throw new b("occluder is required.");let c=Z.fromOrientedBoundingBox(n,ne);return!e.isBoundingSphereVisible(c)};m.prototype.intersectPlane=function(n){return m.intersectPlane(this,n)};m.prototype.distanceSquaredTo=function(n){return m.distanceSquaredTo(this,n)};m.prototype.computePlaneDistances=function(n,e,c){return m.computePlaneDistances(this,n,e,c)};m.prototype.computeCorners=function(n){return m.computeCorners(this,n)};m.prototype.computeTransformation=function(n){return m.computeTransformation(this,n)};m.prototype.isOccluded=function(n){return m.isOccluded(this,n)};m.equals=function(n,e){return n===e||p(n)&&p(e)&&t.equals(n.center,e.center)&&d.equals(n.halfAxes,e.halfAxes)};m.prototype.clone=function(n){return m.clone(this,n)};m.prototype.equals=function(n){return m.equals(this,n)};var ye=m;export{ye as a};