Files
4.0/static/sdk/Cesium/Workers/PolylineVolumeGeometryLibrary-6a648b4f.js

26 lines
8.2 KiB
JavaScript
Raw Normal View History

2025-07-03 17:39:09 +08:00
/**
* @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(["exports","./Matrix2-cf4c6e69","./EllipsoidTangentPlane-2597ceda","./ComponentDatatype-9b23164a","./PolylinePipeline-98b8bcbb","./Transforms-c9e418cb","./defaultValue-50f7432c"],(function(e,a,t,n,r,i,s){"use strict";var o=Object.freeze({ROUNDED:0,MITERED:1,BEVELED:2});const l={};function c(e,a){s.defined(l[e])||(l[e]=!0,console.warn(s.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 C=[new a.Cartesian3,new a.Cartesian3],u=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={};let b=new a.Cartographic;function M(e,t,n,r){const i=e[0],s=e[1],o=a.Cartesian3.angleBetween(i,s),l=Math.ceil(o/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 T=new a.Cartesian3,B=new a.Cartesian3;const z=new a.Cartesian3(-1,0,0);let S=new a.Matrix4;const A=new a.Matrix4;let D=new a.Matrix3;const R=a.Matrix3.IDENTITY.clone(),O=new a.Cartesian3,V=new a.Cartesian4,I=new a.Cartesian3;function v(e,n,r,s,o,l,c,C){let u=O,d=V;S=i.Transforms.eastNorthUpToFixedFrame(e,o,S),u=a.Matrix4.multiplyByPointAsVector(S,z,u),u=a.Cartesian3.normalize(u,u);const g=function(e,n,r,i){const s=new t.EllipsoidTangentPlane(r,i),o=s.projectPointOntoPlane(a.Cartesian3.add(r,e,T),T),l=s.projectPointOntoPlane(a.Cartesian3.add(r,n,B),B),c=a.Cartesian2.angleBetween(o,l);return l.x*o.y-l.y*o.x>=0?-c:c}(u,n,e,o);D=a.Matrix3.fromRotationZ(g,D),I.z=l,S=a.Matrix4.multiplyTransformation(S,a.Matrix4.fromRotationTranslation(D,I,A),S);const y=R;y[0]=c;for(let e=0;e<C;e++)for(let e=0;e<r.length;e+=3)d=a.Cartesian3.fromArray(r,e,d),d=a.Matrix3.multiplyByVector(y,d,d),d=a.Matrix4.multiplyByPoint(S,d,d),s.push(d.x,d.y,d.z);return s}const N=new a.Cartesian3;function G(e,t,n,r,i,s,o){for(let l=0;l<e.length;l+=3){r=v(a.Cartesian3.fromArray(e,l,N),t,n,r,i,s[l/3],o,1)}return r}function H(e,a){const t=e.length,n=new Array(3*t);let r=0;const i=a.x+a.width/2,s=a.y+a.height/2;for(let a=0;a<t;a++)n[r++]=e[a].x-i,n[r++]=0,n[r++]=e[a].y-s;return n}const L=new i.Quaternion,j=new a.Cartesian3,Q=new a.Matrix3;function q(e,t,r,s,l,c,C,u,d,g){const y=a.Cartesian3.angleBetween(a.Cartesian3.subtract(t,e,x),a.Cartesian3.subtract(r,e,E)),m=s===o.BEVELED?0:Math.ceil(y/n.CesiumMath.toRadians(5));let f,h,p;if(f=l?a.Matrix3.fromQuaternion(i.Quaternion.fromAxisAngle(a.Cartesian3.negate(e,x),y/(m+1),L),Q):a.Matrix3.fromQuaternion(i.Quaternion.fromAxisAngle(e,y/(m+1),L),Q),t=a.Cartesian3.clone(t,j),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,x),h=a.Cartesian3.normalize(h,h),l||(h=a.Cartesian3.negate(h,h)),p=c.scaleToGeodeticSurface(t,E),C=v(p,h,u,C,c,d,1,n)}else h=a.Cartesian3.subtract(t,e,x),h=a.Cartesian3.normalize(h,h),l||(h=a.Cartesian3.negate(h,h)),p=c.scaleToGeodeticSurface(t,E),C=v(p,h,u,C,c,d,1,1),r=a.Cartesian3.clone(r,j),h=a.Cartesian3.subtract(r,e,x),h=a.Cartesian3.normalize(h,h),l||(h=a.Cartesian3.negate(h,h)),p=c.scaleToGeodeticSurface(r,E),C=v(p,h,u,C,c,d,1,1);return C}P.removeDuplicatesFromShape=function(e){const t=e.length,n=[];for(let r=t-1,i=0;i<t;r=i++){const t=e[r],s=e[i];a.Cartesian2.equals(t,s)||n.push(s)}return n},P.angleIsGreaterThanPi=function(e,n,r,i){const s=new t.EllipsoidTangentPlane(r,i),o=s.projectPointOntoPlane(a.Ca