RectangleGeometryLibrary-341b00f2.js 2.3 KB

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