Agriculture-front-end/dist/Cesium/Workers/createCoplanarPolygonGeometry.js

2 lines
6.3 KiB
JavaScript
Raw Normal View History

2023-09-11 21:56:39 +08:00
define(["./arrayRemoveDuplicates-d2f048c5","./BoundingRectangle-01b3e970","./BoundingSphere-561b54d0","./Cartesian2-47311507","./Cartographic-3309dd0d","./Check-7b2a090c","./ComponentDatatype-c140a87d","./CoplanarPolygonGeometryLibrary-de8c7233","./when-b60132fc","./GeometryAttribute-3a42bbdc","./GeometryAttributes-252e9929","./GeometryInstance-41780fb6","./GeometryPipeline-e1b82a4e","./IndexDatatype-8a5eead4","./Math-119be1a3","./PolygonGeometryLibrary-ae9ad77c","./PolygonPipeline-f49953b9","./PrimitiveType-39acab88","./Transforms-cb0006b0","./VertexFormat-6446fca0","./Cartesian4-3ca25aab","./RuntimeError-4a5c8994","./WebGLConstants-4ae0db90","./OrientedBoundingBox-f1d7843f","./EllipsoidTangentPlane-b2b18d75","./IntersectionTests-0c6d0a14","./Plane-097b3a8f","./AttributeCompression-90851096","./EncodedCartesian3-f1396b05","./ArcType-29cf2197","./EllipsoidRhumbLine-ed1a6bf4","./earcut-2.2.1-20c8012f","./buildModuleUrl-3addfe33","./FeatureDetection-c3b71206"],(function(e,t,a,n,r,o,i,l,s,p,c,y,u,m,d,g,b,v,h,f,C,x,P,w,A,F,G,L,E,T,D,_,k,V){"use strict";var R=new r.Cartesian3,M=new t.BoundingRectangle,I=new n.Cartesian2,B=new n.Cartesian2,H=new r.Cartesian3,O=new r.Cartesian3,S=new r.Cartesian3,z=new r.Cartesian3,N=new r.Cartesian3,Q=new r.Cartesian3,U=new h.Quaternion,j=new a.Matrix3,Y=new a.Matrix3,q=new r.Cartesian3;function J(e,t,o,l,s,y,u,g){var f=e.positions,C=b.PolygonPipeline.triangulate(e.positions2D,e.holes);C.length<3&&(C=[0,1,2]);var x=m.IndexDatatype.createTypedArray(f.length,C.length);x.set(C);var P=j;if(0!==l){var w=h.Quaternion.fromAxisAngle(y,l,U);if(P=a.Matrix3.fromQuaternion(w,P),t.tangent||t.bitangent){w=h.Quaternion.fromAxisAngle(y,-l,U);var A=a.Matrix3.fromQuaternion(w,Y);u=r.Cartesian3.normalize(a.Matrix3.multiplyByVector(A,u,u),u),t.bitangent&&(g=r.Cartesian3.normalize(r.Cartesian3.cross(y,u,g),g))}}else P=a.Matrix3.clone(a.Matrix3.IDENTITY,P);var F=B;t.st&&(F.x=o.x,F.y=o.y);for(var G=f.length,L=3*G,E=new Float64Array(L),T=t.normal?new Float32Array(L):void 0,D=t.tangent?new Float32Array(L):void 0,_=t.bitangent?new Float32Array(L):void 0,k=t.st?new Float32Array(2*G):void 0,V=0,M=0,H=0,O=0,S=0,z=0;z<G;z++){var N=f[z];if(E[V++]=N.x,E[V++]=N.y,E[V++]=N.z,t.st){var Q=s(a.Matrix3.multiplyByVector(P,N,R),I);n.Cartesian2.subtract(Q,F,Q);var q=d.CesiumMath.clamp(Q.x/o.width,0,1),J=d.CesiumMath.clamp(Q.y/o.height,0,1);k[S++]=q,k[S++]=J}t.normal&&(T[M++]=y.x,T[M++]=y.y,T[M++]=y.z),t.tangent&&(D[O++]=u.x,D[O++]=u.y,D[O++]=u.z),t.bitangent&&(_[H++]=g.x,_[H++]=g.y,_[H++]=g.z)}var W=new c.GeometryAttributes;return t.position&&(W.position=new p.GeometryAttribute({componentDatatype:i.ComponentDatatype.DOUBLE,componentsPerAttribute:3,values:E})),t.normal&&(W.normal=new p.GeometryAttribute({componentDatatype:i.ComponentDatatype.FLOAT,componentsPerAttribute:3,values:T})),t.tangent&&(W.tangent=new p.GeometryAttribute({componentDatatype:i.ComponentDatatype.FLOAT,componentsPerAttribute:3,values:D})),t.bitangent&&(W.bitangent=new p.GeometryAttribute({componentDatatype:i.ComponentDatatype.FLOAT,componentsPerAttribute:3,values:_})),t.st&&(W.st=new p.GeometryAttribute({componentDatatype:i.ComponentDatatype.FLOAT,componentsPerAttribute:2,values:k})),new p.Geometry({attributes:W,indices:x,primitiveType:v.PrimitiveType.TRIANGLES})}function W(e){var t=(e=s.defaultValue(e,s.defaultValue.EMPTY_OBJECT)).polygonHierarchy,a=s.defaultValue(e.vertexFormat,f.VertexFormat.DEFAULT);this._vertexFormat=f.VertexFormat.clone(a),this._polygonHierarchy=t,this._stRotation=s.defaultValue(e.stRotation,0),this._ellipsoid=n.Ellipsoid.clone(s.defaultValue(e.ellipsoid,n.Ellipsoid.WGS84)),this._workerName="createCoplanarPolygonGeometry",this.packedLength=g.PolygonGeometryLibrary.computeHierarchyPackedLength(t)+f.VertexFormat.packedLength+n.Ellipsoid.packedLength+2}W.fromPositions=function(e){return new W({polygonHierarchy:{positions:(e=s.defaultValue(e,s.defaultValue.EMPTY_OBJECT)).positions},vertexFormat:e.vertexFormat,stRotation:e.stRotation,ellipsoid:e.ellipsoid})},W.pack=function(e,t,a){return a=s.defaultValue(a,0),a=g.PolygonGeometryLibrary.packPolyg