createGroundPolylineGeometry.js 18 KB

1
  1. define(["./Transforms-d5c6ad6e","./Matrix2-ccd5b911","./RuntimeError-346a3079","./when-4bbc8319","./ComponentDatatype-93750d1a","./ArcType-98ec98bf","./arrayRemoveDuplicates-18786327","./EllipsoidGeodesic-19ea7553","./EllipsoidRhumbLine-aa9e6266","./EncodedCartesian3-08b8d980","./GeometryAttribute-c30799b8","./IntersectionTests-4d6f5c54","./Plane-18bb00f8","./WebMercatorProjection-b29097b4","./combine-83860057","./WebGLConstants-1c8239cc"],function(Oe,be,e,B,Pe,j,G,M,V,Ae,ke,Y,r,a,t,n){"use strict";function i(e){e=B.defaultValue(e,B.defaultValue.EMPTY_OBJECT),this._ellipsoid=B.defaultValue(e.ellipsoid,be.Ellipsoid.WGS84),this._rectangle=B.defaultValue(e.rectangle,be.Rectangle.MAX_VALUE),this._projection=new Oe.GeographicProjection(this._ellipsoid),this._numberOfLevelZeroTilesX=B.defaultValue(e.numberOfLevelZeroTilesX,2),this._numberOfLevelZeroTilesY=B.defaultValue(e.numberOfLevelZeroTilesY,1)}Object.defineProperties(i.prototype,{ellipsoid:{get:function(){return this._ellipsoid}},rectangle:{get:function(){return this._rectangle}},projection:{get:function(){return this._projection}}}),i.prototype.getNumberOfXTilesAtLevel=function(e){return this._numberOfLevelZeroTilesX<<e},i.prototype.getNumberOfYTilesAtLevel=function(e){return this._numberOfLevelZeroTilesY<<e},i.prototype.rectangleToNativeRectangle=function(e,a){var t=Pe.CesiumMath.toDegrees(e.west),n=Pe.CesiumMath.toDegrees(e.south),i=Pe.CesiumMath.toDegrees(e.east),e=Pe.CesiumMath.toDegrees(e.north);return B.defined(a)?(a.west=t,a.south=n,a.east=i,a.north=e,a):new be.Rectangle(t,n,i,e)},i.prototype.tileXYToNativeRectangle=function(e,a,t,n){n=this.tileXYToRectangle(e,a,t,n);return n.west=Pe.CesiumMath.toDegrees(n.west),n.south=Pe.CesiumMath.toDegrees(n.south),n.east=Pe.CesiumMath.toDegrees(n.east),n.north=Pe.CesiumMath.toDegrees(n.north),n},i.prototype.tileXYToRectangle=function(e,a,t,n){var i=this._rectangle,r=this.getNumberOfXTilesAtLevel(t),s=this.getNumberOfYTilesAtLevel(t),t=i.width/r,r=e*t+i.west,e=(e+1)*t+i.west,t=i.height/s,s=i.north-a*t,t=i.north-(a+1)*t;return(n=!B.defined(n)?new be.Rectangle(r,t,e,s):n).west=r,n.south=t,n.east=e,n.north=s,n},i.prototype.positionToTileXY=function(e,a,t){var n=this._rectangle;if(be.Rectangle.contains(n,e)){var i=this.getNumberOfXTilesAtLevel(a),r=this.getNumberOfYTilesAtLevel(a),s=n.width/i,o=n.height/r,a=e.longitude;n.east<n.west&&(a+=Pe.CesiumMath.TWO_PI);s=(a-n.west)/s|0;i<=s&&(s=i-1);o=(n.north-e.latitude)/o|0;return(r<=o&&(o=r-1),B.defined(t))?(t.x=s,t.y=o,t):new be.Cartesian2(s,o)}};var s=new be.Cartesian3,o=new be.Cartesian3,l=new be.Cartographic,u=new be.Cartesian3,c=new be.Cartesian3,C=new Oe.BoundingSphere,p=new i,d=[new be.Cartographic,new be.Cartographic,new be.Cartographic,new be.Cartographic],h=new be.Cartesian2,Le={};function g(e){be.Cartographic.fromRadians(e.east,e.north,0,d[0]),be.Cartographic.fromRadians(e.west,e.north,0,d[1]),be.Cartographic.fromRadians(e.east,e.south,0,d[2]),be.Cartographic.fromRadians(e.west,e.south,0,d[3]);for(var a=0,t=0,n=0,i=0,r=Le._terrainHeightsMaxLevel,s=0;s<=r;++s){for(var o=!1,l=0;l<4;++l)if(p.positionToTileXY(d[l],s,h),0===l)n=h.x,i=h.y;else if(n!==h.x||i!==h.y){o=!0;break}if(o)break;a=n,t=i}if(0!==s)return{x:a,y:t,level:r<s?r:s-1}}Le.initialize=function(){var e=Le._initPromise;return B.defined(e)?e:(e=Oe.Resource.fetchJson(Oe.buildModuleUrl("Assets/approximateTerrainHeights.json")).then(function(e){Le._terrainHeights=e}),Le._initPromise=e)},Le.getMinimumMaximumHeights=function(e,a){a=B.defaultValue(a,be.Ellipsoid.WGS84);var t=g(e),n=Le._defaultMinTerrainHeight,i=Le._defaultMaxTerrainHeight;return B.defined(t)&&(t=t.level+"-"+t.x+"-"+t.y,t=Le._terrainHeights[t],B.defined(t)&&(n=t[0],i=t[1]),a.cartographicToCartesian(be.Rectangle.northeast(e,l),s),a.cartographicToCartesian(be.Rectangle.southwest(e,l),o),be.Cartesian3.midpoint(o,s,u),a=a.scaleToGeodeticSurface(u,c),n=B.defined(a)?(a=be.Cartesian3.distance(u,a),Math.min(n,-a)):Le._defaultMinTerrainHeight),{minimumTerrainHeight:n=Math.max(Le._defaultMinTerrainHeight,n),maximumTerrainHeight:i}},Le.getBoundingSphere=function(e,a){a=B.defaultValue(a,be.Ellipsoid.WGS84);var t=g(e),n=Le._defaultMaxTerrainHeight;B.defined(t)&&(i=t.level+"-"+t.x+"-"+t.y,i=Le._terrainHeights[i],B.defined(i)&&(n=i[1]));var i=Oe.BoundingSphere.fromRectangle3D(e,a,0);return Oe.BoundingSphere.fromRectangle3D(e,a,n,C),Oe.BoundingSphere.union(i,C,i)},Le._terrainHeightsMaxLevel=6,Le._defaultMaxTerrainHeight=9e3,Le._defaultMinTerrainHeight=-1e5,Le._terrainHeights=void 0,Le._initPromise=void 0,Object.defineProperties(Le,{initialized:{get:function(){return B.defined(Le._terrainHeights)}}});var F=[Oe.GeographicProjection,a.WebMercatorProjection],m=F.length,Se=Math.cos(Pe.CesiumMath.toRadians(30)),f=Math.cos(Pe.CesiumMath.toRadians(150)),q=0,X=1e3;function w(e){var a=(e=B.defaultValue(e,B.defaultValue.EMPTY_OBJECT)).positions;this.width=B.defaultValue(e.width,1),this._positions=a,this.granularity=B.defaultValue(e.granularity,9999),this.loop=B.defaultValue(e.loop,!1),this.arcType=B.defaultValue(e.arcType,j.ArcType.GEODESIC),this._ellipsoid=be.Ellipsoid.WGS84,this._projectionIndex=0,this._workerName="createGroundPolylineGeometry",this._scene3DOnly=!1}Object.defineProperties(w.prototype,{packedLength:{get:function(){return 1+3*this._positions.length+1+1+1+be.Ellipsoid.packedLength+1+1}}}),w.setProjectionAndEllipsoid=function(e,a){for(var t=0,n=0;n<m;n++)if(a instanceof F[n]){t=n;break}e._projectionIndex=t,e._ellipsoid=a.ellipsoid};var y=new be.Cartesian3,v=new be.Cartesian3,T=new be.Cartesian3;function W(e,a,t,n,i){var r=Z(n,e,0,y),t=Z(n,e,t,v),a=Z(n,a,0,T),t=xe(t,r,v),r=xe(a,r,T);return be.Cartesian3.cross(r,t,i),be.Cartesian3.normalize(i,i)}var E=new be.Cartographic,_=new be.Cartesian3,O=new be.Cartesian3,b=new be.Cartesian3;function U(e,a,t,n,i,r,s,o,l,u,c){if(0!==i){var C;r===j.ArcType.GEODESIC?C=new M.EllipsoidGeodesic(e,a,s):r===j.ArcType.RHUMB&&(C=new V.EllipsoidRhumbLine(e,a,s));r=C.surfaceDistance;if(!(r<i))for(var p=W(e,a,n,s,b),i=Math.ceil(r/i),d=r/i,h=d,g=i-1,m=o.length,f=0;f<g;f++){var w=C.interpolateUsingSurfaceDistance(h,E),y=Z(s,w,t,_),v=Z(s,w,n,O);be.Cartesian3.pack(p,o,m),be.Cartesian3.pack(y,l,m),be.Cartesian3.pack(v,u,m),c.push(w.latitude),c.push(w.longitude),m+=3,h+=d}}}var P=new be.Cartographic;function Z(e,a,t,n){return be.Cartographic.clone(a,P),P.height=t,be.Cartographic.toCartesian(P,e,n)}function xe(e,a,t){return be.Cartesian3.subtract(e,a,t),be.Cartesian3.normalize(t,t),t}function A(e,a,t,n){return n=xe(e,a,n),n=be.Cartesian3.cross(n,t,n),n=be.Cartesian3.normalize(n,n),n=be.Cartesian3.cross(t,n,n)}w.pack=function(e,a,t){var n=B.defaultValue(t,0),i=e._positions,r=i.length;a[n++]=r;for(var s=0;s<r;++s){var o=i[s];be.Cartesian3.pack(o,a,n),n+=3}return a[n++]=e.granularity,a[n++]=e.loop?1:0,a[n++]=e.arcType,be.Ellipsoid.pack(e._ellipsoid,a,n),n+=be.Ellipsoid.packedLength,a[n++]=e._projectionIndex,a[n++]=e._scene3DOnly?1:0,a},w.unpack=function(e,a,t){for(var n=B.defaultValue(a,0),i=e[n++],r=new Array(i),s=0;s<i;s++)r[s]=be.Cartesian3.unpack(e,n),n+=3;var o=e[n++],l=1===e[n++],u=e[n++],c=be.Ellipsoid.unpack(e,n);n+=be.Ellipsoid.packedLength;var C=e[n++],a=1===e[n++];return(t=!B.defined(t)?new w({positions:r}):t)._positions=r,t.granularity=o,t.loop=l,t.arcType=u,t._ellipsoid=c,t._projectionIndex=C,t._scene3DOnly=a,t};var k=new be.Cartesian3,L=new be.Cartesian3,S=new be.Cartesian3,x=new be.Cartesian3;function J(e,a,t,n,i){t=xe(t,a,x),e=A(e,a,t,k),a=A(n,a,t,L);if(Pe.CesiumMath.equalsEpsilon(be.Cartesian3.dot(e,a),-1,Pe.CesiumMath.EPSILON5))return i=be.Cartesian3.cross(t,e,i),i=be.Cartesian3.normalize(i,i);i=be.Cartesian3.add(a,e,i),i=be.Cartesian3.normalize(i,i);t=be.Cartesian3.cross(t,i,S);return i=be.Cartesian3.dot(a,t)<0?be.Cartesian3.negate(i,i):i}var Q=r.Plane.fromPointNormal(be.Cartesian3.ZERO,be.Cartesian3.UNIT_Y),K=new be.Cartesian3,$=new be.Cartesian3,ee=new be.Cartesian3,ae=new be.Cartesian3,te=new be.Cartesian3,ne=new be.Cartesian3,ie=new be.Cartographic,re=new be.Cartographic,se=new be.Cartographic;w.createGeometry=function(e){var a,t,n,i,r,s=!e._scene3DOnly,o=e.loop,l=e._ellipsoid,u=e.granularity,c=e.arcType,C=new F[e._projectionIndex](l),p=q,d=X,h=e._positions,g=h.length;2===g&&(o=!1);for(var m,f,w,y=new V.EllipsoidRhumbLine(void 0,void 0,l),v=[h[0]],M=0;M<g-1;M++)t=h[M],n=h[M+1],m=Y.IntersectionTests.lineSegmentPlane(t,n,Q,ne),!B.defined(m)||be.Cartesian3.equalsEpsilon(m,t,Pe.CesiumMath.EPSILON7)||be.Cartesian3.equalsEpsilon(m,n,Pe.CesiumMath.EPSILON7)||(e.arcType===j.ArcType.GEODESIC?v.push(be.Cartesian3.clone(m)):e.arcType===j.ArcType.RHUMB&&(w=l.cartesianToCartographic(m,ie).longitude,i=l.cartesianToCartographic(t,ie),r=l.cartesianToCartographic(n,re),y.setEndPoints(i,r),f=y.findIntersectionWithLongitude(w,se),m=l.cartographicToCartesian(f,ne),!B.defined(m)||be.Cartesian3.equalsEpsilon(m,t,Pe.CesiumMath.EPSILON7)||be.Cartesian3.equalsEpsilon(m,n,Pe.CesiumMath.EPSILON7)||v.push(be.Cartesian3.clone(m)))),v.push(n);o&&(t=h[g-1],n=h[0],m=Y.IntersectionTests.lineSegmentPlane(t,n,Q,ne),!B.defined(m)||be.Cartesian3.equalsEpsilon(m,t,Pe.CesiumMath.EPSILON7)||be.Cartesian3.equalsEpsilon(m,n,Pe.CesiumMath.EPSILON7)||(e.arcType===j.ArcType.GEODESIC?v.push(be.Cartesian3.clone(m)):e.arcType===j.ArcType.RHUMB&&(w=l.cartesianToCartographic(m,ie).longitude,i=l.cartesianToCartographic(t,ie),r=l.cartesianToCartographic(n,re),y.setEndPoints(i,r),f=y.findIntersectionWithLongitude(w,se),m=l.cartographicToCartesian(f,ne),!B.defined(m)||be.Cartesian3.equalsEpsilon(m,t,Pe.CesiumMath.EPSILON7)||be.Cartesian3.equalsEpsilon(m,n,Pe.CesiumMath.EPSILON7)||v.push(be.Cartesian3.clone(m)))));var T=v.length,E=new Array(T);for(M=0;M<T;M++){var _=be.Cartographic.fromCartesian(v[M],l);_.height=0,E[M]=_}if(!((T=(E=G.arrayRemoveDuplicates(E,be.Cartographic.equalsEpsilon)).length)<2)){var O=[],b=[],P=[],A=[],k=K,L=$,S=ee,x=ae,I=te,N=E[0],R=E[1];for(k=Z(l,E[T-1],p,k),x=Z(l,R,p,x),L=Z(l,N,p,L),S=Z(l,N,d,S),I=o?J(k,L,S,x,I):W(N,R,d,l,I),be.Cartesian3.pack(I,b,0),be.Cartesian3.pack(L,P,0),be.Cartesian3.pack(S,A,0),O.push(N.latitude),O.push(N.longitude),U(N,R,p,d,u,c,l,b,P,A,O),M=1;M<T-1;++M){var k=be.Cartesian3.clone(L,k),L=be.Cartesian3.clone(x,L),D=E[M];Z(l,D,d,S),Z(l,E[M+1],p,x),J(k,L,S,x,I),a=b.length,be.Cartesian3.pack(I,b,a),be.Cartesian3.pack(L,P,a),be.Cartesian3.pack(S,A,a),O.push(D.latitude),O.push(D.longitude),U(E[M],E[M+1],p,d,u,c,l,b,P,A,O)}var z=E[T-1],H=E[T-2];if(L=Z(l,z,p,L),S=Z(l,z,d,S),I=o?(R=E[0],J(k=Z(l,H,p,k),L,S,x=Z(l,R,p,x),I)):W(H,z,d,l,I),a=b.length,be.Cartesian3.pack(I,b,a),be.Cartesian3.pack(L,P,a),be.Cartesian3.pack(S,A,a),O.push(z.latitude),O.push(z.longitude),o){for(U(z,N,p,d,u,c,l,b,P,A,O),a=b.length,M=0;M<3;++M)b[a+M]=b[M],P[a+M]=P[M],A[a+M]=A[M];O.push(N.latitude),O.push(N.longitude)}return function(e,a,t,n,i,r,s){var o,l,u,c,C,p,d=a._ellipsoid,h=t.length/3-1,g=8*h,m=4*g,f=36*h,w=new(65535<g?Uint32Array:Uint16Array)(f),y=new Float64Array(3*g),v=new Float32Array(m),M=new Float32Array(m),T=new Float32Array(m),E=new Float32Array(m),_=new Float32Array(m);s&&(u=new Float32Array(m),c=new Float32Array(m),C=new Float32Array(m),p=new Float32Array(2*g));var O=r.length/2,b=0,P=ze;P.height=0;var A=He;A.height=0;var k=Be,L=je;if(s)for(l=0,o=1;o<O;o++)P.latitude=r[l],P.longitude=r[l+1],A.latitude=r[l+2],A.longitude=r[l+3],k=a.project(P,k),L=a.project(A,L),b+=be.Cartesian3.distance(k,L),l+=2;var S=n.length/3;L=be.Cartesian3.unpack(n,0,L);var x,I=0;for(l=3,o=1;o<S;o++)k=be.Cartesian3.clone(L,k),L=be.Cartesian3.unpack(n,l,L),I+=be.Cartesian3.distance(k,L),l+=3;l=3;var N=0,R=0,D=0,z=0,H=!1,B=be.Cartesian3.unpack(t,0,Ve),j=be.Cartesian3.unpack(n,0,je),G=be.Cartesian3.unpack(i,0,Fe);e&&(_e=be.Cartesian3.unpack(t,t.length-6,Ge),Ie(G,_e,B,j)&&(G=be.Cartesian3.negate(G,G)));var V,Y,F,q,X,W,U,Z=0,J=0,Q=0;for(o=0;o<h;o++){var K=be.Cartesian3.clone(B,Ge),$=be.Cartesian3.clone(j,Be),ee=be.Cartesian3.clone(G,Ye);H&&(ee=be.Cartesian3.negate(ee,ee)),B=be.Cartesian3.unpack(t,l,Ve),j=be.Cartesian3.unpack(n,l,je),G=be.Cartesian3.unpack(i,l,Fe),H=Ie(G,K,B,j),P.latitude=r[N],P.longitude=r[N+1],A.latitude=r[N+2],A.longitude=r[N+3],s&&(Me=function(e,a){var t=Math.abs(e.longitude),n=Math.abs(a.longitude);{if(Pe.CesiumMath.equalsEpsilon(t,Pe.CesiumMath.PI,Pe.CesiumMath.EPSILON11)){var i=Pe.CesiumMath.sign(a.longitude);return e.longitude=i*(t-Pe.CesiumMath.EPSILON11),1}if(Pe.CesiumMath.equalsEpsilon(n,Pe.CesiumMath.PI,Pe.CesiumMath.EPSILON11)){e=Pe.CesiumMath.sign(e.longitude);return a.longitude=e*(n-Pe.CesiumMath.EPSILON11),2}}return 0}(P,A),V=a.project(P,Qe),(pe=xe(Y=a.project(A,Ke),V,ua)).y=Math.abs(pe.y),F=$e,q=ea,0===Me||be.Cartesian3.dot(pe,be.Cartesian3.UNIT_Y)>Se?(F=Ne(a,P,ee,V,$e),q=Ne(a,A,G,Y,ea)):1===Me?(q=Ne(a,A,G,Y,ea),F.x=0,F.y=Pe.CesiumMath.sign(P.longitude-Math.abs(A.longitude)),F.z=0):(F=Ne(a,P,ee,V,$e),q.x=0,q.y=Pe.CesiumMath.sign(P.longitude-A.longitude),q.z=0));var ae=be.Cartesian3.distance($,j),te=Ae.EncodedCartesian3.fromCartesian(K,oa),ne=be.Cartesian3.subtract(B,K,aa),ie=be.Cartesian3.normalize(ne,ia),re=be.Cartesian3.subtract($,K,ta);re=be.Cartesian3.normalize(re,re);var se=be.Cartesian3.cross(ie,re,ia);se=be.Cartesian3.normalize(se,se);var oe=be.Cartesian3.cross(re,ee,ra);oe=be.Cartesian3.normalize(oe,oe);var le=be.Cartesian3.subtract(j,B,na);le=be.Cartesian3.normalize(le,le);var ue=be.Cartesian3.cross(G,le,sa);ue=be.Cartesian3.normalize(ue,ue);var ce=ae/I,Ce=Z/I,pe=0,de=0,he=0;for(s&&(pe=be.Cartesian3.distance(V,Y),X=Ae.EncodedCartesian3.fromCartesian(V,la),W=be.Cartesian3.subtract(Y,V,ua),Te=(U=be.Cartesian3.normalize(W,ca)).x,U.x=U.y,U.y=-Te,de=pe/b,he=J/b),x=0;x<8;x++){var ge=z+4*x,me=R+2*x,fe=ge+3,we=x<4?1:-1,ye=2===x||3===x||6===x||7===x?1:-1;be.Cartesian3.pack(te.high,v,ge),v[fe]=ne.x,be.Cartesian3.pack(te.low,M,ge),M[fe]=ne.y,be.Cartesian3.pack(oe,T,ge),T[fe]=ne.z,be.Cartesian3.pack(ue,E,ge),E[fe]=ce*we,be.Cartesian3.pack(se,_,ge);var ve=Ce*ye;0===ve&&ye<0&&(ve=9),_[fe]=ve,s&&(u[ge]=X.high.x,u[ge+1]=X.high.y,u[ge+2]=X.low.x,u[ge+3]=X.low.y,C[ge]=-F.y,C[ge+1]=F.x,C[ge+2]=q.y,C[ge+3]=-q.x,c[ge]=W.x,c[ge+1]=W.y,c[ge+2]=U.x,c[ge+3]=U.y,p[me]=de*we,0===(ve=he*ye)&&ye<0&&(ve=9),p[me+1]=ve)}var Me=Ze,ie=Je,re=We,ee=Ue,le=be.Rectangle.fromCartographicArray(qe,Xe),Te=Le.getMinimumMaximumHeights(le,d),le=Te.minimumTerrainHeight,Te=Te.maximumTerrainHeight;Q+=le,Q+=Te,Re(K,$,le,Te,Me,re),Re(B,j,le,Te,ie,ee);Te=be.Cartesian3.multiplyByScalar(se,Pe.CesiumMath.EPSILON5,Ca);be.Cartesian3.add(Me,Te,Me),be.Cartesian3.add(ie,Te,ie),be.Cartesian3.add(re,Te,re),be.Cartesian3.add(ee,Te,ee),De(Me,ie),De(re,ee),be.Cartesian3.pack(Me,y,D),be.Cartesian3.pack(ie,y,D+3),be.Cartesian3.pack(ee,y,D+6),be.Cartesian3.pack(re,y,D+9),Te=be.Cartesian3.multiplyByScalar(se,-2*Pe.CesiumMath.EPSILON5,Ca),be.Cartesian3.add(Me,Te,Me),be.Cartesian3.add(ie,Te,ie),be.Cartesian3.add(re,Te,re),be.Cartesian3.add(ee,Te,ee),De(Me,ie),De(re,ee),be.Cartesian3.pack(Me,y,D+12),be.Cartesian3.pack(ie,y,D+15),be.Cartesian3.pack(ee,y,D+18),be.Cartesian3.pack(re,y,D+21),N+=2,l+=3,R+=16,D+=24,z+=32,Z+=ae,J+=pe}var Ee=l=0;for(o=0;o<h;o++){for(x=0;x<ha;x++)w[l+x]=da[x]+Ee;Ee+=8,l+=ha}e=pa;Oe.BoundingSphere.fromVertices(t,be.Cartesian3.ZERO,3,e[0]),Oe.BoundingSphere.fromVertices(n,be.Cartesian3.ZERO,3,e[1]);var _e=Oe.BoundingSphere.fromBoundingSpheres(e);_e.radius+=Q/(2*h);e={position:new ke.GeometryAttribute({componentDatatype:Pe.ComponentDatatype.DOUBLE,componentsPerAttribute:3,normalize:!1,values:y}),startHiAndForwardOffsetX:ga(v),startLoAndForwardOffsetY:ga(M),startNormalAndForwardOffsetZ:ga(T),endNormalAndTextureCoordinateNormalizationX:ga(E),rightNormalAndTextureCoordinateNormalizationY:ga(_)};s&&(e.startHiLo2D=ga(u),e.offsetAndRight2D=ga(c),e.startEndNormals2D=ga(C),e.texcoordNormalization2D=new ke.GeometryAttribute({componentDatatype:Pe.ComponentDatatype.FLOAT,componentsPerAttribute:2,normalize:!1,values:p}));return new ke.Geometry({attributes:e,indices:w,boundingSphere:_e})}(o,C,P,A,b,O,s)}};var I=new be.Cartesian3,N=new be.Matrix3,R=new Oe.Quaternion;function Ie(e,a,t,n){a=xe(t,a,I),a=be.Cartesian3.dot(a,e);if(Se<a||a<f){t=xe(n,t,x),a=a<f?Pe.CesiumMath.PI_OVER_TWO:-Pe.CesiumMath.PI_OVER_TWO,a=Oe.Quaternion.fromAxisAngle(t,a,R),a=be.Matrix3.fromQuaternion(a,N);return be.Matrix3.multiplyByVector(a,e,e),!0}return!1}var D=new be.Cartographic,z=new be.Cartesian3,H=new be.Cartesian3;function Ne(e,a,t,n,i){var r=be.Cartographic.toCartesian(a,e._ellipsoid,z),s=be.Cartesian3.add(r,t,H),o=!1,l=e._ellipsoid,u=l.cartesianToCartographic(s,D);Math.abs(a.longitude-u.longitude)>Pe.CesiumMath.PI_OVER_TWO&&(o=!0,s=be.Cartesian3.subtract(r,t,H),u=l.cartesianToCartographic(s,D)),u.height=0;u=e.project(u,i);return(i=be.Cartesian3.subtract(u,n,i)).z=0,i=be.Cartesian3.normalize(i,i),o&&be.Cartesian3.negate(i,i),i}var oe=new be.Cartesian3,le=new be.Cartesian3;function Re(e,a,t,n,i,r){var s=be.Cartesian3.subtract(a,e,oe);be.Cartesian3.normalize(s,s);t=be.Cartesian3.multiplyByScalar(s,t-q,le);be.Cartesian3.add(e,t,i);t=be.Cartesian3.multiplyByScalar(s,n-X,le);be.Cartesian3.add(a,t,r)}var ue=new be.Cartesian3;function De(e,a){var t=r.Plane.getPointDistance(Q,e),n=r.Plane.getPointDistance(Q,a),i=ue;Pe.CesiumMath.equalsEpsilon(t,0,Pe.CesiumMath.EPSILON2)?(i=xe(a,e,i),be.Cartesian3.multiplyByScalar(i,Pe.CesiumMath.EPSILON2,i),be.Cartesian3.add(e,i,e)):Pe.CesiumMath.equalsEpsilon(n,0,Pe.CesiumMath.EPSILON2)&&(i=xe(e,a,i),be.Cartesian3.multiplyByScalar(i,Pe.CesiumMath.EPSILON2,i),be.Cartesian3.add(a,i,a))}var ze=new be.Cartographic,He=new be.Cartographic,Be=new be.Cartesian3,je=new be.Cartesian3,Ge=new be.Cartesian3,Ve=new be.Cartesian3,Ye=new be.Cartesian3,Fe=new be.Cartesian3,qe=[ze,He],Xe=new be.Rectangle,We=new be.Cartesian3,Ue=new be.Cartesian3,Ze=new be.Cartesian3,Je=new be.Cartesian3,Qe=new be.Cartesian3,Ke=new be.Cartesian3,$e=new be.Cartesian3,ea=new be.Cartesian3,aa=new be.Cartesian3,ta=new be.Cartesian3,na=new be.Cartesian3,ia=new be.Cartesian3,ra=new be.Cartesian3,sa=new be.Cartesian3,oa=new Ae.EncodedCartesian3,la=new Ae.EncodedCartesian3,ua=new be.Cartesian3,ca=new be.Cartesian3,Ca=new be.Cartesian3,pa=[new Oe.BoundingSphere,new Oe.BoundingSphere],da=[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],ha=da.length;function ga(e){return new ke.GeometryAttribute({componentDatatype:Pe.ComponentDatatype.FLOAT,componentsPerAttribute:4,normalize:!1,values:e})}return w._projectNormal=Ne,function(e,a){return Le.initialize().then(function(){return B.defined(a)&&(e=w.unpack(e,a)),w.createGeometry(e)})}});