27 lines
21 KiB
JavaScript
27 lines
21 KiB
JavaScript
/**
|
|||
|
|
* @license
|
||
|
|
* Cesium - https://github.com/CesiumGS/cesium
|
||
|
|
* Version 1.136.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 u}from"./chunk-QDJTHWTA.js";import{a as l}from"./chunk-2YWR3G22.js";import{a as g,b as r}from"./chunk-HTSQLHXI.js";import{e as a}from"./chunk-JDAHMWM5.js";var ve=new u,Fe=new u;function Me(e,n,t,i,s){if(!a(e))throw new g("cartesian is required.");if(!a(n))throw new g("oneOverRadii is required.");if(!a(t))throw new g("oneOverRadiiSquared is required.");if(!a(i))throw new g("centerToleranceSquared is required.");let f=e.x,p=e.y,y=e.z,q=n.x,R=n.y,S=n.z,_=f*f*q*q,E=p*p*R*R,j=y*y*S*S,N=_+E+j,C=Math.sqrt(1/N),P=u.multiplyByScalar(e,C,ve);if(N<i)return isFinite(C)?u.clone(P,s):void 0;let Q=t.x,H=t.y,J=t.z,k=Fe;k.x=P.x*Q*2,k.y=P.y*H*2,k.z=P.z*J*2;let B=(1-C)*u.magnitude(e)/(.5*u.magnitude(k)),de=0,K,pe,T,v,F,ee,ne,te,le,me,ye;do{B-=de,T=1/(1+B*Q),v=1/(1+B*H),F=1/(1+B*J),ee=T*T,ne=v*v,te=F*F,le=ee*T,me=ne*v,ye=te*F,K=_*ee+E*ne+j*te-1,pe=_*le*Q+E*me*H+j*ye*J;let Te=-2*pe;de=K/Te}while(Math.abs(K)>l.EPSILON12);return a(s)?(s.x=f*T,s.y=p*v,s.z=y*F,s):new u(f*T,p*v,y*F)}var V=Me;function d(e,n,t){this.longitude=e??0,this.latitude=n??0,this.height=t??0}d.fromRadians=function(e,n,t,i){return r.typeOf.number("longitude",e),r.typeOf.number("latitude",n),t=t??0,a(i)?(i.longitude=e,i.latitude=n,i.height=t,i):new d(e,n,t)};d.fromDegrees=function(e,n,t,i){return r.typeOf.number("longitude",e),r.typeOf.number("latitude",n),e=l.toRadians(e),n=l.toRadians(n),d.fromRadians(e,n,t,i)};var Ne=new u,ze=new u,Ie=new u;d._ellipsoidOneOverRadii=new u(1/6378137,1/6378137,1/6356752314245179e-9);d._ellipsoidOneOverRadiiSquared=new u(1/(6378137*6378137),1/(6378137*6378137),1/(6356752314245179e-9*6356752314245179e-9));d._ellipsoidCenterToleranceSquared=l.EPSILON1;d.fromCartesian=function(e,n,t){let i=a(n)?n.oneOverRadii:d._ellipsoidOneOverRadii,s=a(n)?n.oneOverRadiiSquared:d._ellipsoidOneOverRadiiSquared,f=a(n)?n._centerToleranceSquared:d._ellipsoidCenterToleranceSquared,p=V(e,i,s,f,ze);if(!a(p))return;let y=u.multiplyComponents(p,s,Ne);y=u.normalize(y,y);let q=u.subtract(e,p,Ie),R=Math.atan2(y.y,y.x),S=Math.asin(y.z),_=l.sign(u.dot(q,e))*u.magnitude(q);return a(t)?(t.longitude=R,t.latitude=S,t.height=_,t):new d(R,S,_)};d.toCartesian=function(e,n,t){return r.defined("cartographic",e),u.fromRadians(e.longitude,e.latitude,e.height,n,t)};d.clone=function(e,n){if(a(e))return a(n)?(n.longitude=e.longitude,n.latitude=e.latitude,n.height=e.height,n):new d(e.longitude,e.latitude,e.height)};d.equals=function(e,n){return e===n||a(e)&&a(n)&&e.longitude===n.longitude&&e.latitude===n.latitude&&e.height===n.height};d.equalsEpsilon=function(e,n,t){return t=t??0,e===n||a(e)&&a(n)&&Math.abs(e.longitude-n.longitude)<=t&&Math.abs(e.latitude-n.latitude)<=t&&Math.abs(e.height-n.height)<=t};d.ZERO=Object.freeze(new d(0,0,0));d.prototype.clone=function(e){return d.clone(this,e)};d.prototype.equals=function(e){return d.equals(this,e)};d.prototype.equalsEpsilon=function(e,n){return d.equalsEpsilon(this,e,n)};d.prototype.toString=function(){return`(${this.longitude}, ${this.latitude}, ${this.height})`};var z=d;function o(e,n){this.x=e??0,this.y=n??0}o.fromElements=function(e,n,t){return a(t)?(t.x=e,t.y=n,t):new o(e,n)};o.clone=function(e,n){if(a(e))return a(n)?(n.x=e.x,n.y=e.y,n):new o(e.x,e.y)};o.fromCartesian3=o.clone;o.fromCartesian4=o.clone;o.packedLength=2;o.pack=function(e,n,t){return r.typeOf.object("value",e),r.defined("array",n),t=t??0,n[t++]=e.x,n[t]=e.y,n};o.unpack=function(e,n,t){return r.defined("array",e),n=n??0,a(t)||(t=new o),t.x=e[n++],t.y=e[n],t};o.packArray=function(e,n){r.defined("array",e);let t=e.length,i=t*2;if(!a(n))n=new Array(i);else{if(!Array.isArray(n)&&n.length!==i)throw new g("If result is a typed array, it must have exactly array.length * 2 elements");n.length!==i&&(n.length=i)}for(let s=0;s<t;++s)o.pack(e[s],n,s*2);return n};o.unpackArray=function(e,n){if(r.defined("array",e),r.typeOf.number.greaterThanOrEquals("array.length",e.length,2),e.length%2!==0)throw new g("array length must be a multiple of 2.");let t=e.length;a(n)?n.length=t/2:n=new Array(t/2);for(let i=0;i<t;i+=2){let s=i/2;n[s]=o.unpack(e,i,n[s])}return n};o.fromArray=o.unpack
|