/** * @license * Cesium - https://github.com/CesiumGS/cesium * Version 1.109.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 _}from"./chunk-NNSHYJPQ.js";import{a as te}from"./chunk-GTVOTRDF.js";import{f as Z,i as me}from"./chunk-FCJU2DRX.js";import{a as fe,b as j,d as ee}from"./chunk-Y3I2OBKV.js";import{a as e,b as ie,d as O}from"./chunk-WADCMYQO.js";import{a as Q}from"./chunk-2LQD2HPA.js";import{a as se}from"./chunk-3B6S2GOO.js";import{a as le}from"./chunk-EYEHMX6X.js";import{e as $}from"./chunk-BWKFPVR5.js";var Se={ROUNDED:0,MITERED:1,BEVELED:2},G=Object.freeze(Se),ue={};function P(e,t){if(!$(e))throw new le("identifier is required.");$(ue[e])||(ue[e]=!0,console.warn(se(t,e)))}P.geometryOutlines="Entity geometry outlines are unsupported on terrain. Outlines will be disabled. To enable outlines, disable geometry terrain clamping by explicitly setting height to 0.",P.geometryZIndex="Entity geometry with zIndex are unsupported when height or extrudedHeight are defined. zIndex will be ignored",P.geometryHeightReference="Entity corridor, ellipse, polygon or rectangle with heightReference must also have a defined height. heightReference will be ignored",P.geometryExtrudedHeightReference="Entity corridor, ellipse, polygon or rectangle with extrudedHeightReference must also have a defined extrudedHeight. extrudedHeightReference will be ignored";var he=P,w=[new e,new e],Te=new e,Be=new e,Ce=new e,ze=new e,Ae=new e,be=new e,Oe=new e,ve=new e,De=new e,I=new e,W=new e,R={},re=new ie;function je(e,t){let n=new Array(e.length);for(let r=0;r<e.length;r++){let o=e[r];re=t.cartesianToCartographic(o,re),n[r]=re.height,e[r]=t.scaleToGeodeticSurface(o,o)}return n}function ne(t,n,r,o){let a,l=t[0],i=t[1],c=e.angleBetween(l,i),s=Math.ceil(c/o),u=new Array(s);if(n===r){for(a=0;a<s;a++)u[a]=n;return u.push(r),u}let d=(r-n)/s;for(a=1;a<s;a++){let e=n+a*d;u[a]=e}return u[0]=n,u.push(r),u}var X=new e,Y=new e;function He(t,n,r,o){let a=new te(r,o),l=a.projectPointOntoPlane(e.add(r,t,X),X),i=a.projectPointOntoPlane(e.add(r,n,Y),Y),c=ee.angleBetween(l,i);return i.x*l.y-i.y*l.x>=0?-c:c}var Me=new e(-1,0,0),H=new j,Ve=new j,oe=new O,Ne=O.IDENTITY.clone(),Fe=new e,Ge=new fe,de=new e;function v(t,n,r,o,a,l,i,c){let s=Fe,u=Ge;H=me.eastNorthUpToFixedFrame(t,a,H),s=j.multiplyByPointAsVector(H,Me,s),s=e.normalize(s,s);let d=He(s,n,t,a);oe=O.fromRotationZ(d,oe),de.z=l,H=j.multiplyTransformation(H,j.fromRotationTranslation(oe,de,Ve),H);let w=Ne;w[0]=i;for(let m=0;m<c;m++)for(let t=0;t<r.length;t+=3)u=e.fromArray(r,t,u),u=O.multiplyByVector(w,u,u),u=j.multiplyByPoint(H,u,u),o.push(u.x,u.y,u.z);return o}var Ie=new e;function ce(t,n,r,o,a,l,i){for(let c=0;c<t.length;c+=3){let s=e.fromArray(t,c,Ie);o=v(s,n,r,o,a,l[c/3],i,1)}return o}function Le(e,t){let n=e.length,r=new Array(6*n),o=0,a=t.x+t.width/2,l=t.y+t.height/2,i=e[0];r[o++]=i.x-a,r[o++]=0,r[o++]=i.y-l;for(let c=1;c<n;c++){i=e[c];let t=i.x-a,n=i.y-l;r[o++]=t,r[o++]=0,r[o++]=n,r[o++]=t,r[o++]=0,r[o++]=n}return i=e[0],r[o++]=i.x-a,r[o++]=0,r[o++]=i.y-l,r}function ge(e,t){let n=e.length,r=new Array(3*n),o=0,a=t.x+t.width/2,l=t.y+t.height/2;for(let i=0;i<n;i++)r[o++]=e[i].x-a,r[o++]=0,r[o++]=e[i].y-l;return r}var ye=new Z,we=new e,pe=new O;function xe(t,n,r,o,a,l,i,c,s,u){let d,w,m,g=e.angleBetween(e.subtract(n,t,I),e.subtract(r,t,W)),h=o===G.BEVELED?0:Math.ceil(g/Q.toRadians(5));if(d=a?O.fromQuaternion(Z.fromAxisAngle(e.negate(t,I),g/(h+1),ye),pe):O.fromQuaternion(Z.fromAxisAngle(t,g/(h+1),ye),pe),n=e.clone(n,we),h>0){let r=u?2:1;for(let o=0;o<h;o++)n=O.multiplyByVector(d,n,n),w=e.subtract(n,t,I),w=e.normalize(w,w),a||(w=e.negate(w,w)),m=l.scaleToGeodeticSurface(n,W),i=v(m,w,c,i,l,s,1,r)}else w=e.subtract(n,t,I),w=e.normalize(w,w),a||(w=e.negate(w,w)),m=l.scaleToGeodeticSurface(n,W),i=v(m,w,c,i,l,s,1,1),r=e.clone(r,we),w=e.subtract(r,t,I),w=e.normalize(w,w),a||(w=e.negate(w,w)),m=l.scaleToGeodeticSurface(r,W),i=v(m,w,c,i,l,s,1,1);return i}R.removeDuplicatesFromShape=function(e){let t=e.length,n=[];for(let r=t-1,o=0;o<t;r=o++){let t=e[r],a=e[o];ee.equals(t,a)||n.push(a)}return n},R.angleIsGreaterThanPi=function(t,n,r,o){let a=new te(r,o),l=a.projectPointOntoPlane(e.add(r,t,X),X),i=a.projectPointOntoPlane(e.add(r,n,Y),Y);return i.x*l.y-i.y*l.x>=0};var qe=new e,Pe=new e;R.computePositions=function(t,n,r,o,a){let l=o._ellipsoid,i=je(t,l),c=o._granularity,s=o._cornerType,u=a?Le(n,r):ge(n,r),d=a?ge(n,r):void 0,m=r.height/2,g=r.width/2,h=t.length,f=[],y=a?[]:void 0,p=Te,x=Be,E=Ce,O=ze,P=Ae,b=be,B=Oe,j=ve,z=De,S=t[0],A=t[1];O=l.geodeticSurfaceNormal(S,O),p=e.subtract(A,S,p),p=e.normalize(p,p),j=e.cross(O,p,j),j=e.normalize(j,j);let D,H,T=i[0],N=i[1];a&&(y=v(S,j,d,y,l,T+m,1,1)),z=e.clone(S,z),S=A,x=e.negate(p,x);for(let k=1;k<h-1;k++){let n=a?2:1;if(A=t[k+1],S.equals(A)){he("Positions are too close and are considered equivalent with rounding error.");continue}p=e.subtract(A,S,p),p=e.normalize(p,p),E=e.add(p,x,E),E=e.normalize(E,E),O=l.geodeticSurfaceNormal(S,O);let r=e.multiplyByScalar(O,e.dot(p,O),qe);e.subtract(p,r,r),e.normalize(r,r);let o=e.multiplyByScalar(O,e.dot(x,O),Pe);if(e.subtract(x,o,o),e.normalize(o,o),Q.equalsEpsilon(Math.abs(e.dot(r,o)),1,Q.EPSILON7))f=v(z,j,u,f,l,T+m,1,1),z=S;else{E=e.cross(E,O,E),E=e.cross(O,E,E),E=e.normalize(E,E);let t=1/Math.max(.25,e.magnitude(e.cross(E,x,I))),r=R.angleIsGreaterThanPi(p,x,S,l);r?(P=e.add(S,e.multiplyByScalar(E,t*g,E),P),b=e.add(P,e.multiplyByScalar(j,g,b),b),w[0]=e.clone(z,w[0]),w[1]=e.clone(b,w[1]),D=ne(w,T+m,N+m,c),H=_.generateArc({positions:w,granularity:c,ellipsoid:l}),f=ce(H,j,u,f,l,D,1),j=e.cross(O,p,j),j=e.normalize(j,j),B=e.add(P,e.multiplyByScalar(j,g,B),B),s===G.ROUNDED||s===G.BEVELED?xe(P,b,B,s,r,l,f,u,N+m,a):(E=e.negate(E,E),f=v(S,E,u,f,l,N+m,t,n)),z=e.clone(B,z)):(P=e.add(S,e.multiplyByScalar(E,t*g,E),P),b=e.add(P,e.multiplyByScalar(j,-g,b),b),w[0]=e.clone(z,w[0]),w[1]=e.clone(b,w[1]),D=ne(w,T+m,N+m,c),H=_.generateArc({positions:w,granularity:c,ellipsoid:l}),f=ce(H,j,u,f,l,D,1),j=e.cross(O,p,j),j=e.normalize(j,j),B=e.add(P,e.multiplyByScalar(j,-g,B),B),s===G.ROUNDED||s===G.BEVELED?xe(P,b,B,s,r,l,f,u,N+m,a):f=v(S,E,u,f,l,N+m,t,n),z=e.clone(B,z)),x=e.negate(p,x)}T=N,N=i[k+1],S=A}w[0]=e.clone(z,w[0]),w[1]=e.clone(S,w[1]),D=ne(w,T+m,N+m,c),H=_.generateArc({positions:w,granularity:c,ellipsoid:l}),f=ce(H,j,u,f,l,D,1),a&&(y=v(S,j,d,y,l,N+m,1,1)),h=f.length;let V=a?h+y.length:h,Y=new Float64Array(V);return Y.set(f),a&&Y.set(y,h),Y};var lt=R;export{G as a,he as b,lt as c};