Newer
Older
smartwell_front_dz / smartwell / mars3d-cesium / Workers / RectangleGeometryLibrary-625692af.js
wangxitong on 11 Sep 2023 3 KB first commit
/**
 * @license
 * Cesium - https://github.com/CesiumGS/cesium
 * Version 1.96.6
 *
 * Copyright 2011-2022 Cesium Contributors
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 * Columbus View (Pat. Pend.)
 *
 * Portions licensed separately.
 * See https://github.com/CesiumGS/cesium/blob/main/LICENSE.md for full licensing details.
 */
define(["exports","./Matrix2-4706dd70","./defaultValue-028a8a27","./RuntimeError-a977b8e0","./Transforms-66eda18c","./ComponentDatatype-438cad2a"],(function(t,n,a,e,o,r){"use strict";const s=Math.cos,i=Math.sin,c=Math.sqrt,h={computePosition:function(t,n,e,o,r,h,u){const g=n.radiiSquared,l=t.nwCorner,C=t.boundingRectangle;let d=l.latitude-t.granYCos*o+r*t.granXSin;const M=s(d),S=i(d),w=g.z*S;let m=l.longitude+o*t.granYSin+r*t.granXCos;const p=M*s(m),R=M*i(m),X=g.x*p,Y=g.y*R,O=c(X*p+Y*R+w*S);if(h.x=X/O,h.y=Y/O,h.z=w/O,e){const n=t.stNwCorner;a.defined(n)?(d=n.latitude-t.stGranYCos*o+r*t.stGranXSin,m=n.longitude+o*t.stGranYSin+r*t.stGranXCos,u.x=(m-t.stWest)*t.lonScalar,u.y=(d-t.stSouth)*t.latScalar):(u.x=(m-C.west)*t.lonScalar,u.y=(d-C.south)*t.latScalar)}}},u=new n.Matrix2;let g=new n.Cartesian3;const l=new n.Cartographic;let C=new n.Cartesian3;const d=new o.GeographicProjection;function M(t,a,e,o,r,s,i){const c=Math.cos(a),h=o*c,l=e*c,M=Math.sin(a),S=o*M,w=e*M;g=d.project(t,g),g=n.Cartesian3.subtract(g,C,g);const m=n.Matrix2.fromRotation(a,u);g=n.Matrix2.multiplyByVector(m,g,g),g=n.Cartesian3.add(g,C,g),t=d.unproject(g,t),s-=1,i-=1;const p=t.latitude,R=p+s*w,X=p-h*i,Y=p-h*i+s*w,O=Math.max(p,R,X,Y),_=Math.min(p,R,X,Y),f=t.longitude,x=f+s*l,G=f+i*S,P=f+i*S+s*l,W=Math.max(f,x,G,P),y=Math.min(f,x,G,P);return{north:O,south:_,east:W,west:y,granYCos:h,granYSin:S,granXCos:l,granXSin:w,nwCorner:t}}h.computeOptions=function(t,a,o,s,i,c,h){let u,g=t.east,S=t.west,w=t.north,m=t.south,p=!1,R=!1;w===r.CesiumMath.PI_OVER_TWO&&(p=!0),m===-r.CesiumMath.PI_OVER_TWO&&(R=!0);const X=w-m;u=S>g?r.CesiumMath.TWO_PI-S+g:g-S;const Y=Math.ceil(u/a)+1,O=Math.ceil(X/a)+1,_=u/(Y-1),f=X/(O-1),x=n.Rectangle.northwest(t,c),G=n.Rectangle.center(t,l);(0!==o||0!==s)&&(G.longitude<x.longitude&&(G.longitude+=r.CesiumMath.TWO_PI),C=d.project(G,C));const P=f,W=_,y=0,I=0,T=n.Rectangle.clone(t,i),E={granYCos:P,granYSin:y,granXCos:W,granXSin:I,nwCorner:x,boundingRectangle:T,width:Y,height:O,northCap:p,southCap:R};if(0!==o){const t=M(x,o,_,f,G,Y,O);if(w=t.north,m=t.south,g=t.east,S=t.west,w<-r.CesiumMath.PI_OVER_TWO||w>r.CesiumMath.PI_OVER_TWO||m<-r.CesiumMath.PI_OVER_TWO||m>r.CesiumMath.PI_OVER_TWO)throw new e.DeveloperError("Rotated rectangle is invalid.  It crosses over either the north or south pole.");E.granYCos=t.granYCos,E.granYSin=t.granYSin,E.granXCos=t.granXCos,E.granXSin=t.granXSin,T.north=w,T.south=m,T.east=g,T.west=S}if(0!==s){o-=s;const t=n.Rectangle.northwest(T,h),a=M(t,o,_,f,G,Y,O);E.stGranYCos=a.granYCos,E.stGranXCos=a.granXCos,E.stGranYSin=a.granYSin,E.stGranXSin=a.granXSin,E.stNwCorner=t,E.stWest=a.west,E.stSouth=a.south}return E},t.RectangleGeometryLibrary=h}));