You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
27 lines
11 KiB
27 lines
11 KiB
4 weeks ago
|
/**
|
||
|
* @license
|
||
|
* Cesium - https://github.com/CesiumGS/cesium
|
||
|
* Version 1.128
|
||
|
*
|
||
|
* 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{b as Z,h as A}from"./chunk-GSQ5TTBU.js";import{a as n,b as v,d as N,e as _}from"./chunk-KLDIEE7M.js";import{a as on}from"./chunk-BF7B4FIR.js";import{a as en,b as h}from"./chunk-IQDUXDOM.js";import{e as x}from"./chunk-GDY26PU3.js";function I(e){this._ellipsoid=e??N.default,this._semimajorAxis=this._ellipsoid.maximumRadius,this._oneOverSemimajorAxis=1/this._semimajorAxis}Object.defineProperties(I.prototype,{ellipsoid:{get:function(){return this._ellipsoid}}});I.prototype.project=function(e,t){let o=this._semimajorAxis,c=e.longitude*o,r=e.latitude*o,d=e.height;return x(t)?(t.x=c,t.y=r,t.z=d,t):new n(c,r,d)};I.prototype.unproject=function(e,t){if(!x(e))throw new en("cartesian is required");let o=this._oneOverSemimajorAxis,c=e.x*o,r=e.y*o,d=e.z;return x(t)?(t.longitude=c,t.latitude=r,t.height=d,t):new v(c,r,d)};var k=I;var sn={OUTSIDE:-1,INTERSECTING:0,INSIDE:1},U=Object.freeze(sn);function mn(e,t){this.start=e??0,this.stop=t??0}var cn=mn;function a(e,t){this.center=n.clone(e??n.ZERO),this.radius=t??0}var X=new n,F=new n,Y=new n,J=new n,K=new n,Q=new n,$=new n,b=new n,L=new n,H=new n,nn=new n,tn=new n,un=4/3*on.PI;a.fromPoints=function(e,t){if(x(t)||(t=new a),!x(e)||e.length===0)return t.center=n.clone(n.ZERO,t.center),t.radius=0,t;let o=n.clone(e[0],$),c=n.clone(o,X),r=n.clone(o,F),d=n.clone(o,Y),f=n.clone(o,J),s=n.clone(o,K),m=n.clone(o,Q),z=e.length,y;for(y=1;y<z;y++){n.clone(e[y],o);let C=o.x,M=o.y,w=o.z;C<c.x&&n.clone(o,c),C>f.x&&n.clone(o,f),M<r.y&&n.clone(o,r),M>s.y&&n.clone(o,s),w<d.z&&n.clone(o,d),w>m.z&&n.clone(o,m)}let u=n.magnitudeSquared(n.subtract(f,c,b)),i=n.magnitudeSquared(n.subtract(s,r,b)),B=n.magnitudeSquared(n.subtract(m,d,b)),T=c,q=f,O=u;i>O&&(O=i,T=r,q=s),B>O&&(O=B,T=d,q=m);let p=L;p.x=(T.x+q.x)*.5,p.y=(T.y+q.y)*.5,p.z=(T.z+q.z)*.5;let S=n.magnitudeSquared(n.subtract(q,p,b)),l=Math.sqrt(S),j=H;j.x=c.x,j.y=r.y,j.z=d.z;let P=nn;P.x=f.x,P.y=s.y,P.z=m.z;let E=n.midpoint(j,P,tn),D=0;for(y=0;y<z;y++){n.clone(e[y],o);let C=n.magnitude(n.subtract(o,E,b));C>D&&(D=C);let M=n.magnitudeSquared(n.subtract(o,p,b));if(M>S){let w=Math.sqrt(M);l=(l+w)*.5,S=l*l;let g=w-l;p.x=(l*p.x+g*o.x)/w,p.y=(l*p.y+g*o.y)/w,p.z=(l*p.z+g*o.z)/w}}return l<D?(n.clone(p,t.center),t.radius=l):(n.clone(E,t.center),t.radius=D),t};var rn=new k,xn=new n,yn=new n,G=new v,V=new v;a.fromRectangle2D=function(e,t,o){return a.fromRectangleWithHeights2D(e,t,0,0,o)};a.fromRectangleWithHeights2D=function(e,t,o,c,r){if(x(r)||(r=new a),!x(e))return r.center=n.clone(n.ZERO,r.center),r.radius=0,r;rn._ellipsoid=N.default,t=t??rn,A.southwest(e,G),G.height=o,A.northeast(e,V),V.height=c;let d=t.project(G,xn),f=t.project(V,yn),s=f.x-d.x,m=f.y-d.y,z=f.z-d.z;r.radius=Math.sqrt(s*s+m*m+z*z)*.5;let y=r.center;return y.x=d.x+s*.5,y.y=d.y+m*.5,y.z=d.z+z*.5,r};var ln=[];a.fromRectangle3D=function(e,t,o,c){if(t=t??N.default,o=o??0,x(c)||(c=new a),!x(e))return c.center=n.clone(n.ZERO,c.center),c.radius=0,c;let r=A.subsample(e,t,o,ln);return a.fromPoints(r,c)};a.fromVertices=function(e,t,o,c){if(x(c)||(c=new a),!x(e)||e.length===0)return c.center=n.clone(n.ZERO,c.center),c.radius=0,c;t=t??n.ZERO,o=o??3,h.typeOf.number.greaterThanOrEquals("stride",o,3);let r=$;r.x=e[0]+t.x,r.y=e[1]+t.y,r.z=e[2]+t.z;let d=n.clone(r,X),f=n.clone(r,F),s=n.clone(r,Y),m=n.clone(r,J),z=n.clone(r,K),y=n.clone(r,Q),u=e.length,i;for(i=0;i<u;i+=o){let w=e[i]+t.x,g=e[i+1]+t.y,R=e[i+2]+t.z;r.x=w,r.y=g,r.z=R,w<d.x&&n.clone(r,d),w>m.x&&n.clone(r,m),g<f.y&&n.clone(r,f),g>z.y&&n.clone(r,z),R<s.z&&n.clone(r,s),R>y.z&&n.clone(r,y)}let B=n.magnitudeSquared(n.subtract(m,d,b)),T=n.magnitudeSquared(n.subtract(z,f,b)),q=n.magnitudeSquared(n.subtract(y,s,b)),O=d,p=m,S=B;T>S&&(S=T,O=f,p=z),q>S&&(S=q,O=s,p=y);let l=L;l.x=(O.x+p.x)*.5,l.y=(O.y+p.y)*.5,l.z=(O.z+p.z)*.5;let j=n.magnitudeSquared(n.subtract(p,l,b)),P=Math.sqrt(j),E=H;E.x=d.x,E.y=f.y,E.z=s.z;let D=nn;D.x=m.x,D.y=z.y,D.z=y.z;let C=n.midpoint(E,D,tn),M=0;for(i=0;i<u;i+=o){r.x=e[i]+t.x,r.y=e[i+1]+t.y,r.z=e[i+2]+t.z;let w=n.magnitude(n.subtract(r,C,b));w>M&&(M=w);let g=n.magnitudeSquared(n.subtract(r,l,b));if(g>j){let R=Math.sqrt(g);P=(P+R)*.5,j=P*P
|