sdrangel/plugins/feature/map/Cesium/Workers/EllipseGeometry-fcbbcbac.js

2 lines
15 KiB
JavaScript
Raw Normal View History

2022-02-04 15:41:22 -05:00
define(["exports","./GeometryOffsetAttribute-4f901209","./Transforms-ab7258fe","./Matrix2-46444433","./RuntimeError-608565a6","./ComponentDatatype-692a36d3","./when-229515d6","./EllipseGeometryLibrary-c06dcaf7","./GeometryAttribute-d3bef603","./GeometryAttributes-b253752a","./GeometryInstance-f781740f","./GeometryPipeline-dfaf2218","./IndexDatatype-7c683b18","./VertexFormat-7272aabd"],(function(t,e,i,r,n,o,a,s,l,u,m,c,p,y){"use strict";const d=new r.Cartesian3,f=new r.Cartesian3,A=new r.Cartesian3,x=new r.Cartesian3,h=new r.Cartesian2,g=new r.Matrix3,_=new r.Matrix3,b=new i.Quaternion,C=new r.Cartesian3,w=new r.Cartesian3,E=new r.Cartesian3,M=new r.Cartographic,I=new r.Cartesian3,T=new r.Cartesian2,G=new r.Cartesian2;function N(t,n,m){const c=n.vertexFormat,p=n.center,y=n.semiMajorAxis,x=n.semiMinorAxis,N=n.ellipsoid,P=n.stRotation,F=m?t.length/3*2:t.length/3,v=n.shadowVolume,V=c.st?new Float32Array(2*F):void 0,D=c.normal?new Float32Array(3*F):void 0,O=c.tangent?new Float32Array(3*F):void 0,S=c.bitangent?new Float32Array(3*F):void 0,L=v?new Float32Array(3*F):void 0;let R=0,j=C,z=w,k=E;const B=new i.GeographicProjection(N),Y=B.project(N.cartesianToCartographic(p,M),I),H=N.scaleToGeodeticSurface(p,d);N.geodeticSurfaceNormal(H,H);let U=g,Q=_;if(0!==P){let t=i.Quaternion.fromAxisAngle(H,P,b);U=r.Matrix3.fromQuaternion(t,U),t=i.Quaternion.fromAxisAngle(H,-P,b),Q=r.Matrix3.fromQuaternion(t,Q)}else U=r.Matrix3.clone(r.Matrix3.IDENTITY,U),Q=r.Matrix3.clone(r.Matrix3.IDENTITY,Q);const W=r.Cartesian2.fromElements(Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY,T),J=r.Cartesian2.fromElements(Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY,G);let q=t.length;const Z=m?q:0,K=Z/3*2;for(let e=0;e<q;e+=3){const i=e+1,n=e+2,o=r.Cartesian3.fromArray(t,e,d);if(c.st){const t=r.Matrix3.multiplyByVector(U,o,f),e=B.project(N.cartesianToCartographic(t,M),A);r.Cartesian3.subtract(e,Y,e),h.x=(e.x+y)/(2*y),h.y=(e.y+x)/(2*x),W.x=Math.min(h.x,W.x),W.y=Math.min(h.y,W.y),J.x=Math.max(h.x,J.x),J.y=Math.max(h.y,J.y),m&&(V[R+K]=h.x,V[R+1+K]=h.y),V[R++]=h.x,V[R++]=h.y}(c.normal||c.tangent||c.bitangent||v)&&(j=N.geodeticSurfaceNormal(o,j),v&&(L[e+Z]=-j.x,L[i+Z]=-j.y,L[n+Z]=-j.z),(c.normal||c.tangent||c.bitangent)&&((c.tangent||c.bitangent)&&(z=r.Cartesian3.normalize(r.Cartesian3.cross(r.Cartesian3.UNIT_Z,j,z),z),r.Matrix3.multiplyByVector(Q,z,z)),c.normal&&(D[e]=j.x,D[i]=j.y,D[n]=j.z,m&&(D[e+Z]=-j.x,D[i+Z]=-j.y,D[n+Z]=-j.z)),c.tangent&&(O[e]=z.x,O[i]=z.y,O[n]=z.z,m&&(O[e+Z]=-z.x,O[i+Z]=-z.y,O[n+Z]=-z.z)),c.bitangent&&(k=r.Cartesian3.normalize(r.Cartesian3.cross(j,z,k),k),S[e]=k.x,S[i]=k.y,S[n]=k.z,m&&(S[e+Z]=k.x,S[i+Z]=k.y,S[n+Z]=k.z))))}if(c.st){q=V.length;for(let t=0;t<q;t+=2)V[t]=(V[t]-W.x)/(J.x-W.x),V[t+1]=(V[t+1]-W.y)/(J.y-W.y)}const X=new u.GeometryAttributes;if(c.position){const e=s.EllipseGeometryLibrary.raisePositionsToHeight(t,n,m);X.position=new l.GeometryAttribute({componentDatatype:o.ComponentDatatype.DOUBLE,componentsPerAttribute:3,values:e})}if(c.st&&(X.st=new l.GeometryAttribute({componentDatatype:o.ComponentDatatype.FLOAT,componentsPerAttribute:2,values:V})),c.normal&&(X.normal=new l.GeometryAttribute({componentDatatype:o.ComponentDatatype.FLOAT,componentsPerAttribute:3,values:D})),c.tangent&&(X.tangent=new l.GeometryAttribute({componentDatatype:o.ComponentDatatype.FLOAT,componentsPerAttribute:3,values:O})),c.bitangent&&(X.bitangent=new l.GeometryAttribute({componentDatatype:o.ComponentDatatype.FLOAT,componentsPerAttribute:3,values:S})),v&&(X.extrudeDirection=new l.GeometryAttribute({componentDatatype:o.ComponentDatatype.FLOAT,componentsPerAttribute:3,values:L})),m&&a.defined(n.offsetAttribute)){let t=new Uint8Array(F);if(n.offsetAttribute===e.GeometryOffsetAttribute.TOP)t=e.arrayFill(t,1,0,F/2);else{const i=n.offsetAttribute===e.GeometryOffsetAttribute.NONE?0:1;t=e.arrayFill(t,i)}X.applyOffset=new l.GeometryAttribute({componentDatatype:o.ComponentDatatype.UNSIGNED_BYTE,componentsPerAttribute:1,values:t})}return X}function P(t){const e=new Array(t*(t+1)*12-6);let i,r,n,o,a,s=0;for(i=0,n=1,o=0;o<3;o++)e[s++]=n++,e[s++]=i,e[s++]=n;for(o=