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