Agriculture-front-end/public/Cesium/Workers/createCorridorGeometry.js

2 lines
16 KiB
JavaScript
Raw Normal View History

2023-04-23 09:41:12 +08:00
define(["./arrayRemoveDuplicates-9b636830","./Transforms-20461479","./Matrix3-81054f0f","./ComponentDatatype-ab629b88","./PolylineVolumeGeometryLibrary-664193d8","./CorridorGeometryLibrary-99cbed9f","./defaultValue-f6d5e6da","./GeometryAttribute-b8117bde","./GeometryAttributes-1e4ddcd2","./GeometryOffsetAttribute-2579b8d2","./IndexDatatype-d3db4e7d","./Math-2ce22ee9","./PolygonPipeline-621b1cb0","./Matrix2-413c4048","./VertexFormat-fbdec922","./combine-0c102d93","./RuntimeError-9b4ce3fb","./WebGLConstants-7f557f93","./EllipsoidTangentPlane-d430e7d5","./AxisAlignedBoundingBox-2c0751ca","./IntersectionTests-a57eed59","./Plane-6add0ae1","./PolylinePipeline-5ae670bc","./EllipsoidGeodesic-2723ab86","./EllipsoidRhumbLine-77eff028"],(function(t,e,r,a,i,o,n,s,l,d,u,m,c,y,f,p,g,h,C,b,A,_,w,v,T){"use strict";const G=new r.Cartesian3,E=new r.Cartesian3,V=new r.Cartesian3,x=new r.Cartesian3,L=new r.Cartesian3,P=new r.Cartesian3,F=new r.Cartesian3,N=new r.Cartesian3;function D(t,e){for(let r=0;r<t.length;r++)t[r]=e.scaleToGeodeticSurface(t[r],t[r]);return t}function M(t,e,a,i,n,s){const l=t.normals,d=t.tangents,u=t.bitangents,m=r.Cartesian3.normalize(r.Cartesian3.cross(a,e,F),F);s.normal&&o.CorridorGeometryLibrary.addAttribute(l,e,i,n),s.tangent&&o.CorridorGeometryLibrary.addAttribute(d,m,i,n),s.bitangent&&o.CorridorGeometryLibrary.addAttribute(u,a,i,n)}function O(t,e,i){const d=t.positions,c=t.corners,y=t.endPositions,f=t.lefts,p=t.normals,g=new l.GeometryAttributes;let h,C,b,A=0,_=0,w=0;for(C=0;C<d.length;C+=2)b=d[C].length-3,A+=b,w+=2*b,_+=d[C+1].length-3;for(A+=3,_+=3,C=0;C<c.length;C++){h=c[C];const t=c[C].leftPositions;n.defined(t)?(b=t.length,A+=b,w+=b):(b=c[C].rightPositions.length,_+=b,w+=b)}const v=n.defined(y);let T;v&&(T=y[0].length-3,A+=T,_+=T,T/=3,w+=6*T);const L=A+_,D=new Float64Array(L),O={normals:e.normal?new Float32Array(L):void 0,tangents:e.tangent?new Float32Array(L):void 0,bitangents:e.bitangent?new Float32Array(L):void 0};let I,S,R,k,H,z,B=0,U=L-1,Y=G,W=E;const q=T/2,J=u.IndexDatatype.createTypedArray(L/3,w);let j=0;if(v){z=V,H=x;const t=y[0];for(Y=r.Cartesian3.fromArray(p,0,Y),W=r.Cartesian3.fromArray(f,0,W),C=0;C<q;C++)z=r.Cartesian3.fromArray(t,3*(q-1-C),z),H=r.Cartesian3.fromArray(t,3*(q+C),H),o.CorridorGeometryLibrary.addAttribute(D,H,B),o.CorridorGeometryLibrary.addAttribute(D,z,void 0,U),M(O,Y,W,B,U,e),S=B/3,k=S+1,I=(U-2)/3,R=I-1,J[j++]=I,J[j++]=S,J[j++]=R,J[j++]=R,J[j++]=S,J[j++]=k,B+=3,U-=3}let K,Q,X=0,Z=0,$=d[X++],tt=d[X++];for(D.set($,B),D.set(tt,U-tt.length+1),W=r.Cartesian3.fromArray(f,Z,W),b=tt.length-3,C=0;C<b;C+=3)K=i.geodeticSurfaceNormal(r.Cartesian3.fromArray($,C,F),F),Q=i.geodeticSurfaceNormal(r.Cartesian3.fromArray(tt,b-C,N),N),Y=r.Cartesian3.normalize(r.Cartesian3.add(K,Q,Y),Y),M(O,Y,W,B,U,e),S=B/3,k=S+1,I=(U-2)/3,R=I-1,J[j++]=I,J[j++]=S,J[j++]=R,J[j++]=R,J[j++]=S,J[j++]=k,B+=3,U-=3;for(K=i.geodeticSurfaceNormal(r.Cartesian3.fromArray($,b,F),F),Q=i.geodeticSurfaceNormal(r.Cartesian3.fromArray(tt,b,N),N),Y=r.Cartesian3.normalize(r.Cartesian3.add(K,Q,Y),Y),Z+=3,C=0;C<c.length;C++){let t;h=c[C];const a=h.leftPositions,s=h.rightPositions;let l,u,m=P,y=V,g=x;if(Y=r.Cartesian3.fromArray(p,Z,Y),n.defined(a)){for(M(O,Y,W,void 0,U,e),U-=3,l=k,u=R,t=0;t<a.length/3;t++)m=r.Cartesian3.fromArray(a,3*t,m),J[j++]=l,J[j++]=u-t-1,J[j++]=u-t,o.CorridorGeometryLibrary.addAttribute(D,m,void 0,U),y=r.Cartesian3.fromArray(D,3*(u-t-1),y),g=r.Cartesian3.fromArray(D,3*l,g),W=r.Cartesian3.normalize(r.Cartesian3.subtract(y,g,W),W),M(O,Y,W,void 0,U,e),U-=3;m=r.Cartesian3.fromArray(D,3*l,m),y=r.Cartesian3.subtract(r.Cartesian3.fromArray(D,3*u,y),m,y),g=r.Cartesian3.subtract(r.Cartesian3.fromArray(D,3*(u-t),g),m,g),W=r.Cartesian3.normalize(r.Cartesian3.add(y,g,W),W),M(O,Y,W,B,void 0,e),B+=3}else{for(M(O,Y,W,B,void 0,e),B+=3,l=R,u=k,t=0;t<s.length/3;t++)m=r.Cartesian3.fromArray(s,3*t,m),J[j++]=l,J[j++]=u+t,J[j++]=u+t+1,o.CorridorGeometryLibrary.addAttribute(D,m,B),y=r.Cartesian3.fromArray(D,3*l,y),g=r.Cartesian3.fromArray(D,3*(u+t),g),W=r.Cartesian3.normalize(r.Cartesian3.subtract(y,g,W),W),M(O,Y,W,B,void 0,e),B+=3;m=r.