2 lines
3.8 KiB
JavaScript
2 lines
3.8 KiB
JavaScript
|
define(["exports","./Cartesian3-e0307675","./Cartesian2-bd414876","./Check-741c5f3c","./defaultValue-81eec7ed","./Math-e73894ab"],(function(t,a,i,n,e,s){"use strict";function o(t,a,i,n,e,s,o){const r=function(t,a){return t*a*(4+t*(4-3*a))/16}(t,i);return(1-r)*t*a*(n+r*e*(o+r*s*(2*o*o-1)))}const r=new a.Cartesian3,h=new a.Cartesian3;function c(t,n,e,c){a.Cartesian3.normalize(c.cartographicToCartesian(n,h),r),a.Cartesian3.normalize(c.cartographicToCartesian(e,h),h),function(t,a,i,n,e,r,h){const c=(a-i)/a,d=r-n,u=Math.atan((1-c)*Math.tan(e)),l=Math.atan((1-c)*Math.tan(h)),M=Math.cos(u),g=Math.sin(u),_=Math.cos(l),p=Math.sin(l),f=M*_,m=M*p,C=g*p,H=g*_;let v,O,S,q,U,b=d,A=s.CesiumMath.TWO_PI,w=Math.cos(b),R=Math.sin(b);do{w=Math.cos(b),R=Math.sin(b);const t=m-H*w;let a;S=Math.sqrt(_*_*R*R+t*t),O=C+f*w,v=Math.atan2(S,O),0===S?(a=0,q=1):(a=f*R/S,q=1-a*a),A=b,U=O-2*C/q,isFinite(U)||(U=0),b=d+o(c,a,q,v,S,O,U)}while(Math.abs(b-A)>s.CesiumMath.EPSILON12);const y=q*(a*a-i*i)/(i*i),E=y*(256+y*(y*(74-47*y)-128))/1024,P=U*U,x=i*(1+y*(4096+y*(y*(320-175*y)-768))/16384)*(v-E*S*(U+E*(O*(2*P-1)-E*U*(4*S*S-3)*(4*P-3)/6)/4)),D=Math.atan2(_*R,m-H*w),T=Math.atan2(M*R,m*w-H);t._distance=x,t._startHeading=D,t._endHeading=T,t._uSquared=y}(t,c.maximumRadius,c.minimumRadius,n.longitude,n.latitude,e.longitude,e.latitude),t._start=i.Cartographic.clone(n,t._start),t._end=i.Cartographic.clone(e,t._end),t._start.height=0,t._end.height=0,function(t){const a=t._uSquared,i=t._ellipsoid.maximumRadius,n=t._ellipsoid.minimumRadius,e=(i-n)/i,s=Math.cos(t._startHeading),o=Math.sin(t._startHeading),r=(1-e)*Math.tan(t._start.latitude),h=1/Math.sqrt(1+r*r),c=h*r,d=Math.atan2(r,s),u=h*o,l=u*u,M=1-l,g=Math.sqrt(M),_=a/4,p=_*_,f=p*_,m=p*p,C=1+_-3*p/4+5*f/4-175*m/64,H=1-_+15*p/8-35*f/8,v=1-3*_+35*p/4,O=1-5*_,S=C*d-H*Math.sin(2*d)*_/2-v*Math.sin(4*d)*p/16-O*Math.sin(6*d)*f/48-5*Math.sin(8*d)*m/512,q=t._constants;q.a=i,q.b=n,q.f=e,q.cosineHeading=s,q.sineHeading=o,q.tanU=r,q.cosineU=h,q.sineU=c,q.sigma=d,q.sineAlpha=u,q.sineSquaredAlpha=l,q.cosineSquaredAlpha=M,q.cosineAlpha=g,q.u2Over4=_,q.u4Over16=p,q.u6Over64=f,q.u8Over256=m,q.a0=C,q.a1=H,q.a2=v,q.a3=O,q.distanceRatio=S}(t)}function d(t,a,n){const s=e.defaultValue(n,i.Ellipsoid.WGS84);this._ellipsoid=s,this._start=new i.Cartographic,this._end=new i.Cartographic,this._constants={},this._startHeading=void 0,this._endHeading=void 0,this._distance=void 0,this._uSquared=void 0,e.defined(t)&&e.defined(a)&&c(this,t,a,s)}Object.defineProperties(d.prototype,{ellipsoid:{get:function(){return this._ellipsoid}},surfaceDistance:{get:function(){return this._distance}},start:{get:function(){return this._start}},end:{get:function(){return this._end}},startHeading:{get:function(){return this._startHeading}},endHeading:{get:function(){return this._endHeading}}}),d.prototype.setEndPoints=function(t,a){c(this,t,a,this._ellipsoid)},d.prototype.interpolateUsingFraction=function(t,a){return this.interpolateUsingSurfaceDistance(this._distance*t,a)},d.prototype.interpolateUsingSurfaceDistance=function(t,a){const n=this._constants,s=n.distanceRatio+t/n.b,r=Math.cos(2*s),h=Math.cos(4*s),c=Math.cos(6*s),d=Math.sin(2*s),u=Math.sin(4*s),l=Math.sin(6*s),M=Math.sin(8*s),g=s*s,_=s*g,p=n.u8Over256,f=n.u2Over4,m=n.u6Over64,C=n.u4Over16;let H=2*_*p*r/3+s*(1-f+7*C/4-15*m/4+579*p/64-(C-15*m/4+187*p/16)*r-(5*m/4-115*p/16)*h-29*p*c/16)+(f/2-C+71*m/32-85*p/16)*d+(5*C/16-5*m/4+383*p/96)*u-g*((m-11*p/2)*d+5*p*u/2)+(29*m/96-29*p/16)*l+539*p*M/1536;const v=Math.asin(Math.sin(H)*n.cosineAlpha),O=Math.atan(n.a/n.b*Math.tan(v));H-=n.sigma;const S=Math.cos(2*n.sigma+H),q=Math.sin(H),U=Math.cos(H),b=n.cosineU*U,A=n.sineU*q,w=Math.atan2(q*n.sineHeading,b-A*n.cosineHeading)-o(n.f,n.sineAlpha,n.cosineSquaredAlpha,H,q,U,S);return e.defined(a)?(a.longitude=this._start.longitude+w,a.latitude=O,a.height=0,a):new i.Cartographic(this._start.longitude+w,O,0)},t.EllipsoidGeodesic=d}));
|