/** * @license * Cesium - https://github.com/CesiumGS/cesium * Version 1.120.1 * * 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. */ import{a as J}from"./chunk-ENAI6T53.js";import{a as Nt}from"./chunk-7X5355YR.js";import{a as zt}from"./chunk-343SJCYH.js";import"./chunk-AWTNTFWT.js";import"./chunk-VMUA7QRT.js";import{a as ut}from"./chunk-TRTMI7MU.js";import{a as X}from"./chunk-7QS2ZEBL.js";import{b as Rt}from"./chunk-B7DJSUT3.js";import"./chunk-2YTOGJWB.js";import"./chunk-ZZPAAKFL.js";import"./chunk-A2J5OJ74.js";import{a as yt}from"./chunk-VRSMIU2E.js";import{a as Vt}from"./chunk-WGB3L4DG.js";import{b as Mt,c as Pt,d as q}from"./chunk-VT3S74KG.js";import{d as st}from"./chunk-JYT7LKWQ.js";import{f as Lt,h as E,i as At}from"./chunk-DPXXHKCX.js";import{a as Y}from"./chunk-UTQP35IH.js";import{a as _,b as wt,c as G,d as H,e as ft}from"./chunk-S74IVKSO.js";import{a as W}from"./chunk-XQPFZTAL.js";import"./chunk-CYX2VK56.js";import"./chunk-A5LGJSYE.js";import{a as L}from"./chunk-CDFKIAC5.js";import{a as St,b as lt}from"./chunk-DRUYFASX.js";import{e as $}from"./chunk-A4U73JJE.js";var Tt=new _,Bt=new _,Ut=new _,Yt=new _,qt=new E,Zt=new G,Kt=new st,$t=new st;function Xt(t,e){let n=new Pt({attributes:new Vt,primitiveType:Mt.TRIANGLES});return n.attributes.position=new q({componentDatatype:Y.DOUBLE,componentsPerAttribute:3,values:e.positions}),t.normal&&(n.attributes.normal=new q({componentDatatype:Y.FLOAT,componentsPerAttribute:3,values:e.normals})),t.tangent&&(n.attributes.tangent=new q({componentDatatype:Y.FLOAT,componentsPerAttribute:3,values:e.tangents})),t.bitangent&&(n.attributes.bitangent=new q({componentDatatype:Y.FLOAT,componentsPerAttribute:3,values:e.bitangents})),n}function Gt(t,e,n,o){let a=t.length,r=e.normal?new Float32Array(a):void 0,i=e.tangent?new Float32Array(a):void 0,s=e.bitangent?new Float32Array(a):void 0,l=0,u=Yt,c=Ut,m=Bt;if(e.normal||e.tangent||e.bitangent)for(let p=0;p<a;p+=3){let a=_.fromArray(t,p,Tt),h=l+1,f=l+2;m=n.geodeticSurfaceNormal(a,m),(e.tangent||e.bitangent)&&(_.cross(_.UNIT_Z,m,c),ft.multiplyByVector(o,c,c),_.normalize(c,c),e.bitangent&&_.normalize(_.cross(m,c,u),u)),e.normal&&(r[l]=m.x,r[h]=m.y,r[f]=m.z),e.tangent&&(i[l]=c.x,i[h]=c.y,i[f]=c.z),e.bitangent&&(s[l]=u.x,s[h]=u.y,s[f]=u.z),l+=3}return Xt(e,{positions:t,normals:r,tangents:i,bitangents:s})}var Ct=new _,jt=new _;function te(t,e,n){let o=t.length,a=e.normal?new Float32Array(o):void 0,r=e.tangent?new Float32Array(o):void 0,i=e.bitangent?new Float32Array(o):void 0,s=0,l=0,u=0,c=!0,m=Yt,p=Ut,h=Bt;if(e.normal||e.tangent||e.bitangent)for(let f=0;f<o;f+=6){let g=_.fromArray(t,f,Tt),d=_.fromArray(t,(f+6)%o,Ct);if(c){let e=_.fromArray(t,(f+3)%o,jt);_.subtract(d,g,d),_.subtract(e,g,e),h=_.normalize(_.cross(e,d,h),h),c=!1}_.equalsEpsilon(d,g,W.EPSILON10)&&(c=!0),(e.tangent||e.bitangent)&&(m=n.geodeticSurfaceNormal(g,m),e.tangent&&(p=_.normalize(_.cross(m,h,p),p))),e.normal&&(a[s++]=h.x,a[s++]=h.y,a[s++]=h.z,a[s++]=h.x,a[s++]=h.y,a[s++]=h.z),e.tangent&&(r[l++]=p.x,r[l++]=p.y,r[l++]=p.z,r[l++]=p.x,r[l++]=p.y,r[l++]=p.z),e.bitangent&&(i[u++]=m.x,i[u++]=m.y,i[u++]=m.z,i[u++]=m.x,i[u++]=m.y,i[u++]=m.z)}return Xt(e,{positions:t,normals:a,tangents:r,bitangents:i})}function It(t,e){let n=t._vertexFormat,o=t._ellipsoid,a=e.height,r=e.width,i=e.northCap,s=e.southCap,l=0,u=a,c=a,m=0;i&&(l=1,c-=1,m+=1),s&&(u-=1,c-=1,m+=1),m+=r*c;let p=n.position?new Float64Array(3*m):void 0,h=n.st?new Float32Array(2*m):void 0,f=0,g=0,d=Tt,_=Zt,y=Number.MAX_VALUE,w=Number.MAX_VALUE,A=-Number.MAX_VALUE,b=-Number.MAX_VALUE;for(let F=l;F<u;++F)for(let t=0;t<r;++t)J.computePosition(e,o,n.st,F,t,d,_),p[f++]=d.x,p[f++]=d.y,p[f++]=d.z,n.st&&(h[g++]=_.x,h[g++]=_.y,y=Math.min(y,_.x),w=Math.min(w,_.y),A=Math.max(A,_.x),b=Math.max(b,_.y));if(i&&(J.computePosition(e,o,n.st,0,0,d,_),p[f++]=d.x,p[f++]=d.y,p[f++]=d.z,n.st&&(h[g++]=_.x,h[g++]=_.y,y=_.x,w=_.y,A=_.x,b=_.y)),s&&(J.computePosition(e,o,n.st,a-1,0,d,_),p[f++]=d.x,p[f++]=d.y,p[f]=d.z,n.st&&(h[g++]=_.x,h[g]=_.y,y=Math.min(y,_.x),w=Math.min(w,_.y),A=Math.max(A,_.x),b=Math.max(b,_.y))),n.st&&(y<0||w<0||A>1||b>1))for(let F=0;F<h.length;F+=2)h[F]=(h[F]-y)/(A-y),h[F+1]=(h[F+1]-w)/(b-w);let v=Gt(p,n,o,e.tangentRotationMatrix),x=6*(r-1)*(c-1);i&&(x+=3*(r-1)),s&&(x+=3*(r-1));let E,L=yt.createTypedArray(m,x),T=0,k=0;for(E=0;E<c-1;++E){for(let t=0;t<r-1;++t){let t=T,e=t+r,n=e+1,o=t+1;L[k++]=t,L[k++]=e,L[k++]=o,L[k++]=o,L[k++]=e,L[k++]=n,++T}++T}if(i||s){let t,e,n=m-1,o=m-1;if(i&&s&&(n=m-2),T=0,i)for(E=0;E<r-1;E++)t=T,e=t+1,L[k++]=n,L[k++]=t,L[k++]=e,++T;if(s)for(T=(c-1)*r,E=0;E<r-1;E++)t=T,e=t+1,L[k++]=t,L[k++]=o,L[k++]=e,++T}return v.indices=L,n.st&&(v.attributes.st=new q({componentDatatype:Y.FLOAT,componentsPerAttribute:2,values:h})),v}function ht(t,e,n,o,a){return t[e++]=o[n],t[e++]=o[n+1],t[e++]=o[n+2],t[e++]=a[n],t[e++]=a[n+1],t[e]=a[n+2],t}function dt(t,e,n,o){return t[e++]=o[n],t[e++]=o[n+1],t[e++]=o[n],t[e]=o[n+1],t}var Dt=new X;function ee(t,e){let n,o=t._shadowVolume,a=t._offsetAttribute,r=t._vertexFormat,i=t._extrudedHeight,s=t._surfaceHeight,l=t._ellipsoid,u=e.height,c=e.width;if(o){let e=X.clone(r,Dt);e.normal=!0,t._vertexFormat=e}let m=It(t,e);o&&(t._vertexFormat=r);let p=Rt.scaleToGeodeticHeight(m.attributes.position.values,s,l,!1);p=new Float64Array(p);let h=p.length,f=2*h,g=new Float64Array(f);g.set(p);let d=Rt.scaleToGeodeticHeight(m.attributes.position.values,i,l);g.set(d,h),m.attributes.position.values=g;let y,w,A=r.normal?new Float32Array(f):void 0,b=r.tangent?new Float32Array(f):void 0,v=r.bitangent?new Float32Array(f):void 0,x=r.st?new Float32Array(f/3*2):void 0;if(r.normal){for(w=m.attributes.normal.values,A.set(w),n=0;n<h;n++)w[n]=-w[n];A.set(w,h),m.attributes.normal.values=A}if(o){w=m.attributes.normal.values,r.normal||(m.attributes.normal=void 0);let t=new Float32Array(f);for(n=0;n<h;n++)w[n]=-w[n];t.set(w,h),m.attributes.extrudeDirection=new q({componentDatatype:Y.FLOAT,componentsPerAttribute:3,values:t})}let E,L=$(a);if(L){let t=h/3*2,e=new Uint8Array(t);a===ut.TOP?e=e.fill(1,0,t/2):(E=a===ut.NONE?0:1,e=e.fill(E)),m.attributes.applyOffset=new q({componentDatatype:Y.UNSIGNED_BYTE,componentsPerAttribute:1,values:e})}if(r.tangent){let t=m.attributes.tangent.values;for(b.set(t),n=0;n<h;n++)t[n]=-t[n];b.set(t,h),m.attributes.tangent.values=b}if(r.bitangent){let t=m.attributes.bitangent.values;v.set(t),v.set(t,h),m.attributes.bitangent.values=v}r.st&&(y=m.attributes.st.values,x.set(y),x.set(y,h/3*2),m.attributes.st.values=x);let T=m.indices,k=T.length,F=h/3,R=yt.createTypedArray(f/3,2*k);for(R.set(T),n=0;n<k;n+=3)R[n+k]=T[n+2]+F,R[n+1+k]=T[n+1]+F,R[n+2+k]=T[n]+F;m.indices=R;let P=e.northCap,H=e.southCap,O=u,N=2,D=0,S=4,j=4;P&&(N-=1,O-=1,D+=1,S-=2,j-=1),H&&(N-=1,O-=1,D+=1,S-=2,j-=1),D+=N*c+2*O-S;let G=2*(D+j),I=new Float64Array(3*G),J=o?new Float32Array(3*G):void 0,M=L?new Uint8Array(G):void 0,U=r.st?new Float32Array(2*G):void 0,C=a===ut.TOP;L&&!C&&(E=a===ut.ALL?1:0,M=M.fill(E));let V,Q=0,z=0,B=0,K=0,Z=c*O;for(n=0;n<Z;n+=c)V=3*n,I=ht(I,Q,V,p,d),Q+=6,r.st&&(U=dt(U,z,2*n,y),z+=4),o&&(B+=3,J[B++]=w[V],J[B++]=w[V+1],J[B++]=w[V+2]),C&&(M[K++]=1,K+=1);if(H){let t=P?Z+1:Z;for(V=3*t,n=0;n<2;n++)I=ht(I,Q,V,p,d),Q+=6,r.st&&(U=dt(U,z,2*t,y),z+=4),o&&(B+=3,J[B++]=w[V],J[B++]=w[V+1],J[B++]=w[V+2]),C&&(M[K++]=1,K+=1)}else for(n=Z-c;n<Z;n++)V=3*n,I=ht(I,Q,V,p,d),Q+=6,r.st&&(U=dt(U,z,2*n,y),z+=4),o&&(B+=3,J[B++]=w[V],J[B++]=w[V+1],J[B++]=w[V+2]),C&&(M[K++]=1,K+=1);for(n=Z-1;n>0;n-=c)V=3*n,I=ht(I,Q,V,p,d),Q+=6,r.st&&(U=dt(U,z,2*n,y),z+=4),o&&(B+=3,J[B++]=w[V],J[B++]=w[V+1],J[B++]=w[V+2]),C&&(M[K++]=1,K+=1);if(P){let t=Z;for(V=3*t,n=0;n<2;n++)I=ht(I,Q,V,p,d),Q+=6,r.st&&(U=dt(U,z,2*t,y),z+=4),o&&(B+=3,J[B++]=w[V],J[B++]=w[V+1],J[B++]=w[V+2]),C&&(M[K++]=1,K+=1)}else for(n=c-1;n>=0;n--)V=3*n,I=ht(I,Q,V,p,d),Q+=6,r.st&&(U=dt(U,z,2*n,y),z+=4),o&&(B+=3,J[B++]=w[V],J[B++]=w[V+1],J[B++]=w[V+2]),C&&(M[K++]=1,K+=1);let tt=te(I,r,l);r.st&&(tt.attributes.st=new q({componentDatatype:Y.FLOAT,componentsPerAttribute:2,values:U})),o&&(tt.attributes.extrudeDirection=new q({componentDatatype:Y.FLOAT,componentsPerAttribute:3,values:J})),L&&(tt.attributes.applyOffset=new q({componentDatatype:Y.UNSIGNED_BYTE,componentsPerAttribute:1,values:M}));let et,nt,ot,at,rt=yt.createTypedArray(G,6*D);h=I.length/3;let it=0;for(n=0;n<h-1;n+=2){et=n,at=(et+2)%h;let t=_.fromArray(I,3*et,Ct),e=_.fromArray(I,3*at,jt);_.equalsEpsilon(t,e,W.EPSILON10)||(nt=(et+1)%h,ot=(nt+2)%h,rt[it++]=et,rt[it++]=nt,rt[it++]=at,rt[it++]=at,rt[it++]=nt,rt[it++]=ot)}return tt.indices=rt,tt=zt.combineInstances([new Nt({geometry:m}),new Nt({geometry:tt})]),tt[0]}var ne=[new _,new _,new _,new _],Wt=new wt,oe=new wt;function Ht(t,e,n,o,a){if(0===n)return E.clone(t,a);let r=J.computeOptions(t,e,n,0,qt,Wt),i=r.height,s=r.width,l=ne;return J.computePosition(r,o,!1,0,0,l[0]),J.computePosition(r,o,!1,0,s-1,l[1]),J.computePosition(r,o,!1,i-1,0,l[2]),J.computePosition(r,o,!1,i-1,s-1,l[3]),E.fromCartesianArray(l,o,a)}function Q(t){t=L(t,L.EMPTY_OBJECT);let e=t.rectangle;if(lt.typeOf.object("rectangle",e),E.validate(e),e.north<e.south)throw new St("options.rectangle.north must be greater than or equal to options.rectangle.south");let n=L(t.height,0),o=L(t.extrudedHeight,n);this._rectangle=E.clone(e),this._granularity=L(t.granularity,W.RADIANS_PER_DEGREE),this._ellipsoid=H.clone(L(t.ellipsoid,H.default)),this._surfaceHeight=Math.max(n,o),this._rotation=L(t.rotation,0),this._stRotation=L(t.stRotation,0),this._vertexFormat=X.clone(L(t.vertexFormat,X.DEFAULT)),this._extrudedHeight=Math.min(n,o),this._shadowVolume=L(t.shadowVolume,!1),this._workerName="createRectangleGeometry",this._offsetAttribute=t.offsetAttribute,this._rotatedRectangle=void 0,this._textureCoordinateRotationPoints=void 0}Q.packedLength=E.packedLength+H.packedLength+X.packedLength+7,Q.pack=function(t,e,n){return lt.typeOf.object("value",t),lt.defined("array",e),n=L(n,0),E.pack(t._rectangle,e,n),n+=E.packedLength,H.pack(t._ellipsoid,e,n),n+=H.packedLength,X.pack(t._vertexFormat,e,n),n+=X.packedLength,e[n++]=t._granularity,e[n++]=t._surfaceHeight,e[n++]=t._rotation,e[n++]=t._stRotation,e[n++]=t._extrudedHeight,e[n++]=t._shadowVolume?1:0,e[n]=L(t._offsetAttribute,-1),e};var Jt=new E,Qt=H.clone(H.UNIT_SPHERE),tt={rectangle:Jt,ellipsoid:Qt,vertexFormat:Dt,granularity:void 0,height:void 0,rotation:void 0,stRotation:void 0,extrudedHeight:void 0,shadowVolume:void 0,offsetAttribute:void 0};Q.unpack=function(t,e,n){lt.defined("array",t),e=L(e,0);let o=E.unpack(t,e,Jt);e+=E.packedLength;let a=H.unpack(t,e,Qt);e+=H.packedLength;let r=X.unpack(t,e,Dt);e+=X.packedLength;let i=t[e++],s=t[e++],l=t[e++],u=t[e++],c=t[e++],m=1===t[e++],p=t[e];return $(n)?(n._rectangle=E.clone(o,n._rectangle),n._ellipsoid=H.clone(a,n._ellipsoid),n._vertexFormat=X.clone(r,n._vertexFormat),n._granularity=i,n._surfaceHeight=s,n._rotation=l,n._stRotation=u,n._extrudedHeight=c,n._shadowVolume=m,n._offsetAttribute=-1===p?void 0:p,n):(tt.granularity=i,tt.height=s,tt.rotation=l,tt.stRotation=u,tt.extrudedHeight=c,tt.shadowVolume=m,tt.offsetAttribute=-1===p?void 0:p,new Q(tt))},Q.computeRectangle=function(t,e){t=L(t,L.EMPTY_OBJECT);let n=t.rectangle;if(lt.typeOf.object("rectangle",n),E.validate(n),n.north<n.south)throw new St("options.rectangle.north must be greater than or equal to options.rectangle.south");let o=L(t.granularity,W.RADIANS_PER_DEGREE),a=L(t.ellipsoid,H.default),r=L(t.rotation,0);return Ht(n,o,r,a,e)};var ie=new ft,Ft=new Lt,ae=new wt;Q.createGeometry=function(t){if(W.equalsEpsilon(t._rectangle.north,t._rectangle.south,W.EPSILON10)||W.equalsEpsilon(t._rectangle.east,t._rectangle.west,W.EPSILON10))return;let e=t._rectangle,n=t._ellipsoid,o=t._rotation,a=t._stRotation,r=t._vertexFormat,i=J.computeOptions(e,t._granularity,o,a,qt,Wt,oe),s=ie;if(0!==a||0!==o){let t=E.center(e,ae),o=n.geodeticSurfaceNormalCartographic(t,Ct);Lt.fromAxisAngle(o,-a,Ft),ft.fromQuaternion(Ft,s)}else ft.clone(ft.IDENTITY,s);let l,u,c=t._surfaceHeight,m=t._extrudedHeight,p=!W.equalsEpsilon(c,m,0,W.EPSILON2);if(i.lonScalar=1/t._rectangle.width,i.latScalar=1/t._rectangle.height,i.tangentRotationMatrix=s,e=t._rectangle,p){l=ee(t,i);let o=st.fromRectangle3D(e,n,c,$t),a=st.fromRectangle3D(e,n,m,Kt);u=st.union(o,a)}else{if(l=It(t,i),l.attributes.position.values=Rt.scaleToGeodeticHeight(l.attributes.position.values,c,n,!1),$(t._offsetAttribute)){let e=l.attributes.position.values.length,n=t._offsetAttribute===ut.NONE?0:1,o=new Uint8Array(e/3).fill(n);l.attributes.applyOffset=new q({componentDatatype:Y.UNSIGNED_BYTE,componentsPerAttribute:1,values:o})}u=st.fromRectangle3D(e,n,c)}return r.position||delete l.attributes.position,new Pt({attributes:l.attributes,indices:l.indices,primitiveType:l.primitiveType,boundingSphere:u,offsetAttribute:t._offsetAttribute})},Q.createShadowVolume=function(t,e,n){let o=t._granularity,a=t._ellipsoid,r=e(o,a),i=n(o,a);return new Q({rectangle:t._rectangle,rotation:t._rotation,ellipsoid:a,stRotation:t._stRotation,granularity:o,extrudedHeight:i,height:r,vertexFormat:X.POSITION_ONLY,shadowVolume:!0})};var vt=new E,se=[new G,new G,new G],re=new At,ce=new wt;function le(t){if(0===t._stRotation)return[0,0,0,1,1,0];let e=E.clone(t._rectangle,vt),n=t._granularity,o=t._ellipsoid,a=t._rotation-t._stRotation,r=Ht(e,n,a,o,vt),i=se;i[0].x=r.west,i[0].y=r.south,i[1].x=r.west,i[1].y=r.north,i[2].x=r.east,i[2].y=r.south;let s=t.rectangle,l=At.fromRotation(t._stRotation,re),u=E.center(s,ce);for(let f=0;f<3;++f){let t=i[f];t.x-=u.longitude,t.y-=u.latitude,At.multiplyByVector(l,t,t),t.x+=u.longitude,t.y+=u.latitude,t.x=(t.x-s.west)/s.width,t.y=(t.y-s.south)/s.height}let c=i[0],m=i[1],p=i[2],h=new Array(6);return G.pack(c,h),G.pack(m,h,2),G.pack(p,h,4),h}Object.defineProperties(Q.prototype,{rectangle:{get:function(){return $(this._rotatedRectangle)||(this._rotatedRectangle=Ht(this._rectangle,this._granularity,this._rotation,this._ellipsoid)),this._rotatedRectangle}},textureCoordinateRotationPoints:{get:function(){return $(this._textureCoordinateRotationPoints)||(this._textureCoordinateRotationPoints=le(this)),this._textureCoordinateRotationPoints}}});var Ot=Q;function fe(t,e){return $(e)&&(t=Ot.unpack(t,e)),t._ellipsoid=H.clone(t._ellipsoid),t._rectangle=E.clone(t._rectangle),Ot.createGeometry(t)}var Ye=fe;export{Ye as default};