/** * @license * Cesium - https://github.com/CesiumGS/cesium * Version 1.96.6 * * 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(["exports","./Matrix2-4706dd70","./EllipsoidTangentPlane-100869c1","./ComponentDatatype-438cad2a","./PolylinePipeline-52ab0181","./Transforms-66eda18c","./defaultValue-028a8a27","./RuntimeError-a977b8e0"],(function(e,a,t,n,r,i,o,s){"use strict";var l=Object.freeze({ROUNDED:0,MITERED:1,BEVELED:2});const c={};function C(e,a){if(!o.defined(e))throw new s.DeveloperError("identifier is required.");o.defined(c[e])||(c[e]=!0,console.warn(o.defaultValue(a,e)))}C.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.",C.geometryZIndex="Entity geometry with zIndex are unsupported when height or extrudedHeight are defined. zIndex will be ignored",C.geometryHeightReference="Entity corridor, ellipse, polygon or rectangle with heightReference must also have a defined height. heightReference will be ignored",C.geometryExtrudedHeightReference="Entity corridor, ellipse, polygon or rectangle with extrudedHeightReference must also have a defined extrudedHeight. extrudedHeightReference will be ignored";const u=[new a.Cartesian3,new a.Cartesian3],d=new a.Cartesian3,g=new a.Cartesian3,y=new a.Cartesian3,m=new a.Cartesian3,f=new a.Cartesian3,h=new a.Cartesian3,p=new a.Cartesian3,w=new a.Cartesian3,x=new a.Cartesian3,E=new a.Cartesian3,P=new a.Cartesian3,M={};let b=new a.Cartographic;function T(e,a){const t=new Array(e.length);for(let n=0;n<e.length;n++){const r=e[n];b=a.cartesianToCartographic(r,b),t[n]=b.height,e[n]=a.scaleToGeodeticSurface(r,r)}return t}function B(e,t,n,r){const i=e[0],o=e[1],s=a.Cartesian3.angleBetween(i,o),l=Math.ceil(s/r),c=new Array(l);let C;if(t===n){for(C=0;C<l;C++)c[C]=t;return c.push(n),c}const u=(n-t)/l;for(C=1;C<l;C++){const e=t+C*u;c[C]=e}return c[0]=t,c.push(n),c}const z=new a.Cartesian3,S=new a.Cartesian3;function A(e,n,r,i){const o=new t.EllipsoidTangentPlane(r,i),s=o.projectPointOntoPlane(a.Cartesian3.add(r,e,z),z),l=o.projectPointOntoPlane(a.Cartesian3.add(r,n,S),S),c=a.Cartesian2.angleBetween(s,l);return l.x*s.y-l.y*s.x>=0?-c:c}const D=new a.Cartesian3(-1,0,0);let R=new a.Matrix4;const O=new a.Matrix4;let V=new a.Matrix3;const I=a.Matrix3.IDENTITY.clone(),v=new a.Cartesian3,N=new a.Cartesian4,G=new a.Cartesian3;function H(e,t,n,r,o,s,l,c){let C=v,u=N;R=i.Transforms.eastNorthUpToFixedFrame(e,o,R),C=a.Matrix4.multiplyByPointAsVector(R,D,C),C=a.Cartesian3.normalize(C,C);const d=A(C,t,e,o);V=a.Matrix3.fromRotationZ(d,V),G.z=s,R=a.Matrix4.multiplyTransformation(R,a.Matrix4.fromRotationTranslation(V,G,O),R);const g=I;g[0]=l;for(let i=0;i<c;i++)for(let e=0;e<n.length;e+=3)u=a.Cartesian3.fromArray(n,e,u),u=a.Matrix3.multiplyByVector(g,u,u),u=a.Matrix4.multiplyByPoint(R,u,u),r.push(u.x,u.y,u.z);return r}const L=new a.Cartesian3;function j(e,t,n,r,i,o,s){for(let l=0;l<e.length;l+=3){const c=a.Cartesian3.fromArray(e,l,L);r=H(c,t,n,r,i,o[l/3],s,1)}return r}function q(e,a){const t=e.length,n=new Array(6*t);let r=0;const i=a.x+a.width/2,o=a.y+a.height/2;let s=e[0];n[r++]=s.x-i,n[r++]=0,n[r++]=s.y-o;for(let l=1;l<t;l++){s=e[l];const a=s.x-i,t=s.y-o;n[r++]=a,n[r++]=0,n[r++]=t,n[r++]=a,n[r++]=0,n[r++]=t}return s=e[0],n[r++]=s.x-i,n[r++]=0,n[r++]=s.y-o,n}function Q(e,a){const t=e.length,n=new Array(3*t);let r=0;const i=a.x+a.width/2,o=a.y+a.height/2;for(let s=0;s<t;s++)n[r++]=e[s].x-i,n[r++]=0,n[r++]=e[s].y-o;return n}const F=new i.Quaternion,U=new a.Cartesian3,_=new a.Matrix3;function Z(e,t,r,o,s,c,C,u,d,g){const y=a.Cartesian3.angleBetween(a.Cartesian3.subtract(t,e,E),a.Cartesian3.subtract(r,e,P)),m=o===l.BEVELED?0:Math.ceil(y/n.CesiumMath.toRadians(5));let f,h,p;if(f=s?a.Matrix3.fromQuaternion(i.Quaternion.fromAxisAngle(a.Cartesian3.negate(e,E),y/(m+1),F),_):a.Matrix3.fromQuaternion(i.Quaternion.fromAxisAngle(e,y/(m+1),F),_),t=a.Cartesian3.clone(t,U),m>0){const n=g?2:1;for(let r=0;r<m;r++)t=a.Matrix3.multiplyByVector(f,t,t),h=a.Cartesian3.subtract(t,e,E),h=a.Cartesian3.normalize(h,h),s||(h=a.Cartesian3.negate(h,h)),p=c.scaleToGeodeticSurface(t,P),C=H(p,h,u,C,c,d,1,n)}else h=a.Cartesian3.subtract(t,e,E),h=a.Cartesian3.normalize(h,h),s||(h=a.Cartesian3.negate(h,h)),p=c.scaleToGeodeticSurface(t,P),C=H(p,h,u,C,c,d,1,1),r=a.Cartesian3.clone(r,U),h=a.Cartesian3.subtract(r,e,E),h=a.Cartesian3.normalize(h,h),s||(h=a.Cartesian3.negate(h,h)),p=c.scaleToGeodeticSurface(r,P),C=H(p,h,u,C,c,d,1,1);return C}M.removeDuplicatesFromShape=function(e){const t=e.length,n=[];for(let r=t-1,i=0;i<t;r=i++){const t=e[r],o=e[i];a.Cartesian2.equals(t,o)||n.push(o)}return n},M.angleIsGreaterThanPi=function(e,n,r,i){const o=new t.EllipsoidTangentPlane(r,i),s=o.projectPointOntoPlane(a.Cartesian3.add(r,e,z),z),l=o.projectPointOntoPlane(a.Cartesian3.add(r,n,S),S);return l.x*s.y-l.y*s.x>=0};const W=new a.Cartesian3,Y=new a.Cartesian3;M.computePositions=function(e,t,i,o,s){const c=o._ellipsoid,P=T(e,c),b=o._granularity,z=o._cornerType,S=s?q(t,i):Q(t,i),A=s?Q(t,i):void 0,D=i.height/2,R=i.width/2;let O=e.length,V=[],I=s?[]:void 0,v=d,N=g,G=y,L=m,F=f,U=h,_=p,k=w,J=x,K=e[0],X=e[1];L=c.geodeticSurfaceNormal(K,L),v=a.Cartesian3.subtract(X,K,v),v=a.Cartesian3.normalize(v,v),k=a.Cartesian3.cross(L,v,k),k=a.Cartesian3.normalize(k,k);let $,ee,ae=P[0],te=P[1];s&&(I=H(K,k,A,I,c,ae+D,1,1)),J=a.Cartesian3.clone(K,J),K=X,N=a.Cartesian3.negate(v,N);for(let d=1;d<O-1;d++){const t=s?2:1;if(X=e[d+1],K.equals(X)){C("Positions are too close and are considered equivalent with rounding error.");continue}v=a.Cartesian3.subtract(X,K,v),v=a.Cartesian3.normalize(v,v),G=a.Cartesian3.add(v,N,G),G=a.Cartesian3.normalize(G,G),L=c.geodeticSurfaceNormal(K,L);const i=a.Cartesian3.multiplyByScalar(L,a.Cartesian3.dot(v,L),W);a.Cartesian3.subtract(v,i,i),a.Cartesian3.normalize(i,i);const o=a.Cartesian3.multiplyByScalar(L,a.Cartesian3.dot(N,L),Y);if(a.Cartesian3.subtract(N,o,o),a.Cartesian3.normalize(o,o),n.CesiumMath.equalsEpsilon(Math.abs(a.Cartesian3.dot(i,o)),1,n.CesiumMath.EPSILON7))V=H(J,k,S,V,c,ae+D,1,1),J=K;else{G=a.Cartesian3.cross(G,L,G),G=a.Cartesian3.cross(L,G,G),G=a.Cartesian3.normalize(G,G);const e=1/Math.max(.25,a.Cartesian3.magnitude(a.Cartesian3.cross(G,N,E))),n=M.angleIsGreaterThanPi(v,N,K,c);n?(F=a.Cartesian3.add(K,a.Cartesian3.multiplyByScalar(G,e*R,G),F),U=a.Cartesian3.add(F,a.Cartesian3.multiplyByScalar(k,R,U),U),u[0]=a.Cartesian3.clone(J,u[0]),u[1]=a.Cartesian3.clone(U,u[1]),$=B(u,ae+D,te+D,b),ee=r.PolylinePipeline.generateArc({positions:u,granularity:b,ellipsoid:c}),V=j(ee,k,S,V,c,$,1),k=a.Cartesian3.cross(L,v,k),k=a.Cartesian3.normalize(k,k),_=a.Cartesian3.add(F,a.Cartesian3.multiplyByScalar(k,R,_),_),z===l.ROUNDED||z===l.BEVELED?Z(F,U,_,z,n,c,V,S,te+D,s):(G=a.Cartesian3.negate(G,G),V=H(K,G,S,V,c,te+D,e,t)),J=a.Cartesian3.clone(_,J)):(F=a.Cartesian3.add(K,a.Cartesian3.multiplyByScalar(G,e*R,G),F),U=a.Cartesian3.add(F,a.Cartesian3.multiplyByScalar(k,-R,U),U),u[0]=a.Cartesian3.clone(J,u[0]),u[1]=a.Cartesian3.clone(U,u[1]),$=B(u,ae+D,te+D,b),ee=r.PolylinePipeline.generateArc({positions:u,granularity:b,ellipsoid:c}),V=j(ee,k,S,V,c,$,1),k=a.Cartesian3.cross(L,v,k),k=a.Cartesian3.normalize(k,k),_=a.Cartesian3.add(F,a.Cartesian3.multiplyByScalar(k,-R,_),_),z===l.ROUNDED||z===l.BEVELED?Z(F,U,_,z,n,c,V,S,te+D,s):V=H(K,G,S,V,c,te+D,e,t),J=a.Cartesian3.clone(_,J)),N=a.Cartesian3.negate(v,N)}ae=te,te=P[d+1],K=X}u[0]=a.Cartesian3.clone(J,u[0]),u[1]=a.Cartesian3.clone(K,u[1]),$=B(u,ae+D,te+D,b),ee=r.PolylinePipeline.generateArc({positions:u,granularity:b,ellipsoid:c}),V=j(ee,k,S,V,c,$,1),s&&(I=H(K,k,A,I,c,te+D,1,1)),O=V.length;const ne=s?O+I.length:O,re=new Float64Array(ne);return re.set(V),s&&re.set(I,O),re},e.CornerType=l,e.PolylineVolumeGeometryLibrary=M,e.oneTimeWarning=C}));