2 lines
12 KiB
JavaScript
2 lines
12 KiB
JavaScript
|
define(["exports","./Cartesian3-e0307675","./Check-741c5f3c","./defaultValue-81eec7ed","./Math-e73894ab"],(function(e,t,n,i,a){"use strict";const r=new t.Cartesian3,o=new t.Cartesian3;function u(e,n,u,s,d){const c=e.x,l=e.y,f=e.z,h=n.x,m=n.y,y=n.z,p=c*c*h*h,C=l*l*m*m,g=f*f*y*y,x=p+C+g,_=Math.sqrt(1/x),S=t.Cartesian3.multiplyByScalar(e,_,r);if(x<s)return isFinite(_)?t.Cartesian3.clone(S,d):void 0;const q=u.x,w=u.y,M=u.z,R=o;R.x=S.x*q*2,R.y=S.y*w*2,R.z=S.z*M*2;let O,z,v,T,b,A,E,N,V,k,I,B=(1-_)*t.Cartesian3.magnitude(e)/(.5*t.Cartesian3.magnitude(R)),U=0;do{B-=U,v=1/(1+B*q),T=1/(1+B*w),b=1/(1+B*M),A=v*v,E=T*T,N=b*b,V=A*v,k=E*T,I=N*b,O=p*A+C*E+g*N-1,z=p*V*q+C*k*w+g*I*M;U=O/(-2*z)}while(Math.abs(O)>a.CesiumMath.EPSILON12);return i.defined(d)?(d.x=c*v,d.y=l*T,d.z=f*b,d):new t.Cartesian3(c*v,l*T,f*b)}function s(e,t,n){this.longitude=i.defaultValue(e,0),this.latitude=i.defaultValue(t,0),this.height=i.defaultValue(n,0)}s.fromRadians=function(e,t,n,a){return n=i.defaultValue(n,0),i.defined(a)?(a.longitude=e,a.latitude=t,a.height=n,a):new s(e,t,n)},s.fromDegrees=function(e,t,n,i){return e=a.CesiumMath.toRadians(e),t=a.CesiumMath.toRadians(t),s.fromRadians(e,t,n,i)};const d=new t.Cartesian3,c=new t.Cartesian3,l=new t.Cartesian3,f=new t.Cartesian3(1/6378137,1/6378137,1/6356752.314245179),h=new t.Cartesian3(1/40680631590769,1/40680631590769,1/40408299984661.445),m=a.CesiumMath.EPSILON1;function y(e,n,r,o){n=i.defaultValue(n,0),r=i.defaultValue(r,0),o=i.defaultValue(o,0),e._radii=new t.Cartesian3(n,r,o),e._radiiSquared=new t.Cartesian3(n*n,r*r,o*o),e._radiiToTheFourth=new t.Cartesian3(n*n*n*n,r*r*r*r,o*o*o*o),e._oneOverRadii=new t.Cartesian3(0===n?0:1/n,0===r?0:1/r,0===o?0:1/o),e._oneOverRadiiSquared=new t.Cartesian3(0===n?0:1/(n*n),0===r?0:1/(r*r),0===o?0:1/(o*o)),e._minimumRadius=Math.min(n,r,o),e._maximumRadius=Math.max(n,r,o),e._centerToleranceSquared=a.CesiumMath.EPSILON1,0!==e._radiiSquared.z&&(e._squaredXOverSquaredZ=e._radiiSquared.x/e._radiiSquared.z)}function p(e,t,n){this._radii=void 0,this._radiiSquared=void 0,this._radiiToTheFourth=void 0,this._oneOverRadii=void 0,this._oneOverRadiiSquared=void 0,this._minimumRadius=void 0,this._maximumRadius=void 0,this._centerToleranceSquared=void 0,this._squaredXOverSquaredZ=void 0,y(this,e,t,n)}s.fromCartesian=function(e,n,r){const o=i.defined(n)?n.oneOverRadii:f,y=i.defined(n)?n.oneOverRadiiSquared:h,p=u(e,o,y,i.defined(n)?n._centerToleranceSquared:m,c);if(!i.defined(p))return;let C=t.Cartesian3.multiplyComponents(p,y,d);C=t.Cartesian3.normalize(C,C);const g=t.Cartesian3.subtract(e,p,l),x=Math.atan2(C.y,C.x),_=Math.asin(C.z),S=a.CesiumMath.sign(t.Cartesian3.dot(g,e))*t.Cartesian3.magnitude(g);return i.defined(r)?(r.longitude=x,r.latitude=_,r.height=S,r):new s(x,_,S)},s.toCartesian=function(e,n,i){return t.Cartesian3.fromRadians(e.longitude,e.latitude,e.height,n,i)},s.clone=function(e,t){if(i.defined(e))return i.defined(t)?(t.longitude=e.longitude,t.latitude=e.latitude,t.height=e.height,t):new s(e.longitude,e.latitude,e.height)},s.equals=function(e,t){return e===t||i.defined(e)&&i.defined(t)&&e.longitude===t.longitude&&e.latitude===t.latitude&&e.height===t.height},s.equalsEpsilon=function(e,t,n){return n=i.defaultValue(n,0),e===t||i.defined(e)&&i.defined(t)&&Math.abs(e.longitude-t.longitude)<=n&&Math.abs(e.latitude-t.latitude)<=n&&Math.abs(e.height-t.height)<=n},s.ZERO=Object.freeze(new s(0,0,0)),s.prototype.clone=function(e){return s.clone(this,e)},s.prototype.equals=function(e){return s.equals(this,e)},s.prototype.equalsEpsilon=function(e,t){return s.equalsEpsilon(this,e,t)},s.prototype.toString=function(){return`(${this.longitude}, ${this.latitude}, ${this.height})`},Object.defineProperties(p.prototype,{radii:{get:function(){return this._radii}},radiiSquared:{get:function(){return this._radiiSquared}},radiiToTheFourth:{get:function(){return this._radiiToTheFourth}},oneOverRadii:{get:function(){return this._oneOverRadii}},oneOverRadiiSquared:{get:function(){return this._oneOverRadiiSquared}},minimumRadius:{get:function(){return this._minimumRadius}},maximumRadius:{get:function(){ret
|