27 lines
10 KiB
Java
27 lines
10 KiB
Java
![]() |
/**
|
||
|
* @license
|
||
|
* Cesium - https://github.com/CesiumGS/cesium
|
||
|
* Version 1.109
|
||
|
*
|
||
|
* 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-YTG33ZHK.js";import{a as L}from"./chunk-ATQXFTWF.js";import{b as v,c as J,d as Z}from"./chunk-NNIY7VTE.js";import{b as B,c as k,d as I}from"./chunk-5EDTRNG5.js";import{a as t,b as T,c as F,d}from"./chunk-C6Y3PRDH.js";import{a as g}from"./chunk-LI57NJAL.js";import{a as W}from"./chunk-P44SUSQU.js";import{a as b,b as z}from"./chunk-FUATUYJ3.js";import{e as p}from"./chunk-ODUTJJQ5.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;c<h;c++)t.add(r,n[c],r);let o=1/h;t.multiplyByScalar(r,o,r);let i=0,C=0,w=0,l=0,u=0,a=0,s;for(c=0;c<h;c++)s=t.subtract(n[c],r,ut),i+=s.x*s.x,C+=s.x*s.y,w+=s.x*s.z,l+=s.y*s.y,u+=s.y*s.z,a+=s.z*s.z;i*=o,C*=o,w*=o,l*=o,u*=o,a*=o;let f=Nt;f[0]=i,f[1]=C,f[2]=w,f[3]=C,f[4]=l,f[5]=u,f[6]=w,f[7]=u,f[8]=a;let A=d.computeEigenDecomposition(f,Mt),M=d.clone(A.unitary,e.halfAxes),x=d.getColumn(M,0,xt),y=d.getColumn(M,1,yt),N=d.getColumn(M,2,At),P=-Number.MAX_VALUE,O=-Number.MAX_VALUE,U=-Number.MAX_VALUE,q=Number.MAX_VALUE,R=Number.MAX_VALUE,j=Number.MAX_VALUE;for(c=0;c<h;c++)s=n[c],P=Math.max(t.dot(x,s),P),O=Math.max(t.dot(y,s),O),U=Math.max(t.dot(N,s),U),q=Math.min(t.dot(x,s),q),R=Math.min(t.dot(y,s),R),j=Math.min(t.dot(N,s),j);x=t.multiplyByScalar(x,.5*(q+P),x),y=t.multiplyByScalar(y,.5*(R+O),y),N=t.multiplyByScalar(N,.5*(j+U),N);let S=t.add(x,y,e.center);t.add(S,N,S);let E=Pt;return E.x=P-q,E.y=O-R,E.z=U-j,t.multiplyByScalar(E,.5,E),d.multiplyByScale(e.halfAxes,E,e.halfAxes),e};var nt=new t,Ot=new t;function Q(n,e,c,h,r,o,i,C,w,l,u){if(!p(r)||!p(o)||!p(i)||!p(C)||!p(w)||!p(l))throw new b("all extents (minimum/maximum X/Y/Z) are required.");p(u)||(u=new m);let a=u.halfAxes;d.setColumn(a,0,e,a),d.setColumn(a,1,c,a),d.setColumn(a,2,h,a);let s=nt;s.x=(r+o)/2,s.y=(i+C)/2,s.z=(w+l)/2;let f=Ot;f.x=(o-r)/2,f.y=(C-i)/2,f.z=(l-w)/2;let A=u.center;return s=d.multiplyByVector(a,s,s),t.add(n,s,A),d.multiplyByScale(a,f,a),u}var $=new T,bt=new t,St=new T,Tt=new T,gt=new T,Et=new T,Rt=new T,Wt=new t,H=new t,zt=new t,tt=new t,It=new t,Lt=new I,Ut=new I,qt=new I,jt=new I,Bt=new I,vt=new t,Vt=new t,_t=new t,Dt=new t,Xt=new I,kt=new t,Zt=new t,Yt=new t,Gt=new L(t.UNIT_X,0);m.fromRectangle=function(n,e,c,h,r){if(!p(n))throw new b("rectangle is required");if(n.width<0||n.width>g.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.getPoint
|