/* 2020-9-22 15:23:25 | 版权所有 军懋国兴  */
define(["exports","./when-cbf8cd21","./Check-35e1a91d","./Math-69007a69","./Cartesian2-43e3a3be","./Transforms-2d1ac5ec","./GeometryAttribute-2303bbfb"],function(t,O,b,x,P,n,_){"use strict";var R=Math.cos,p=Math.sin,f=Math.sqrt,a={computePosition:function(t,n,a,r,e,o,s){var i,h=n.radiiSquared,g=t.nwCorner,u=t.boundingRectangle,c=g.latitude-t.granYCos*r+e*t.granXSin,C=R(c),l=p(c),d=h.z*l,M=g.longitude+r*t.granYSin+e*t.granXCos,S=C*R(M),w=C*p(M),m=h.x*S,X=h.y*w,Y=f(m*S+X*w+d*l);o.x=m/Y,o.y=X/Y,o.z=d/Y,a&&(i=t.stNwCorner,O.defined(i)?(c=i.latitude-t.stGranYCos*r+e*t.stGranXSin,M=i.longitude+r*t.stGranYSin+e*t.stGranXCos,s.x=(M-t.stWest)*t.lonScalar,s.y=(c-t.stSouth)*t.latScalar):(s.x=(M-u.west)*t.lonScalar,s.y=(c-u.south)*t.latScalar))}},v=new _.Matrix2,G=new P.Cartesian3,W=new P.Cartographic,y=new P.Cartesian3,I=new n.GeographicProjection;function T(t,n,a,r,e,o,s){var i=Math.cos(n),h=r*i,g=a*i,u=Math.sin(n),c=r*u,C=a*u;G=I.project(t,G),G=P.Cartesian3.subtract(G,y,G);var l=_.Matrix2.fromRotation(n,v);G=_.Matrix2.multiplyByVector(l,G,G),G=P.Cartesian3.add(G,y,G),--o,--s;var d=(t=I.unproject(G,t)).latitude,M=d+o*C,S=d-h*s,w=d-h*s+o*C,m=Math.max(d,M,S,w),X=Math.min(d,M,S,w),Y=t.longitude,O=Y+o*g,R=Y+s*c,p=Y+s*c+o*g;return{north:m,south:X,east:Math.max(Y,O,R,p),west:Math.min(Y,O,R,p),granYCos:h,granYSin:c,granXCos:g,granXSin:C,nwCorner:t}}a.computeOptions=function(t,n,a,r,e,o,s){var i=t.east,h=t.west,g=t.north,u=t.south,c=!1,C=!1;g===x.CesiumMath.PI_OVER_TWO&&(c=!0),u===-x.CesiumMath.PI_OVER_TWO&&(C=!0);var l,d,M,S=g-u,w=(l=i<h?x.CesiumMath.TWO_PI-h+i:i-h)/((d=Math.ceil(l/n)+1)-1),m=S/((M=Math.ceil(S/n)+1)-1),X=P.Rectangle.northwest(t,o),Y=P.Rectangle.center(t,W);0===a&&0===r||(Y.longitude<X.longitude&&(Y.longitude+=x.CesiumMath.TWO_PI),y=I.project(Y,y));var O,R,p=m,_=w,f=P.Rectangle.clone(t,e),v={granYCos:p,granYSin:0,granXCos:_,granXSin:0,nwCorner:X,boundingRectangle:f,width:d,height:M,northCap:c,southCap:C};if(0!==a){var G=T(X,a,w,m,0,d,M),g=G.north,u=G.south,i=G.east,h=G.west;if(g<-x.CesiumMath.PI_OVER_TWO||g>x.CesiumMath.PI_OVER_TWO||u<-x.CesiumMath.PI_OVER_TWO||u>x.CesiumMath.PI_OVER_TWO)throw new b.DeveloperError("Rotated rectangle is invalid.  It crosses over either the north or south pole.");v.granYCos=G.granYCos,v.granYSin=G.granYSin,v.granXCos=G.granXCos,v.granXSin=G.granXSin,f.north=g,f.south=u,f.east=i,f.west=h}return 0!==r&&(a-=r,R=T(O=P.Rectangle.northwest(f,s),a,w,m,0,d,M),v.stGranYCos=R.granYCos,v.stGranXCos=R.granXCos,v.stGranYSin=R.granYSin,v.stGranXSin=R.granXSin,v.stNwCorner=O,v.stWest=R.west,v.stSouth=R.south),v},t.RectangleGeometryLibrary=a});