define(["exports","./Cartesian2-d9931622","./when-cbf8cd21","./Check-35e1a91d","./Transforms-dc557a5f","./Math-bedecb43","./GeometryAttribute-b1afc11b"],function(t,X,S,n,a,Y,l){"use strict";var w=Math.cos,M=Math.sin,m=Math.sqrt,r={computePosition:function(t,n,a,r,e,o,s){var i=n.radiiSquared,g=t.nwCorner,h=t.boundingRectangle,c=g.latitude-t.granYCos*r+e*t.granXSin,u=w(c),C=M(c),l=i.z*C,d=g.longitude+r*t.granYSin+e*t.granXCos,n=u*w(d),g=u*M(d),u=i.x*n,i=i.y*g,C=m(u*n+i*g+l*C);o.x=u/C,o.y=i/C,o.z=l/C,a&&(a=t.stNwCorner,S.defined(a)?(c=a.latitude-t.stGranYCos*r+e*t.stGranXSin,d=a.longitude+r*t.stGranYSin+e*t.stGranXCos,s.x=(d-t.stWest)*t.lonScalar,s.y=(c-t.stSouth)*t.latScalar):(s.x=(d-h.west)*t.lonScalar,s.y=(c-h.south)*t.latScalar))}},d=new l.Matrix2,p=new X.Cartesian3,f=new X.Cartographic,G=new X.Cartesian3,b=new a.GeographicProjection;function x(t,n,a,r,e,o,s){var i=Math.cos(n),g=r*i,h=a*i,c=Math.sin(n),u=r*c,C=a*c;p=b.project(t,p),p=X.Cartesian3.subtract(p,G,p);i=l.Matrix2.fromRotation(n,d);p=l.Matrix2.multiplyByVector(i,p,p),p=X.Cartesian3.add(p,G,p),--o,--s;r=(t=b.unproject(p,t)).latitude,a=r+o*C,c=r-g*s,n=r-g*s+o*C,i=Math.max(r,a,c,n),r=Math.min(r,a,c,n),a=t.longitude,c=a+o*h,n=a+s*u,o=a+s*u+o*h;return{north:i,south:r,east:Math.max(a,c,n,o),west:Math.min(a,c,n,o),granYCos:g,granYSin:u,granXCos:h,granXSin:C,nwCorner:t}}r.computeOptions=function(t,n,a,r,e,o,s){var i=t.east,g=t.west,h=t.north,c=t.south,u=!1,C=!1;h===Y.CesiumMath.PI_OVER_TWO&&(u=!0),c===-Y.CesiumMath.PI_OVER_TWO&&(C=!0);var l,d=h-c,S=(w=i<g?Y.CesiumMath.TWO_PI-g+i:i-g)/((l=Math.ceil(w/n)+1)-1),w=d/((M=Math.ceil(d/n)+1)-1),d=X.Rectangle.northwest(t,o),n=X.Rectangle.center(t,f);0===a&&0===r||(n.longitude<d.longitude&&(n.longitude+=Y.CesiumMath.TWO_PI),G=b.project(n,G));var M,o=w,n=S,e=X.Rectangle.clone(t,e),C={granYCos:o,granYSin:0,granXCos:n,granXSin:0,nwCorner:d,boundingRectangle:e,width:l,height:M,northCap:u,southCap:C};return 0!==a&&(h=(d=x(d,a,S,w,0,l,M)).north,c=d.south,i=d.east,g=d.west,C.granYCos=d.granYCos,C.granYSin=d.granYSin,C.granXCos=d.granXCos,C.granXSin=d.granXSin,e.north=h,e.south=c,e.east=i,e.west=g),0!==r&&(a-=r,M=x(s=X.Rectangle.northwest(e,s),a,S,w,0,l,M),C.stGranYCos=M.granYCos,C.stGranXCos=M.granXCos,C.stGranYSin=M.granYSin,C.stGranXSin=M.granXSin,C.stNwCorner=s,C.stWest=M.west,C.stSouth=M.south),C},t.RectangleGeometryLibrary=r});
|