YZProjectCloud/yanzhu-ui-vue3/public/Engine/Workers/PolylineVolumeGeometryLibra...

2 lines
8.2 KiB
JavaScript
Raw Normal View History

2025-04-07 00:55:58 +08:00
define(["exports","./Matrix2-e3fb4559","./Cartesian3-7e9cc2ff","./Matrix4-d34187af","./defaultValue-81eec7ed","./EllipsoidTangentPlane-fa1337e1","./Math-5f585871","./PolylinePipeline-de59c85a","./Transforms-98ffa11d"],(function(e,a,t,n,r,i,s,o,l){"use strict";var c=Object.freeze({ROUNDED:0,MITERED:1,BEVELED:2});const C=[new t.Cartesian3,new t.Cartesian3],u=new t.Cartesian3,f=new t.Cartesian3,y=new t.Cartesian3,d=new t.Cartesian3,m=new t.Cartesian3,w=new t.Cartesian3,p=new t.Cartesian3,x=new t.Cartesian3,g=new t.Cartesian3,h=new t.Cartesian3,M=new t.Cartesian3,T={};let P=new a.Cartographic;function E(e,a,n,r){const i=e[0],s=e[1],o=t.Cartesian3.angleBetween(i,s),l=Math.ceil(o/r),c=new Array(l);let C;if(a===n){for(C=0;C<l;C++)c[C]=a;return c.push(n),c}const u=(n-a)/l;for(C=1;C<l;C++){const e=a+C*u;c[C]=e}return c[0]=a,c.push(n),c}const B=new t.Cartesian3,z=new t.Cartesian3;const A=new t.Cartesian3(-1,0,0);let D=new n.Matrix4;const S=new n.Matrix4;let b=new n.Matrix3;const I=n.Matrix3.IDENTITY.clone(),N=new t.Cartesian3,O=new n.Cartesian4,V=new t.Cartesian3;function F(e,s,o,c,C,u,f,y,d,m,w,p){let x=O;if(D=l.Transforms.eastNorthUpToFixedFrame(e,C,D),r.defined(m)||(m=new t.Cartesian3),0===m.z){let r=N;r=n.Matrix4.multiplyByPointAsVector(D,A,r),r=t.Cartesian3.normalize(r,r);const o=function(e,n,r,s){const o=new i.EllipsoidTangentPlane(r,s),l=o.projectPointOntoPlane(t.Cartesian3.add(r,e,B),B),c=o.projectPointOntoPlane(t.Cartesian3.add(r,n,z),z),C=a.Cartesian2.angleBetween(l,c);return c.x*l.y-c.y*l.x>=0?-C:C}(r,s,e,C);b=n.Matrix3.fromRotationZ(o)}else{let e=t.Cartesian3.subtract(d[1],d[0],new t.Cartesian3);e=t.Cartesian3.normalize(e,e);const a=new t.Cartesian3(0,0,-1);let r=new t.Cartesian3;t.Cartesian3.cross(a,e,r);t.Cartesian3.magnitude(r)<1e-5&&(r=a),t.Cartesian3.normalize(r,r);const i=t.Cartesian3.angleBetween(a,e),s=l.Quaternion.fromAxisAngle(r,i);b=n.Matrix3.fromQuaternion(s)}V.z=u,D=n.Matrix4.multiplyTransformation(D,n.Matrix4.fromRotationTranslation(b,V,S),D);const g=I;g[0]=f;for(let e=0;e<y;e++)for(let e=0;e<o.length;e+=3)x=t.Cartesian3.fromArray(o,e,x),x=n.Matrix3.multiplyByVector(g,x,x),x=n.Matrix4.multiplyByPoint(D,x,x),1===w&&(x=n.Matrix4.multiplyByPoint(p,x,x)),c.push(x.x,x.y,x.z);return c}const G=new t.Cartesian3;function _(e,a,n,r,i,s,o,l,c,C,u){for(let f=0;f<e.length;f+=3){r=F(t.Cartesian3.fromArray(e,f,G),a,n,r,i,s[f/3],o,1,l,c,C,u)}return r}function L(e,a,n){const i=e.length,s=new Array(3*i);let o=0;const l=a.x+a.width/2,c=a.y+a.height/2;if(r.defined(n)||(n=new t.Cartesian3),0===n.z)for(let a=0;a<i;a++)s[o++]=e[a].x-l,s[o++]=0,s[o++]=e[a].y-c;else for(let a=0;a<i;a++)s[o++]=e[a].x-l,s[o++]=e[a].y-c,s[o++]=0;return s}const Q=new l.Quaternion,R=new t.Cartesian3,v=new n.Matrix3;function j(e,a,r,i,o,C,u,f,y,d){const m=t.Cartesian3.angleBetween(t.Cartesian3.subtract(a,e,h),t.Cartesian3.subtract(r,e,M)),w=i===c.BEVELED?0:Math.ceil(m/s.CesiumMath.toRadians(5));let p,x,g;if(p=o?n.Matrix3.fromQuaternion(l.Quaternion.fromAxisAngle(t.Cartesian3.negate(e,h),m/(w+1),Q),v):n.Matrix3.fromQuaternion(l.Quaternion.fromAxisAngle(e,m/(w+1),Q),v),a=t.Cartesian3.clone(a,R),w>0){const r=d?2:1;for(let i=0;i<w;i++)a=n.Matrix3.multiplyByVector(p,a,a),x=t.Cartesian3.subtract(a,e,h),x=t.Cartesian3.normalize(x,x),o||(x=t.Cartesian3.negate(x,x)),g=C.scaleToGeodeticSurface(a,M),u=F(g,x,f,u,C,y,1,r,0,n.Matrix4.IDENTITY)}else x=t.Cartesian3.subtract(a,e,h),x=t.Cartesian3.normalize(x,x),o||(x=t.Cartesian3.negate(x,x)),g=C.scaleToGeodeticSurface(a,M),u=F(g,x,f,u,C,y,1,1,0,n.Matrix4.IDENTITY),r=t.Cartesian3.clone(r,R),x=t.Cartesian3.subtract(r,e,h),x=t.Cartesian3.normalize(x,x),o||(x=t.Cartesian3.negate(x,x)),g=C.scaleToGeodeticSurface(r,M),u=F(g,x,f,u,C,y,1,1,0,n.Matrix4.IDENTITY);return u}T.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},T.angleIsGreaterThanPi=function(e,a,n,r){const s=new i.EllipsoidTangentPlane(n,r),o=s.projectPointOntoPlane(t.Cartesian3.add(n,e,B),B),l=s.projectPointOntoPlane(t.Cartesian3.add(n,a,z),z);return l.x*o.y-l