Files
4.0/static/sdk/Cesium/Workers/createGroundPolylineGeometry.js
2025-07-03 17:39:09 +08:00

26 lines
20 KiB
JavaScript

/**
* @license
* Cesium - https://github.com/CesiumGS/cesium
* Version 1.98
*
* 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(["./Transforms-c9e418cb","./Matrix2-cf4c6e69","./defaultValue-50f7432c","./ComponentDatatype-9b23164a","./ArcType-24f44850","./arrayRemoveDuplicates-fd3a3f4e","./EllipsoidGeodesic-759beff8","./EllipsoidRhumbLine-0cc30625","./EncodedCartesian3-0b8c686b","./GeometryAttribute-b84ffce6","./IntersectionTests-d662a125","./Plane-b9f0711b","./WebMercatorProjection-019b6547","./combine-8462e002","./RuntimeError-48e1f06d","./WebGLConstants-58abc51a"],(function(e,t,a,n,i,r,s,o,l,c,u,C,d,h,p,f){"use strict";function g(n){n=a.defaultValue(n,a.defaultValue.EMPTY_OBJECT),a.defined(n.tileInfo)&&a.defined(n.tileInfo.spatialReference)&&a.defined(n.tileInfo.spatialReference.wkid)&&4490==n.tileInfo.spatialReference.wkid?(this._tileInfo=n.tileInfo,this._ellipsoid=a.defaultValue(n.ellipsoid,t.Ellipsoid.CGCS2000),this._rectangle=a.defaultValue(n.rectangle,t.Rectangle.fromDegrees(-180,-90,180,90)),this._numberOfLevelZeroTilesX=a.defaultValue(n.numberOfLevelZeroTilesX,4),this._numberOfLevelZeroTilesY=a.defaultValue(n.numberOfLevelZeroTilesY,2)):(this._ellipsoid=a.defaultValue(n.ellipsoid,t.Ellipsoid.WGS84),this._rectangle=a.defaultValue(n.rectangle,t.Rectangle.MAX_VALUE),this._numberOfLevelZeroTilesX=a.defaultValue(n.numberOfLevelZeroTilesX,2),this._numberOfLevelZeroTilesY=a.defaultValue(n.numberOfLevelZeroTilesY,1)),this._projection=new e.GeographicProjection(this._ellipsoid)}Object.defineProperties(g.prototype,{ellipsoid:{get:function(){return this._ellipsoid}},rectangle:{get:function(){return this._rectangle}},projection:{get:function(){return this._projection}}}),g.prototype.getNumberOfXTilesAtLevel=function(e){if(a.defined(this._tileInfo)){var t=this._tileInfo.lods.filter((function(t){return t.level===e}))[0].resolution;return Math.round(n.CesiumMath.toDegrees(n.CesiumMath.TWO_PI)/(this._tileInfo.rows*t))}return this._numberOfLevelZeroTilesX<<e},g.prototype.getNumberOfYTilesAtLevel=function(e){if(a.defined(this._tileInfo)){var t=this._tileInfo.lods.filter((function(t){return t.level===e}))[0].resolution;return Math.round(n.CesiumMath.toDegrees(n.CesiumMath.TWO_PI/2)/(this._tileInfo.cols*t))}return this._numberOfLevelZeroTilesY<<e},g.prototype.rectangleToNativeRectangle=function(e,i){const r=n.CesiumMath.toDegrees(e.west),s=n.CesiumMath.toDegrees(e.south),o=n.CesiumMath.toDegrees(e.east),l=n.CesiumMath.toDegrees(e.north);return a.defined(i)?(i.west=r,i.south=s,i.east=o,i.north=l,i):new t.Rectangle(r,s,o,l)},g.prototype.tileXYToNativeRectangle=function(e,t,a,i){const r=this.tileXYToRectangle(e,t,a,i);return r.west=n.CesiumMath.toDegrees(r.west),r.south=n.CesiumMath.toDegrees(r.south),r.east=n.CesiumMath.toDegrees(r.east),r.north=n.CesiumMath.toDegrees(r.north),r},g.prototype.tileXYToRectangle=function(e,n,i,r){const s=this._rectangle,o=this.getNumberOfXTilesAtLevel(i),l=this.getNumberOfYTilesAtLevel(i),c=s.width/o,u=e*c+s.west,C=(e+1)*c+s.west,d=s.height/l,h=s.north-n*d,p=s.north-(n+1)*d;return a.defined(r)||(r=new t.Rectangle(u,p,C,h)),r.west=u,r.south=p,r.east=C,r.north=h,r},g.prototype.positionToTileXY=function(e,i,r){const s=this._rectangle;if(!t.Rectangle.contains(s,e))return;const o=this.getNumberOfXTilesAtLevel(i),l=this.getNumberOfYTilesAtLevel(i),c=s.width/o,u=s.height/l;let C=e.longitude;s.east<s.west&&(C+=n.CesiumMath.TWO_PI);let d=(C-s.west)/c|0;d>=o&&(d=o-1);let h=(s.north-e.latitude)/u|0;return h>=l&&(h=l-1),a.defined(r)?(r.x=d,r.y=h,r):new t.Cartesian2(d,h)};const m=new t.Cartesian3,w=new t.Cartesian3,y=new t.Cartographic,M=new t.Cartesian3,T=new t.Cartesian3,_=new e.BoundingSphere,E=new g,O=[new t.Cartographic,new t.Cartographic,new t.Cartographic,new t.Cartographic],b=new t.Cartesian2,I={};function P(e){t.Cartographic.fromRadians(e.east,e.north,0,O[0]),t.Cartographic.fromRadians(e.west,e.north,0,O[1]),t.Cartographic.fromRadians(e.east,e.south,0,O[2]),t.Cartographic.fromRadians(e.west,e.south,0,O[3]);let a=0,n=0,i=0,r=0;const s=I._terrainHeightsMaxLevel;let o;for(o=0;o<=s;++o){let e=!1;for(let t=0;t<4;++t){const a=O[t];if(E.positionToTileXY(a,o,b),0===t)i=b.x,r=b.y;else if(i!==b.x||r!==b.y){e=!0;break}}if(e)break;a=i,n=r}if(0!==o)return{x:a,y:n,level:o>s?s:o-1}}I.initialize=function(){let t=I._initPromise;return a.defined(t)||(t=e.Resource.fetchJson(e.buildModuleUrl("Assets/approximateTerrainHeights.json")).then((function(e){I._terrainHeights=e})),I._initPromise=t),t},I.getMinimumMaximumHeights=function(e,n){n=a.defaultValue(n,t.Ellipsoid.WGS84);const i=P(e);let r=I._defaultMinTerrainHeight,s=I._defaultMaxTerrainHeight;if(a.defined(i)){const o=`${i.level}-${i.x}-${i.y}`,l=I._terrainHeights[o];a.defined(l)&&(r=l[0],s=l[1]),n.cartographicToCartesian(t.Rectangle.northeast(e,y),m),n.cartographicToCartesian(t.Rectangle.southwest(e,y),w),t.Cartesian3.midpoint(w,m,M);const c=n.scaleToGeodeticSurface(M,T);if(a.defined(c)){const e=t.Cartesian3.distance(M,c);r=Math.min(r,-e)}else r=I._defaultMinTerrainHeight}return r=Math.max(I._defaultMinTerrainHeight,r),{minimumTerrainHeight:r,maximumTerrainHeight:s}},I.getBoundingSphere=function(n,i){i=a.defaultValue(i,t.Ellipsoid.WGS84);const r=P(n);let s=I._defaultMaxTerrainHeight;if(a.defined(r)){const e=`${r.level}-${r.x}-${r.y}`,t=I._terrainHeights[e];a.defined(t)&&(s=t[1])}const o=e.BoundingSphere.fromRectangle3D(n,i,0);return e.BoundingSphere.fromRectangle3D(n,i,s,_),e.BoundingSphere.union(o,_,o)},I._terrainHeightsMaxLevel=6,I._defaultMaxTerrainHeight=9e3,I._defaultMinTerrainHeight=-1e5,I._terrainHeights=void 0,I._initPromise=void 0,Object.defineProperties(I,{initialized:{get:function(){return a.defined(I._terrainHeights)}}});var L=I;const k=[e.GeographicProjection,d.WebMercatorProjection],A=k.length,S=Math.cos(n.CesiumMath.toRadians(30)),x=Math.cos(n.CesiumMath.toRadians(150)),R=0,D=1e3;function N(e){const n=(e=a.defaultValue(e,a.defaultValue.EMPTY_OBJECT)).positions;this.width=a.defaultValue(e.width,1),this._positions=n,this.granularity=a.defaultValue(e.granularity,9999),this.loop=a.defaultValue(e.loop,!1),this.arcType=a.defaultValue(e.arcType,i.ArcType.GEODESIC),this._ellipsoid=t.Ellipsoid.WGS84,this._projectionIndex=0,this._workerName="createGroundPolylineGeometry",this._scene3DOnly=!1}Object.defineProperties(N.prototype,{packedLength:{get:function(){return 1+3*this._positions.length+1+1+1+t.Ellipsoid.packedLength+1+1}}}),N.setProjectionAndEllipsoid=function(e,t){let a=0;for(let e=0;e<A;e++)if(t instanceof k[e]){a=e;break}e._projectionIndex=a,e._ellipsoid=t.ellipsoid};const v=new t.Cartesian3,V=new t.Cartesian3,z=new t.Cartesian3;function H(e,a,n,i,r){const s=W(i,e,0,v),o=W(i,e,n,V),l=W(i,a,0,z),c=q(o,s,V),u=q(l,s,z);return t.Cartesian3.cross(u,c,r),t.Cartesian3.normalize(r,r)}const B=new t.Cartographic,G=new t.Cartesian3,j=new t.Cartesian3,Y=new t.Cartesian3;function X(e,a,n,r,l,c,u,C,d,h,p){if(0===l)return;let f;c===i.ArcType.GEODESIC?f=new s.EllipsoidGeodesic(e,a,u):c===i.ArcType.RHUMB&&(f=new o.EllipsoidRhumbLine(e,a,u));const g=f.surfaceDistance;if(g<l)return;const m=H(e,a,r,u,Y),w=Math.ceil(g/l),y=g/w;let M=y;const T=w-1;let _=C.length;for(let e=0;e<T;e++){const e=f.interpolateUsingSurfaceDistance(M,B),a=W(u,e,n,G),i=W(u,e,r,j);t.Cartesian3.pack(m,C,_),t.Cartesian3.pack(a,d,_),t.Cartesian3.pack(i,h,_),p.push(e.latitude),p.push(e.longitude),_+=3,M+=y}}const F=new t.Cartographic;function W(e,a,n,i){return t.Cartographic.clone(a,F),F.height=n,t.Cartographic.toCartesian(F,e,i)}function q(e,a,n){return t.Cartesian3.subtract(e,a,n),t.Cartesian3.normalize(n,n),n}function Z(e,a,n,i){return i=q(e,a,i),i=t.Cartesian3.cross(i,n,i),i=t.Cartesian3.normalize(i,i),i=t.Cartesian3.cross(n,i,i)}N.pack=function(e,n,i){let r=a.defaultValue(i,0);const s=e._positions,o=s.length;n[r++]=o;for(let e=0;e<o;++e){const a=s[e];t.Cartesian3.pack(a,n,r),r+=3}return n[r++]=e.granularity,n[r++]=e.loop?1:0,n[r++]=e.arcType,t.Ellipsoid.pack(e._ellipsoid,n,r),r+=t.Ellipsoid.packedLength,n[r++]=e._projectionIndex,n[r++]=e._scene3DOnly?1:0,n},N.unpack=function(e,n,i){let r=a.defaultValue(n,0);const s=e[r++],o=new Array(s);for(let a=0;a<s;a++)o[a]=t.Cartesian3.unpack(e,r),r+=3;const l=e[r++],c=1===e[r++],u=e[r++],C=t.Ellipsoid.unpack(e,r);r+=t.Ellipsoid.packedLength;const d=e[r++],h=1===e[r++];return a.defined(i)||(i=new N({positions:o})),i._positions=o,i.granularity=l,i.loop=c,i.arcType=u,i._ellipsoid=C,i._projectionIndex=d,i._scene3DOnly=h,i};const U=new t.Cartesian3,$=new t.Cartesian3,J=new t.Cartesian3,Q=new t.Cartesian3;function K(e,a,i,r,s){const o=q(i,a,Q),l=Z(e,a,o,U),c=Z(r,a,o,$);if(n.CesiumMath.equalsEpsilon(t.Cartesian3.dot(l,c),-1,n.CesiumMath.EPSILON5))return s=t.Cartesian3.cross(o,l,s),s=t.Cartesian3.normalize(s,s);s=t.Cartesian3.add(c,l,s),s=t.Cartesian3.normalize(s,s);const u=t.Cartesian3.cross(o,s,J);return t.Cartesian3.dot(c,u)<0&&(s=t.Cartesian3.negate(s,s)),s}const ee=C.Plane.fromPointNormal(t.Cartesian3.ZERO,t.Cartesian3.UNIT_Y),te=new t.Cartesian3,ae=new t.Cartesian3,ne=new t.Cartesian3,ie=new t.Cartesian3,re=new t.Cartesian3,se=new t.Cartesian3,oe=new t.Cartographic,le=new t.Cartographic,ce=new t.Cartographic;N.createGeometry=function(s){const C=!s._scene3DOnly;let d=s.loop;const h=s._ellipsoid,p=s.granularity,f=s.arcType,g=new k[s._projectionIndex](h),m=R,w=D;let y,M;const T=s._positions,_=T.length;let E,O,b,I;2===_&&(d=!1);const P=new o.EllipsoidRhumbLine(void 0,void 0,h);let A,x,N;const v=[T[0]];for(M=0;M<_-1;M++)E=T[M],O=T[M+1],A=u.IntersectionTests.lineSegmentPlane(E,O,ee,se),!a.defined(A)||t.Cartesian3.equalsEpsilon(A,E,n.CesiumMath.EPSILON7)||t.Cartesian3.equalsEpsilon(A,O,n.CesiumMath.EPSILON7)||(s.arcType===i.ArcType.GEODESIC?v.push(t.Cartesian3.clone(A)):s.arcType===i.ArcType.RHUMB&&(N=h.cartesianToCartographic(A,oe).longitude,b=h.cartesianToCartographic(E,oe),I=h.cartesianToCartographic(O,le),P.setEndPoints(b,I),x=P.findIntersectionWithLongitude(N,ce),A=h.cartographicToCartesian(x,se),!a.defined(A)||t.Cartesian3.equalsEpsilon(A,E,n.CesiumMath.EPSILON7)||t.Cartesian3.equalsEpsilon(A,O,n.CesiumMath.EPSILON7)||v.push(t.Cartesian3.clone(A)))),v.push(O);d&&(E=T[_-1],O=T[0],A=u.IntersectionTests.lineSegmentPlane(E,O,ee,se),!a.defined(A)||t.Cartesian3.equalsEpsilon(A,E,n.CesiumMath.EPSILON7)||t.Cartesian3.equalsEpsilon(A,O,n.CesiumMath.EPSILON7)||(s.arcType===i.ArcType.GEODESIC?v.push(t.Cartesian3.clone(A)):s.arcType===i.ArcType.RHUMB&&(N=h.cartesianToCartographic(A,oe).longitude,b=h.cartesianToCartographic(E,oe),I=h.cartesianToCartographic(O,le),P.setEndPoints(b,I),x=P.findIntersectionWithLongitude(N,ce),A=h.cartographicToCartesian(x,se),!a.defined(A)||t.Cartesian3.equalsEpsilon(A,E,n.CesiumMath.EPSILON7)||t.Cartesian3.equalsEpsilon(A,O,n.CesiumMath.EPSILON7)||v.push(t.Cartesian3.clone(A)))));let V=v.length,z=new Array(V);for(M=0;M<V;M++){const e=t.Cartographic.fromCartesian(v[M],h);e.height=0,z[M]=e}if(z=r.arrayRemoveDuplicates(z,t.Cartographic.equalsEpsilon),V=z.length,V<2)return;const B=[],G=[],j=[],Y=[];let F=te,Z=ae,U=ne,$=ie,J=re;const Q=z[0],ue=z[1];for(F=W(h,z[V-1],m,F),$=W(h,ue,m,$),Z=W(h,Q,m,Z),U=W(h,Q,w,U),J=d?K(F,Z,U,$,J):H(Q,ue,w,h,J),t.Cartesian3.pack(J,G,0),t.Cartesian3.pack(Z,j,0),t.Cartesian3.pack(U,Y,0),B.push(Q.latitude),B.push(Q.longitude),X(Q,ue,m,w,p,f,h,G,j,Y,B),M=1;M<V-1;++M){F=t.Cartesian3.clone(Z,F),Z=t.Cartesian3.clone($,Z);const e=z[M];W(h,e,w,U),W(h,z[M+1],m,$),K(F,Z,U,$,J),y=G.length,t.Cartesian3.pack(J,G,y),t.Cartesian3.pack(Z,j,y),t.Cartesian3.pack(U,Y,y),B.push(e.latitude),B.push(e.longitude),X(z[M],z[M+1],m,w,p,f,h,G,j,Y,B)}const Ce=z[V-1],de=z[V-2];if(Z=W(h,Ce,m,Z),U=W(h,Ce,w,U),d){const e=z[0];F=W(h,de,m,F),$=W(h,e,m,$),J=K(F,Z,U,$,J)}else J=H(de,Ce,w,h,J);if(y=G.length,t.Cartesian3.pack(J,G,y),t.Cartesian3.pack(Z,j,y),t.Cartesian3.pack(U,Y,y),B.push(Ce.latitude),B.push(Ce.longitude),d){for(X(Ce,Q,m,w,p,f,h,G,j,Y,B),y=G.length,M=0;M<3;++M)G[y+M]=G[M],j[y+M]=j[M],Y[y+M]=Y[M];B.push(Q.latitude),B.push(Q.longitude)}return function(a,i,r,s,o,u,C){let d,h;const p=i._ellipsoid,f=r.length/3-1,g=8*f,m=4*g,w=36*f,y=g>65535?new Uint32Array(w):new Uint16Array(w),M=new Float64Array(3*g),T=new Float32Array(m),_=new Float32Array(m),E=new Float32Array(m),O=new Float32Array(m),b=new Float32Array(m);let I,P,k,A;C&&(I=new Float32Array(m),P=new Float32Array(m),k=new Float32Array(m),A=new Float32Array(2*g));const x=u.length/2;let R=0;const D=Oe;D.height=0;const N=be;N.height=0;let v=Ie,V=Pe;if(C)for(h=0,d=1;d<x;d++)D.latitude=u[h],D.longitude=u[h+1],N.latitude=u[h+2],N.longitude=u[h+3],v=i.project(D,v),V=i.project(N,V),R+=t.Cartesian3.distance(v,V),h+=2;const z=s.length/3;V=t.Cartesian3.unpack(s,0,V);let H,B=0;for(h=3,d=1;d<z;d++)v=t.Cartesian3.clone(V,v),V=t.Cartesian3.unpack(s,h,V),B+=t.Cartesian3.distance(v,V),h+=3;h=3;let G=0,j=0,Y=0,X=0,F=!1,W=t.Cartesian3.unpack(r,0,ke),Z=t.Cartesian3.unpack(s,0,Pe),U=t.Cartesian3.unpack(o,0,Se);if(a){he(U,t.Cartesian3.unpack(r,r.length-6,Le),W,Z)&&(U=t.Cartesian3.negate(U,U))}let $=0,J=0,Q=0;for(d=0;d<f;d++){const e=t.Cartesian3.clone(W,Le),a=t.Cartesian3.clone(Z,Ie);let c,d,f,g,m=t.Cartesian3.clone(U,Ae);if(F&&(m=t.Cartesian3.negate(m,m)),W=t.Cartesian3.unpack(r,h,ke),Z=t.Cartesian3.unpack(s,h,Pe),U=t.Cartesian3.unpack(o,h,Se),F=he(U,e,W,Z),D.latitude=u[G],D.longitude=u[G+1],N.latitude=u[G+2],N.longitude=u[G+3],C){const e=Ee(D,N);c=i.project(D,ze),d=i.project(N,He);const a=q(d,c,$e);a.y=Math.abs(a.y),f=Be,g=Ge,0===e||t.Cartesian3.dot(a,t.Cartesian3.UNIT_Y)>S?(f=me(i,D,m,c,Be),g=me(i,N,U,d,Ge)):1===e?(g=me(i,N,U,d,Ge),f.x=0,f.y=n.CesiumMath.sign(D.longitude-Math.abs(N.longitude)),f.z=0):(f=me(i,D,m,c,Be),g.x=0,g.y=n.CesiumMath.sign(D.longitude-N.longitude),g.z=0)}const w=t.Cartesian3.distance(a,Z),y=l.EncodedCartesian3.fromCartesian(e,Ze),x=t.Cartesian3.subtract(W,e,je),v=t.Cartesian3.normalize(x,Fe);let V=t.Cartesian3.subtract(a,e,Ye);V=t.Cartesian3.normalize(V,V);let z=t.Cartesian3.cross(v,V,Fe);z=t.Cartesian3.normalize(z,z);let K=t.Cartesian3.cross(V,m,We);K=t.Cartesian3.normalize(K,K);let ee=t.Cartesian3.subtract(Z,W,Xe);ee=t.Cartesian3.normalize(ee,ee);let te=t.Cartesian3.cross(U,ee,qe);te=t.Cartesian3.normalize(te,te);const ae=w/B,ne=$/B;let ie,re,se,oe=0,le=0,ce=0;if(C){oe=t.Cartesian3.distance(c,d),ie=l.EncodedCartesian3.fromCartesian(c,Ue),re=t.Cartesian3.subtract(d,c,$e),se=t.Cartesian3.normalize(re,Je);const e=se.x;se.x=se.y,se.y=-e,le=oe/R,ce=J/R}for(H=0;H<8;H++){const e=X+4*H,a=j+2*H,n=e+3,i=H<4?1:-1,r=2===H||3===H||6===H||7===H?1:-1;t.Cartesian3.pack(y.high,T,e),T[n]=x.x,t.Cartesian3.pack(y.low,_,e),_[n]=x.y,t.Cartesian3.pack(K,E,e),E[n]=x.z,t.Cartesian3.pack(te,O,e),O[n]=ae*i,t.Cartesian3.pack(z,b,e);let s=ne*r;0===s&&r<0&&(s=9),b[n]=s,C&&(I[e]=ie.high.x,I[e+1]=ie.high.y,I[e+2]=ie.low.x,I[e+3]=ie.low.y,k[e]=-f.y,k[e+1]=f.x,k[e+2]=g.y,k[e+3]=-g.x,P[e]=re.x,P[e+1]=re.y,P[e+2]=se.x,P[e+3]=se.y,A[a]=le*i,s=ce*r,0===s&&r<0&&(s=9),A[a+1]=s)}const ue=ve,Ce=Ve,de=De,pe=Ne,fe=t.Rectangle.fromCartographicArray(xe,Re),ge=L.getMinimumMaximumHeights(fe,p),we=ge.minimumTerrainHeight,ye=ge.maximumTerrainHeight;Q+=we,Q+=ye,Me(e,a,we,ye,ue,de),Me(W,Z,we,ye,Ce,pe);let Te=t.Cartesian3.multiplyByScalar(z,n.CesiumMath.EPSILON5,Qe);t.Cartesian3.add(ue,Te,ue),t.Cartesian3.add(Ce,Te,Ce),t.Cartesian3.add(de,Te,de),t.Cartesian3.add(pe,Te,pe),_e(ue,Ce),_e(de,pe),t.Cartesian3.pack(ue,M,Y),t.Cartesian3.pack(Ce,M,Y+3),t.Cartesian3.pack(pe,M,Y+6),t.Cartesian3.pack(de,M,Y+9),Te=t.Cartesian3.multiplyByScalar(z,-2*n.CesiumMath.EPSILON5,Qe),t.Cartesian3.add(ue,Te,ue),t.Cartesian3.add(Ce,Te,Ce),t.Cartesian3.add(de,Te,de),t.Cartesian3.add(pe,Te,pe),_e(ue,Ce),_e(de,pe),t.Cartesian3.pack(ue,M,Y+12),t.Cartesian3.pack(Ce,M,Y+15),t.Cartesian3.pack(pe,M,Y+18),t.Cartesian3.pack(de,M,Y+21),G+=2,h+=3,j+=16,Y+=24,X+=32,$+=w,J+=oe}h=0;let K=0;for(d=0;d<f;d++){for(H=0;H<tt;H++)y[h+H]=et[H]+K;K+=8,h+=tt}const ee=Ke;e.BoundingSphere.fromVertices(r,t.Cartesian3.ZERO,3,ee[0]),e.BoundingSphere.fromVertices(s,t.Cartesian3.ZERO,3,ee[1]);const te=e.BoundingSphere.fromBoundingSpheres(ee);te.radius+=Q/(2*f);const ae={position:new c.GeometryAttribute({componentDatatype:n.ComponentDatatype.DOUBLE,componentsPerAttribute:3,normalize:!1,values:M}),startHiAndForwardOffsetX:at(T),startLoAndForwardOffsetY:at(_),startNormalAndForwardOffsetZ:at(E),endNormalAndTextureCoordinateNormalizationX:at(O),rightNormalAndTextureCoordinateNormalizationY:at(b)};C&&(ae.startHiLo2D=at(I),ae.offsetAndRight2D=at(P),ae.startEndNormals2D=at(k),ae.texcoordNormalization2D=new c.GeometryAttribute({componentDatatype:n.ComponentDatatype.FLOAT,componentsPerAttribute:2,normalize:!1,values:A}));return new c.Geometry({attributes:ae,indices:y,boundingSphere:te})}(d,g,j,Y,G,B,C)};const ue=new t.Cartesian3,Ce=new t.Matrix3,de=new e.Quaternion;function he(a,i,r,s){const o=q(r,i,ue),l=t.Cartesian3.dot(o,a);if(l>S||l<x){const i=q(s,r,Q),o=l<x?n.CesiumMath.PI_OVER_TWO:-n.CesiumMath.PI_OVER_TWO,c=e.Quaternion.fromAxisAngle(i,o,de),u=t.Matrix3.fromQuaternion(c,Ce);return t.Matrix3.multiplyByVector(u,a,a),!0}return!1}const pe=new t.Cartographic,fe=new t.Cartesian3,ge=new t.Cartesian3;function me(e,a,i,r,s){const o=t.Cartographic.toCartesian(a,e._ellipsoid,fe);let l=t.Cartesian3.add(o,i,ge),c=!1;const u=e._ellipsoid;let C=u.cartesianToCartographic(l,pe);Math.abs(a.longitude-C.longitude)>n.CesiumMath.PI_OVER_TWO&&(c=!0,l=t.Cartesian3.subtract(o,i,ge),C=u.cartesianToCartographic(l,pe)),C.height=0;const d=e.project(C,s);return(s=t.Cartesian3.subtract(d,r,s)).z=0,s=t.Cartesian3.normalize(s,s),c&&t.Cartesian3.negate(s,s),s}const we=new t.Cartesian3,ye=new t.Cartesian3;function Me(e,a,n,i,r,s){const o=t.Cartesian3.subtract(a,e,we);t.Cartesian3.normalize(o,o);const l=n-R;let c=t.Cartesian3.multiplyByScalar(o,l,ye);t.Cartesian3.add(e,c,r);const u=i-D;c=t.Cartesian3.multiplyByScalar(o,u,ye),t.Cartesian3.add(a,c,s)}const Te=new t.Cartesian3;function _e(e,a){const i=C.Plane.getPointDistance(ee,e),r=C.Plane.getPointDistance(ee,a);let s=Te;n.CesiumMath.equalsEpsilon(i,0,n.CesiumMath.EPSILON2)?(s=q(a,e,s),t.Cartesian3.multiplyByScalar(s,n.CesiumMath.EPSILON2,s),t.Cartesian3.add(e,s,e)):n.CesiumMath.equalsEpsilon(r,0,n.CesiumMath.EPSILON2)&&(s=q(e,a,s),t.Cartesian3.multiplyByScalar(s,n.CesiumMath.EPSILON2,s),t.Cartesian3.add(a,s,a))}function Ee(e,t){const a=Math.abs(e.longitude),i=Math.abs(t.longitude);if(n.CesiumMath.equalsEpsilon(a,n.CesiumMath.PI,n.CesiumMath.EPSILON11)){const i=n.CesiumMath.sign(t.longitude);return e.longitude=i*(a-n.CesiumMath.EPSILON11),1}if(n.CesiumMath.equalsEpsilon(i,n.CesiumMath.PI,n.CesiumMath.EPSILON11)){const a=n.CesiumMath.sign(e.longitude);return t.longitude=a*(i-n.CesiumMath.EPSILON11),2}return 0}const Oe=new t.Cartographic,be=new t.Cartographic,Ie=new t.Cartesian3,Pe=new t.Cartesian3,Le=new t.Cartesian3,ke=new t.Cartesian3,Ae=new t.Cartesian3,Se=new t.Cartesian3,xe=[Oe,be],Re=new t.Rectangle,De=new t.Cartesian3,Ne=new t.Cartesian3,ve=new t.Cartesian3,Ve=new t.Cartesian3,ze=new t.Cartesian3,He=new t.Cartesian3,Be=new t.Cartesian3,Ge=new t.Cartesian3,je=new t.Cartesian3,Ye=new t.Cartesian3,Xe=new t.Cartesian3,Fe=new t.Cartesian3,We=new t.Cartesian3,qe=new t.Cartesian3,Ze=new l.EncodedCartesian3,Ue=new l.EncodedCartesian3,$e=new t.Cartesian3,Je=new t.Cartesian3,Qe=new t.Cartesian3,Ke=[new e.BoundingSphere,new e.BoundingSphere],et=[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],tt=et.length;function at(e){return new c.GeometryAttribute({componentDatatype:n.ComponentDatatype.FLOAT,componentsPerAttribute:4,normalize:!1,values:e})}return N._projectNormal=me,function(e,t){return L.initialize().then((function(){return a.defined(t)&&(e=N.unpack(e,t)),N.createGeometry(e)}))}}));