|
|
/** * @license * Cesium - https://github.com/CesiumGS/cesium
* Version 1.140.0 * * 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 o}from"./chunk-XXWWJ3QU.js";import{a as p}from"./chunk-N6SIW7ZL.js";import{a as O,b as r}from"./chunk-K35RPNUR.js";import{e as a}from"./chunk-RTRJ3LVQ.js";var Ee=new o,Ce=new o;function Te(n,e,t,i,u){if(!a(n))throw new O("cartesian is required.");if(!a(e))throw new O("oneOverRadii is required.");if(!a(t))throw new O("oneOverRadiiSquared is required.");if(!a(i))throw new O("centerToleranceSquared is required.");let c=n.x,d=n.y,y=n.z,R=e.x,A=e.y,S=e.z,w=c*c*R*R,_=d*d*A*A,j=y*y*S*S,M=w+_+j,E=Math.sqrt(1/M),P=o.multiplyByScalar(n,E,Ee);if(M<i)return isFinite(E)?o.clone(P,u):void 0;let Y=t.x,Q=t.y,H=t.z,k=Ce;k.x=P.x*Y*2,k.y=P.y*Q*2,k.z=P.z*H*2;let I=(1-E)*o.magnitude(n)/(.5*o.magnitude(k)),se=0,J,fe,C,T,v,K,ee,te,de,pe,le;do{I-=se,C=1/(1+I*Y),T=1/(1+I*Q),v=1/(1+I*H),K=C*C,ee=T*T,te=v*v,de=K*C,pe=ee*T,le=te*v,J=w*K+_*ee+j*te-1,fe=w*de*Y+_*pe*Q+j*le*H;let je=-2*fe;se=J/je}while(Math.abs(J)>p.EPSILON12);return a(u)?(u.x=c*C,u.y=d*T,u.z=y*v,u):new o(c*C,d*T,y*v)}var B=Te;function f(n,e,t){this.longitude=n??0,this.latitude=e??0,this.height=t??0}f.fromRadians=function(n,e,t,i){return r.typeOf.number("longitude",n),r.typeOf.number("latitude",e),t=t??0,a(i)?(i.longitude=n,i.latitude=e,i.height=t,i):new f(n,e,t)};f.fromDegrees=function(n,e,t,i){return r.typeOf.number("longitude",n),r.typeOf.number("latitude",e),n=p.toRadians(n),e=p.toRadians(e),f.fromRadians(n,e,t,i)};var ve=new o,Fe=new o,Me=new o;f._ellipsoidOneOverRadii=new o(1/6378137,1/6378137,1/6356752314245179e-9);f._ellipsoidOneOverRadiiSquared=new o(1/(6378137*6378137),1/(6378137*6378137),1/(6356752314245179e-9*6356752314245179e-9));f._ellipsoidCenterToleranceSquared=p.EPSILON1;f.fromCartesian=function(n,e,t){let i=a(e)?e.oneOverRadii:f._ellipsoidOneOverRadii,u=a(e)?e.oneOverRadiiSquared:f._ellipsoidOneOverRadiiSquared,c=a(e)?e._centerToleranceSquared:f._ellipsoidCenterToleranceSquared,d=B(n,i,u,c,Fe);if(!a(d))return;let y=o.multiplyComponents(d,u,ve);y=o.normalize(y,y);let R=o.subtract(n,d,Me),A=Math.atan2(y.y,y.x),S=Math.asin(y.z),w=p.sign(o.dot(R,n))*o.magnitude(R);return a(t)?(t.longitude=A,t.latitude=S,t.height=w,t):new f(A,S,w)};f.toCartesian=function(n,e,t){return r.defined("cartographic",n),o.fromRadians(n.longitude,n.latitude,n.height,e,t)};f.clone=function(n,e){if(a(n))return a(e)?(e.longitude=n.longitude,e.latitude=n.latitude,e.height=n.height,e):new f(n.longitude,n.latitude,n.height)};f.equals=function(n,e){return n===e||a(n)&&a(e)&&n.longitude===e.longitude&&n.latitude===e.latitude&&n.height===e.height};f.equalsEpsilon=function(n,e,t){return t=t??0,n===e||a(n)&&a(e)&&Math.abs(n.longitude-e.longitude)<=t&&Math.abs(n.latitude-e.latitude)<=t&&Math.abs(n.height-e.height)<=t};f.ZERO=Object.freeze(new f(0,0,0));f.prototype.clone=function(n){return f.clone(this,n)};f.prototype.equals=function(n){return f.equals(this,n)};f.prototype.equalsEpsilon=function(n,e){return f.equalsEpsilon(this,n,e)};f.prototype.toString=function(){return`(${this.longitude}, ${this.latitude}, ${this.height})`};var N=f;var l=class n{constructor(e,t){this.x=e??0,this.y=t??0}static fromElements(e,t,i){return a(i)?(i.x=e,i.y=t,i):new n(e,t)}static clone(e,t){if(a(e))return a(t)?(t.x=e.x,t.y=e.y,t):new n(e.x,e.y)}static pack(e,t,i){return r.typeOf.object("value",e),r.defined("array",t),i=i??0,t[i++]=e.x,t[i]=e.y,t}static unpack(e,t,i){return r.defined("array",e),t=t??0,a(i)||(i=new n),i.x=e[t++],i.y=e[t],i}static packArray(e,t){r.defined("array",e);let i=e.length,u=i*2;if(!a(t))t=new Array(u);else{if(!Array.isArray(t)&&t.length!==u)throw new O("If result is a typed array, it must have exactly array.length * 2 elements");t.length!==u&&(t.length=u)}for(let c=0;c<i;++c)n.pack(e[c],t,c*2);return t}static unpackArray(e,t){if(r.defined("array",e),r.typeOf.number.greaterThanOrEquals("array.length",e.length,2),e.length%2!==0)throw new O("array length must be a multiple of 2.");let i=e.length;a(t)?t.length=i/2:t=new Array(i/2);for(let u=0;u<i;u+=2){let c=u/2;t[c]=n.unpack(e,u,t[c])}return t}static maximumComponent(e){return r.typeOf.object("cartesian",e),Math.max(e.x,e.y)}static minimumComponent
|