Agriculture-front-end/dist/Cesium/Workers/createGroundPolylineGeometry.js
2023-09-11 21:56:39 +08:00

2 lines
20 KiB
JavaScript

define(["./BoundingSphere-561b54d0","./buildModuleUrl-3addfe33","./Cartesian2-47311507","./Cartographic-3309dd0d","./Check-7b2a090c","./when-b60132fc","./Math-119be1a3","./ArcType-29cf2197","./arrayRemoveDuplicates-d2f048c5","./ComponentDatatype-c140a87d","./EllipsoidGeodesic-0f19ac62","./EllipsoidRhumbLine-ed1a6bf4","./EncodedCartesian3-f1396b05","./GeometryAttribute-3a42bbdc","./IntersectionTests-0c6d0a14","./Plane-097b3a8f","./Transforms-cb0006b0","./WebMercatorProjection-01b1b5e7","./Cartesian4-3ca25aab","./RuntimeError-4a5c8994","./WebGLConstants-4ae0db90","./PrimitiveType-39acab88","./FeatureDetection-c3b71206"],(function(e,a,t,i,n,r,s,o,l,u,c,h,C,d,p,g,m,f,v,w,y,_,T){"use strict";function M(a){a=r.defaultValue(a,{}),this._ellipsoid=r.defaultValue(a.ellipsoid,t.Ellipsoid.WGS84),this._rectangle=r.defaultValue(a.rectangle,t.Rectangle.MAX_VALUE),this._projection=new e.GeographicProjection(this._ellipsoid),this._numberOfLevelZeroTilesX=r.defaultValue(a.numberOfLevelZeroTilesX,2),this._numberOfLevelZeroTilesY=r.defaultValue(a.numberOfLevelZeroTilesY,1),this._customDPI=a.customDPI,this._scaleDenominators=a.scaleDenominators,this._tileWidth=r.defaultValue(a.tileWidth,256),this._tileHeight=r.defaultValue(a.tileHeight,256),this._beginLevel=r.defaultValue(a.beginLevel,0)}Object.defineProperties(M.prototype,{ellipsoid:{get:function(){return this._ellipsoid}},rectangle:{get:function(){return this._rectangle}},projection:{get:function(){return this._projection}},beginLevel:{get:function(){return this._beginLevel}}}),M.prototype.getNumberOfXTilesAtLevel=function(e){return this._numberOfLevelZeroTilesX<<e-this._beginLevel},M.prototype.getNumberOfYTilesAtLevel=function(e){return this._numberOfLevelZeroTilesY<<e-this._beginLevel},M.prototype.rectangleToNativeRectangle=function(e,a){var i=s.CesiumMath.toDegrees(e.west),n=s.CesiumMath.toDegrees(e.south),o=s.CesiumMath.toDegrees(e.east),l=s.CesiumMath.toDegrees(e.north);return r.defined(a)?(a.west=i,a.south=n,a.east=o,a.north=l,a):new t.Rectangle(i,n,o,l)},M.prototype.tileXYToNativeRectangle=function(e,a,t,i){var n=this.tileXYToRectangle(e,a,t,i);return n.west=s.CesiumMath.toDegrees(n.west),n.south=s.CesiumMath.toDegrees(n.south),n.east=s.CesiumMath.toDegrees(n.east),n.north=s.CesiumMath.toDegrees(n.north),n},M.prototype.tileXYToRectangle=function(e,a,i,n){var o=this._rectangle;if(r.defined(this._customDPI)&&r.defined(this._scaleDenominators)){var l=this.calculateResolution(i),u=-s.CesiumMath.PI+e*this._tileWidth*l.x,c=-s.CesiumMath.PI+(e+1)*this._tileWidth*l.x,h=s.CesiumMath.PI_OVER_TWO-a*this._tileHeight*l.y,C=s.CesiumMath.PI_OVER_TWO-(a+1)*this._tileHeight*l.y;return r.defined(n)?(n.west=u,n.south=C,n.east=c,n.north=h,n):new t.Rectangle(u,C,c,h)}var d=this.getNumberOfXTilesAtLevel(i),p=this.getNumberOfYTilesAtLevel(i),g=o.width/d,m=(u=e*g+o.west,c=(e+1)*g+o.west,o.height/p);h=o.north-a*m,C=o.north-(a+1)*m;return r.defined(n)||(n=new t.Rectangle(u,C,c,h)),n.west=u,n.south=C,n.east=c,n.north=h,n},M.prototype.positionToTileXY=function(e,a,i){var n=this._rectangle;if(t.Rectangle.contains(n,e)){var o=this.getNumberOfXTilesAtLevel(a),l=this.getNumberOfYTilesAtLevel(a),u=n.width/o,c=n.height/l;if(r.defined(this._customDPI)&&r.defined(this._scaleDenominators)){var h=this.calculateResolution(a);u=this._tileWidth*h.x,c=this._tileHeight*h.y}var C=e.longitude;n.east<n.west&&(C+=s.CesiumMath.TWO_PI);var d=(C-n.west)/u|0;d>=o&&(d=o-1);var p=(n.north-e.latitude)/c|0;return p>=l&&(p=l-1),r.defined(i)?(i.x=d,i.y=p,i):new t.Cartesian2(d,p)}},M.prototype.calculateResolution=function(e){var a=.0254*this._scaleDenominators[e-this._beginLevel]/this._customDPI.x,i=.0254*this._scaleDenominators[e-this._beginLevel]/this._customDPI.y,n=t.Ellipsoid.WGS84.maximumRadius;return new t.Cartesian2(a/n,i/n)};var E=new i.Cartesian3,b=new i.Cartesian3,P=new i.Cartographic,O=new i.Cartesian3,I=new i.Cartesian3,L=new e.BoundingSphere,S=new M,D=[new i.Cartographic,new i.Cartographic,new i.Cartographic,new i.Cartographic],k=new t.Cartesian2,A={};function N(e){i.Cartographic.fromRadians(e.east,e.north,0,D[0]),i.Cartographic.fromRadians(e.west,e.north,0,D[1]),i.Cartographic.fromRadians(e.east,e.south,0,D[2]),i.Cartographic.fromRadians(e.west,e.south,0,D[3]);var a,t=0,n=0,r=0,s=0,o=A._terrainHeightsMaxLevel;for(a=0;a<=o;++a){for(var l=!1,u=0;u<4;++u){var c=D[u];if(S.positionToTileXY(c,a,k),0===u)r=k.x,s=k.y;else if(r!==k.x||s!==k.y){l=!0;break}}if(l)break;t=r,n=s}if(0!==a)return{x:t,y:n,level:a>o?o:a-1}}A.initialize=function(){var e=A._initPromise;return r.defined(e)||(e=a.Resource.fetchJson(a.buildModuleUrl("Assets/approximateTerrainHeights.json")).then((function(e){A._terrainHeights=e})),A._initPromise=e),e},A.getMinimumMaximumHeights=function(e,a){a=r.defaultValue(a,t.Ellipsoid.WGS84);var n=N(e),s=A._defaultMinTerrainHeight,o=A._defaultMaxTerrainHeight;if(r.defined(n)){var l=n.level+"-"+n.x+"-"+n.y,u=A._terrainHeights[l];r.defined(u)&&(s=u[0],o=u[1]),a.cartographicToCartesian(t.Rectangle.northeast(e,P),E),a.cartographicToCartesian(t.Rectangle.southwest(e,P),b),i.Cartesian3.midpoint(b,E,O);var c=a.scaleToGeodeticSurface(O,I);if(r.defined(c)){var h=i.Cartesian3.distance(O,c);s=Math.min(s,-h)}else s=A._defaultMinTerrainHeight}return{minimumTerrainHeight:s=Math.max(A._defaultMinTerrainHeight,s),maximumTerrainHeight:o}},A.getBoundingSphere=function(a,i){i=r.defaultValue(i,t.Ellipsoid.WGS84);var n=N(a),s=A._defaultMaxTerrainHeight;if(r.defined(n)){var o=n.level+"-"+n.x+"-"+n.y,l=A._terrainHeights[o];r.defined(l)&&(s=l[1])}var u=e.BoundingSphere.fromRectangle3D(a,i,0);return e.BoundingSphere.fromRectangle3D(a,i,s,L),e.BoundingSphere.union(u,L,u)},A._terrainHeightsMaxLevel=6,A._defaultMaxTerrainHeight=9e3,A._defaultMinTerrainHeight=-1e5,A._terrainHeights=void 0,A._initPromise=void 0,Object.defineProperties(A,{initialized:{get:function(){return r.defined(A._terrainHeights)}}});var x=[e.GeographicProjection,f.WebMercatorProjection],R=x.length,H=Math.cos(s.CesiumMath.toRadians(30)),V=Math.cos(s.CesiumMath.toRadians(150));function z(e){var a=(e=r.defaultValue(e,r.defaultValue.EMPTY_OBJECT)).positions;this.width=r.defaultValue(e.width,1),this._positions=a,this.granularity=r.defaultValue(e.granularity,9999),this.loop=r.defaultValue(e.loop,!1),this.arcType=r.defaultValue(e.arcType,o.ArcType.GEODESIC),this._ellipsoid=r.defaultValue(e.ellipsoid,t.Ellipsoid.WGS84),this._projectionIndex=0,this._workerName="createGroundPolylineGeometry",this._scene3DOnly=!1}Object.defineProperties(z.prototype,{packedLength:{get:function(){return 1+3*this._positions.length+1+1+1+t.Ellipsoid.packedLength+1+1}}}),z.setProjectionAndEllipsoid=function(e,a){for(var t=0,i=0;i<R;i++)if(a instanceof x[i]){t=i;break}e._projectionIndex=t,e._ellipsoid=a.ellipsoid};var j=new i.Cartesian3,B=new i.Cartesian3,G=new i.Cartesian3;function W(e,a,t,n,r){var s=Q(n,e,0,j),o=Q(n,e,t,B),l=Q(n,a,0,G),u=J(o,s,B),c=J(l,s,G);return i.Cartesian3.cross(c,u,r),i.Cartesian3.normalize(r,r)}var F=new i.Cartographic,Y=new i.Cartesian3,X=new i.Cartesian3,q=new i.Cartesian3;function U(e,a,t,n,r,s,l,u,C,d,p){if(0!==r){var g;s===o.ArcType.GEODESIC?g=new c.EllipsoidGeodesic(e,a,l):s===o.ArcType.RHUMB&&(g=new h.EllipsoidRhumbLine(e,a,l));var m=g.surfaceDistance;if(!(m<r))for(var f=W(e,a,n,l,q),v=Math.ceil(m/r),w=m/v,y=w,_=v-1,T=u.length,M=0;M<_;M++){var E=g.interpolateUsingSurfaceDistance(y,F),b=Q(l,E,t,Y),P=Q(l,E,n,X);i.Cartesian3.pack(f,u,T),i.Cartesian3.pack(b,C,T),i.Cartesian3.pack(P,d,T),p.push(E.latitude),p.push(E.longitude),T+=3,y+=w}}}var Z=new i.Cartographic;function Q(e,a,t,n){return i.Cartographic.clone(a,Z),Z.height=t,i.Cartographic.toCartesian(Z,e,n)}function J(e,a,t){return i.Cartesian3.subtract(e,a,t),i.Cartesian3.normalize(t,t),t}z.pack=function(e,a,n){var s=r.defaultValue(n,0),o=e._positions,l=o.length;a[s++]=l;for(var u=0;u<l;++u){var c=o[u];i.Cartesian3.pack(c,a,s),s+=3}return a[s++]=e.granularity,a[s++]=e.loop?1:0,a[s++]=e.arcType,t.Ellipsoid.pack(e._ellipsoid,a,s),s+=t.Ellipsoid.packedLength,a[s++]=e._projectionIndex,a[s++]=e._scene3DOnly?1:0,a},z.unpack=function(e,a,n){for(var s=r.defaultValue(a,0),o=e[s++],l=new Array(o),u=0;u<o;u++)l[u]=i.Cartesian3.unpack(e,s),s+=3;var c=e[s++],h=1===e[s++],C=e[s++],d=t.Ellipsoid.unpack(e,s);s+=t.Ellipsoid.packedLength;var p=e[s++],g=1===e[s++];if(!r.defined(n)){var m=new z({positions:l,granularity:c,loop:h,arcType:C,ellipsoid:d});return m._projectionIndex=p,m._scene3DOnly=g,m}return n._positions=l,n.granularity=c,n.loop=h,n.arcType=C,n._ellipsoid=d,n._projectionIndex=p,n._scene3DOnly=g,n};var K=new i.Cartesian3,$=new i.Cartesian3,ee=new i.Cartesian3,ae=new i.Cartesian3,te=new g.Plane(i.Cartesian3.UNIT_X,0),ie=new i.Cartesian3;function ne(e,a,t,n,r){var o=J(t,a,ie),l=J(e,a,K),u=J(n,a,$),c=i.Cartesian3.cross(o,l,ae);c=i.Cartesian3.normalize(c,c);var h=g.Plane.fromPointNormal(a,c,te),C=g.Plane.getPointDistance(h,n);if(s.CesiumMath.equalsEpsilon(C,0,s.CesiumMath.EPSILON7))return i.Cartesian3.clone(c,r),r;r=i.Cartesian3.add(u,l,r),r=i.Cartesian3.normalize(r,r);var d=i.Cartesian3.cross(o,r,ee);return i.Cartesian3.normalize(d,d),i.Cartesian3.cross(d,o,r),i.Cartesian3.normalize(r,r),i.Cartesian3.dot(u,d)<0&&(r=i.Cartesian3.negate(r,r)),r}var re=g.Plane.fromPointNormal(i.Cartesian3.ZERO,i.Cartesian3.UNIT_Y),se=new i.Cartesian3,oe=new i.Cartesian3,le=new i.Cartesian3,ue=new i.Cartesian3,ce=new i.Cartesian3,he=new i.Cartesian3,Ce=new i.Cartographic,de=new i.Cartographic,pe=new i.Cartographic;z.createGeometry=function(a){var n,c,g,m,f,v,w=!a._scene3DOnly,y=a.loop,_=a._ellipsoid,T=a.granularity,M=a.arcType,E=new x[a._projectionIndex](_),b=1e3,P=a._positions,O=P.length;2===O&&(y=!1);var I,L,S,D=new h.EllipsoidRhumbLine(void 0,void 0,_),k=[P[0]];for(c=0;c<O-1;c++)g=P[c],m=P[c+1],I=p.IntersectionTests.lineSegmentPlane(g,m,re,he),!r.defined(I)||i.Cartesian3.equalsEpsilon(I,g,s.CesiumMath.EPSILON7)||i.Cartesian3.equalsEpsilon(I,m,s.CesiumMath.EPSILON7)||(a.arcType===o.ArcType.GEODESIC?k.push(i.Cartesian3.clone(I)):a.arcType===o.ArcType.RHUMB&&(S=_.cartesianToCartographic(I,Ce).longitude,f=_.cartesianToCartographic(g,Ce),v=_.cartesianToCartographic(m,de),D.setEndPoints(f,v),L=D.findIntersectionWithLongitude(S,pe),I=_.cartographicToCartesian(L,he),!r.defined(I)||i.Cartesian3.equalsEpsilon(I,g,s.CesiumMath.EPSILON7)||i.Cartesian3.equalsEpsilon(I,m,s.CesiumMath.EPSILON7)||k.push(i.Cartesian3.clone(I)))),k.push(m);y&&(g=P[O-1],m=P[0],I=p.IntersectionTests.lineSegmentPlane(g,m,re,he),!r.defined(I)||i.Cartesian3.equalsEpsilon(I,g,s.CesiumMath.EPSILON7)||i.Cartesian3.equalsEpsilon(I,m,s.CesiumMath.EPSILON7)||(a.arcType===o.ArcType.GEODESIC?k.push(i.Cartesian3.clone(I)):a.arcType===o.ArcType.RHUMB&&(S=_.cartesianToCartographic(I,Ce).longitude,f=_.cartesianToCartographic(g,Ce),v=_.cartesianToCartographic(m,de),D.setEndPoints(f,v),L=D.findIntersectionWithLongitude(S,pe),I=_.cartographicToCartesian(L,he),!r.defined(I)||i.Cartesian3.equalsEpsilon(I,g,s.CesiumMath.EPSILON7)||i.Cartesian3.equalsEpsilon(I,m,s.CesiumMath.EPSILON7)||k.push(i.Cartesian3.clone(I)))));var N=k.length,R=new Array(N);for(c=0;c<N;c++){var V=i.Cartographic.fromCartesian(k[c],_);V.height=0,R[c]=V}if(!((N=(R=l.arrayRemoveDuplicates(R,i.Cartographic.equalsEpsilon)).length)<2)){var z=[],j=[],B=[],G=[],F=se,Y=oe,X=le,q=ue,Z=ce,K=R[0],$=R[1];for(F=Q(_,R[N-1],0,F),q=Q(_,$,0,q),Y=Q(_,K,0,Y),X=Q(_,K,b,X),Z=y?ne(F,Y,X,q,Z):W(K,$,b,_,Z),i.Cartesian3.pack(Z,j,0),i.Cartesian3.pack(Y,B,0),i.Cartesian3.pack(X,G,0),z.push(K.latitude),z.push(K.longitude),U(K,$,0,b,T,M,_,j,B,G,z),c=1;c<N-1;++c){F=i.Cartesian3.clone(Y,F),Y=i.Cartesian3.clone(q,Y);var ee=R[c];Q(_,ee,b,X),Q(_,R[c+1],0,q),ne(F,Y,X,q,Z),n=j.length,i.Cartesian3.pack(Z,j,n),i.Cartesian3.pack(Y,B,n),i.Cartesian3.pack(X,G,n),z.push(ee.latitude),z.push(ee.longitude),U(R[c],R[c+1],0,b,T,M,_,j,B,G,z)}var ae=R[N-1],te=R[N-2];if(Y=Q(_,ae,0,Y),X=Q(_,ae,b,X),y){var ie=R[0];Z=ne(F=Q(_,te,0,F),Y,X,q=Q(_,ie,0,q),Z)}else Z=W(te,ae,b,_,Z);if(n=j.length,i.Cartesian3.pack(Z,j,n),i.Cartesian3.pack(Y,B,n),i.Cartesian3.pack(X,G,n),z.push(ae.latitude),z.push(ae.longitude),y){for(U(ae,K,0,b,T,M,_,j,B,G,z),n=j.length,c=0;c<3;++c)j[n+c]=j[c],B[n+c]=B[c],G[n+c]=G[c];z.push(K.latitude),z.push(K.longitude)}return function(a,n,r,o,l,c,h){var p,g,m,f,v,w,y=n._ellipsoid,_=r.length/3-1,T=8*_,M=4*T,E=36*_,b=T>65535?new Uint32Array(E):new Uint16Array(E),P=new Float64Array(3*T),O=new Float32Array(M),I=new Float32Array(M),L=new Float32Array(M),S=new Float32Array(M),D=new Float32Array(M);h&&(m=new Float32Array(M),f=new Float32Array(M),v=new Float32Array(M),w=new Float32Array(2*T));var k=c.length/2,N=0,x=Le;x.height=0;var R=Se;R.height=0;var V=De,z=ke;if(h)for(g=0,p=1;p<k;p++)x.latitude=c[g],x.longitude=c[g+1],R.latitude=c[g+2],R.longitude=c[g+3],V=n.project(x,V),z=n.project(R,z),N+=i.Cartesian3.distance(V,z),g+=2;var j=o.length/3;z=i.Cartesian3.unpack(o,0,z);var B,G=0;for(g=3,p=1;p<j;p++)V=i.Cartesian3.clone(z,V),z=i.Cartesian3.unpack(o,g,z),G+=i.Cartesian3.distance(V,z),g+=3;g=3;var W=0,F=0,Y=0,X=0,q=!1,U=i.Cartesian3.unpack(r,0,Ne),Z=i.Cartesian3.unpack(o,0,ke),Q=i.Cartesian3.unpack(l,0,Re);if(a){ve(Q,i.Cartesian3.unpack(r,r.length-6,Ae),U,Z)&&(Q=i.Cartesian3.negate(Q,Q))}var K=0,$=0,ee=0;for(p=0;p<_;p++){var ae,te,ie,ne,re=i.Cartesian3.clone(U,Ae),se=i.Cartesian3.clone(Z,De),oe=i.Cartesian3.clone(Q,xe);if(q&&(oe=i.Cartesian3.negate(oe,oe)),U=i.Cartesian3.unpack(r,g,Ne),Z=i.Cartesian3.unpack(o,g,ke),q=ve(Q=i.Cartesian3.unpack(l,g,Re),re,U,Z),x.latitude=c[W],x.longitude=c[W+1],R.latitude=c[W+2],R.longitude=c[W+3],h){var le=Ie(x,R);ae=n.project(x,We);var ue=J(te=n.project(R,Fe),ae,aa);ue.y=Math.abs(ue.y),ie=Ye,ne=Xe,0===le||i.Cartesian3.dot(ue,i.Cartesian3.UNIT_Y)>H?(ie=Te(n,x,oe,ae,Ye),ne=Te(n,R,Q,te,Xe)):1===le?(ne=Te(n,R,Q,te,Xe),ie.x=0,ie.y=s.CesiumMath.sign(x.longitude-Math.abs(R.longitude)),ie.z=0):(ie=Te(n,x,oe,ae,Ye),ne.x=0,ne.y=s.CesiumMath.sign(x.longitude-R.longitude),ne.z=0)}var ce=i.Cartesian3.distance(se,Z),he=C.EncodedCartesian3.fromCartesian(re,$e),Ce=i.Cartesian3.subtract(U,re,qe),de=i.Cartesian3.normalize(Ce,Qe),pe=i.Cartesian3.subtract(se,re,Ue);pe=i.Cartesian3.normalize(pe,pe);var ge=i.Cartesian3.cross(de,pe,Qe);ge=i.Cartesian3.normalize(ge,ge);var me=i.Cartesian3.cross(pe,oe,Je);me=i.Cartesian3.normalize(me,me);var fe=i.Cartesian3.subtract(Z,U,Ze);fe=i.Cartesian3.normalize(fe,fe);var we=i.Cartesian3.cross(Q,fe,Ke);we=i.Cartesian3.normalize(we,we);var ye,_e,Me,Ee=ce/G,Pe=K/G,la=0,ua=0,ca=0;if(h){la=i.Cartesian3.distance(ae,te),ye=C.EncodedCartesian3.fromCartesian(ae,ea),_e=i.Cartesian3.subtract(te,ae,aa);var ha=(Me=i.Cartesian3.normalize(_e,ta)).x;Me.x=Me.y,Me.y=-ha,ua=la/N,ca=$/N}for(B=0;B<8;B++){var Ca=X+4*B,da=F+2*B,pa=Ca+3,ga=B<4?1:-1,ma=2===B||3===B||6===B||7===B?1:-1;i.Cartesian3.pack(he.high,O,Ca),O[pa]=Ce.x,i.Cartesian3.pack(he.low,I,Ca),I[pa]=Ce.y,i.Cartesian3.pack(me,L,Ca),L[pa]=Ce.z,i.Cartesian3.pack(we,S,Ca),S[pa]=Ee*ga,i.Cartesian3.pack(ge,D,Ca);var fa=Pe*ma;0===fa&&ma<0&&(fa=Number.POSITIVE_INFINITY),D[pa]=fa,h&&(m[Ca]=ye.high.x,m[Ca+1]=ye.high.y,m[Ca+2]=ye.low.x,m[Ca+3]=ye.low.y,v[Ca]=-ie.y,v[Ca+1]=ie.x,v[Ca+2]=ne.y,v[Ca+3]=-ne.x,f[Ca]=_e.x,f[Ca+1]=_e.y,f[Ca+2]=Me.x,f[Ca+3]=Me.y,w[da]=ua*ga,0===(fa=ca*ma)&&ma<0&&(fa=Number.POSITIVE_INFINITY),w[da+1]=fa)}var va=Be,wa=Ge,ya=ze,_a=je,Ta=t.Rectangle.fromCartographicArray(He,Ve),Ma=A.getMinimumMaximumHeights(Ta,y),Ea=Ma.minimumTerrainHeight,ba=Ma.maximumTerrainHeight;ee+=Ea,ee+=ba,be(re,se,Ea,ba,va,ya),be(U,Z,Ea,ba,wa,_a);var Pa=i.Cartesian3.multiplyByScalar(ge,s.CesiumMath.EPSILON5,ia);i.Cartesian3.add(va,Pa,va),i.Cartesian3.add(wa,Pa,wa),i.Cartesian3.add(ya,Pa,ya),i.Cartesian3.add(_a,Pa,_a),Oe(va,wa),Oe(ya,_a),i.Cartesian3.pack(va,P,Y),i.Cartesian3.pack(wa,P,Y+3),i.Cartesian3.pack(_a,P,Y+6),i.Cartesian3.pack(ya,P,Y+9),Pa=i.Cartesian3.multiplyByScalar(ge,-2*s.CesiumMath.EPSILON5,ia),i.Cartesian3.add(va,Pa,va),i.Cartesian3.add(wa,Pa,wa),i.Cartesian3.add(ya,Pa,ya),i.Cartesian3.add(_a,Pa,_a),Oe(va,wa),Oe(ya,_a),i.Cartesian3.pack(va,P,Y+12),i.Cartesian3.pack(wa,P,Y+15),i.Cartesian3.pack(_a,P,Y+18),i.Cartesian3.pack(ya,P,Y+21),W+=2,g+=3,F+=16,Y+=24,X+=32,K+=ce,$+=la}g=0;var Oa=0;for(p=0;p<_;p++){for(B=0;B<sa;B++)b[g+B]=ra[B]+Oa;Oa+=8,g+=sa}var Ia=na;e.BoundingSphere.fromVertices(r,i.Cartesian3.ZERO,3,Ia[0]),e.BoundingSphere.fromVertices(o,i.Cartesian3.ZERO,3,Ia[1]);var La=e.BoundingSphere.fromBoundingSpheres(Ia);La.radius+=ee/(2*_);var Sa={position:new d.GeometryAttribute({componentDatatype:u.ComponentDatatype.DOUBLE,componentsPerAttribute:3,normalize:!1,values:P}),startHiAndForwardOffsetX:oa(O),startLoAndForwardOffsetY:oa(I),startNormalAndForwardOffsetZ:oa(L),endNormalAndTextureCoordinateNormalizationX:oa(S),rightNormalAndTextureCoordinateNormalizationY:oa(D)};h&&(Sa.startHiLo2D=oa(m),Sa.offsetAndRight2D=oa(f),Sa.startEndNormals2D=oa(v),Sa.texcoordNormalization2D=new d.GeometryAttribute({componentDatatype:u.ComponentDatatype.FLOAT,componentsPerAttribute:2,normalize:!1,values:w}));return new d.Geometry({attributes:Sa,indices:b,boundingSphere:La})}(y,E,B,G,j,z,w)}};var ge=new i.Cartesian3,me=new e.Matrix3,fe=new m.Quaternion;function ve(a,t,n,r){var o=J(n,t,ge),l=i.Cartesian3.dot(o,a);if(l>H||l<V){var u=J(r,n,ie),c=l<V?s.CesiumMath.PI_OVER_TWO:-s.CesiumMath.PI_OVER_TWO,h=m.Quaternion.fromAxisAngle(u,c,fe),C=e.Matrix3.fromQuaternion(h,me);return e.Matrix3.multiplyByVector(C,a,a),!0}return!1}var we=new i.Cartographic,ye=new i.Cartesian3,_e=new i.Cartesian3;function Te(e,a,t,n,r){var o=i.Cartographic.toCartesian(a,e._ellipsoid,ye),l=i.Cartesian3.add(o,t,_e),u=!1,c=e._ellipsoid,h=c.cartesianToCartographic(l,we);Math.abs(a.longitude-h.longitude)>s.CesiumMath.PI_OVER_TWO&&(u=!0,l=i.Cartesian3.subtract(o,t,_e),h=c.cartesianToCartographic(l,we)),h.height=0;var C=e.project(h,r);return(r=i.Cartesian3.subtract(C,n,r)).z=0,r=i.Cartesian3.normalize(r,r),u&&i.Cartesian3.negate(r,r),r}var Me=new i.Cartesian3,Ee=new i.Cartesian3;function be(e,a,t,n,r,s){var o=i.Cartesian3.subtract(a,e,Me);i.Cartesian3.normalize(o,o);var l=t-0,u=i.Cartesian3.multiplyByScalar(o,l,Ee);i.Cartesian3.add(e,u,r);var c=n-1e3;u=i.Cartesian3.multiplyByScalar(o,c,Ee),i.Cartesian3.add(a,u,s)}var Pe=new i.Cartesian3;function Oe(e,a){var t=g.Plane.getPointDistance(re,e),n=g.Plane.getPointDistance(re,a),r=Pe;s.CesiumMath.equalsEpsilon(t,0,s.CesiumMath.EPSILON2)?(r=J(a,e,r),i.Cartesian3.multiplyByScalar(r,s.CesiumMath.EPSILON2,r),i.Cartesian3.add(e,r,e)):s.CesiumMath.equalsEpsilon(n,0,s.CesiumMath.EPSILON2)&&(r=J(e,a,r),i.Cartesian3.multiplyByScalar(r,s.CesiumMath.EPSILON2,r),i.Cartesian3.add(a,r,a))}function Ie(e,a){var t=Math.abs(e.longitude),i=Math.abs(a.longitude);if(s.CesiumMath.equalsEpsilon(t,s.CesiumMath.PI,s.CesiumMath.EPSILON11)){var n=s.CesiumMath.sign(a.longitude);return e.longitude=n*(t-s.CesiumMath.EPSILON11),1}if(s.CesiumMath.equalsEpsilon(i,s.CesiumMath.PI,s.CesiumMath.EPSILON11)){var r=s.CesiumMath.sign(e.longitude);return a.longitude=r*(i-s.CesiumMath.EPSILON11),2}return 0}var Le=new i.Cartographic,Se=new i.Cartographic,De=new i.Cartesian3,ke=new i.Cartesian3,Ae=new i.Cartesian3,Ne=new i.Cartesian3,xe=new i.Cartesian3,Re=new i.Cartesian3,He=[Le,Se],Ve=new t.Rectangle,ze=new i.Cartesian3,je=new i.Cartesian3,Be=new i.Cartesian3,Ge=new i.Cartesian3,We=new i.Cartesian3,Fe=new i.Cartesian3,Ye=new i.Cartesian3,Xe=new i.Cartesian3,qe=new i.Cartesian3,Ue=new i.Cartesian3,Ze=new i.Cartesian3,Qe=new i.Cartesian3,Je=new i.Cartesian3,Ke=new i.Cartesian3,$e=new C.EncodedCartesian3,ea=new C.EncodedCartesian3,aa=new i.Cartesian3,ta=new i.Cartesian3,ia=new i.Cartesian3,na=[new e.BoundingSphere,new e.BoundingSphere],ra=[0,2,1,0,3,2,0,7,3,0,4,7,0,5,4,0,1,5,5,7,4,5,6,7,5,2,6,5,1,2,3,6,2,3,7,6],sa=ra.length;function oa(e){return new d.GeometryAttribute({componentDatatype:u.ComponentDatatype.FLOAT,componentsPerAttribute:4,normalize:!1,values:e})}return z._projectNormal=Te,function(e,a){return A.initialize().then((function(){return r.defined(a)&&(e=z.unpack(e,a)),z.createGeometry(e)}))}}));