bmh_cesium/public/lib/cesiumjs/CesiumUnminified/Workers/EllipseGeometry-195afe88.js

2 lines
16 KiB
JavaScript
Raw Normal View History

2025-03-09 23:23:50 +00:00
/* 2020-9-22 15:23:24 | 版权所有 军懋国兴 */
define(["exports","./when-cbf8cd21","./Check-35e1a91d","./Math-69007a69","./Cartesian2-43e3a3be","./Transforms-2d1ac5ec","./ComponentDatatype-607c9a0c","./GeometryAttribute-2303bbfb","./GeometryAttributes-90846c5f","./GeometryPipeline-1ea64cde","./IndexDatatype-79bb407c","./GeometryOffsetAttribute-9c676324","./VertexFormat-fe64931e","./EllipseGeometryLibrary-304b788d","./GeometryInstance-6264cc0f"],function(e,U,h,p,Q,W,q,J,Z,_,C,K,f,B,v){"use strict";var X=new Q.Cartesian3,$=new Q.Cartesian3,ee=new Q.Cartesian3,te=new Q.Cartesian3,re=new Q.Cartesian2,ae=new W.Matrix3,Y=new W.Matrix3,ie=new W.Quaternion,ne=new Q.Cartesian3,oe=new Q.Cartesian3,se=new Q.Cartesian3,ue=new Q.Cartographic,le=new Q.Cartesian3,me=new Q.Cartesian2,ce=new Q.Cartesian2;function w(e,t,r){var a=t.vertexFormat,i=t.center,n=t.semiMajorAxis,o=t.semiMinorAxis,s=t.ellipsoid,u=t.stRotation,l=r?e.length/3*2:e.length/3,m=t.shadowVolume,c=a.st?new Float32Array(2*l):void 0,p=a.normal?new Float32Array(3*l):void 0,y=a.tangent?new Float32Array(3*l):void 0,d=a.bitangent?new Float32Array(3*l):void 0,h=m?new Float32Array(3*l):void 0,f=0,A=ne,x=oe,g=se,b=new W.GeographicProjection(s),_=b.project(s.cartesianToCartographic(i,ue),le),C=s.scaleToGeodeticSurface(i,X);s.geodeticSurfaceNormal(C,C);var v,w=ae,M=Y;M=0!==u?(v=W.Quaternion.fromAxisAngle(C,u,ie),w=W.Matrix3.fromQuaternion(v,w),v=W.Quaternion.fromAxisAngle(C,-u,ie),W.Matrix3.fromQuaternion(v,M)):(w=W.Matrix3.clone(W.Matrix3.IDENTITY,w),W.Matrix3.clone(W.Matrix3.IDENTITY,M));for(var E=Q.Cartesian2.fromElements(Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY,me),I=Q.Cartesian2.fromElements(Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY,ce),T=e.length,G=r?T:0,N=G/3*2,P=0;P<T;P+=3){var F,D,V=P+1,O=P+2,S=Q.Cartesian3.fromArray(e,P,X);a.st&&(F=W.Matrix3.multiplyByVector(w,S,$),D=b.project(s.cartesianToCartographic(F,ue),ee),Q.Cartesian3.subtract(D,_,D),re.x=(D.x+n)/(2*n),re.y=(D.y+o)/(2*o),E.x=Math.min(re.x,E.x),E.y=Math.min(re.y,E.y),I.x=Math.max(re.x,I.x),I.y=Math.max(re.y,I.y),r&&(c[f+N]=re.x,c[f+1+N]=re.y),c[f++]=re.x,c[f++]=re.y),(a.normal||a.tangent||a.bitangent||m)&&(A=s.geodeticSurfaceNormal(S,A),m&&(h[P+G]=-A.x,h[V+G]=-A.y,h[O+G]=-A.z),(a.normal||a.tangent||a.bitangent)&&((a.tangent||a.bitangent)&&(x=Q.Cartesian3.normalize(Q.Cartesian3.cross(Q.Cartesian3.UNIT_Z,A,x),x),W.Matrix3.multiplyByVector(M,x,x)),a.normal&&(p[P]=A.x,p[V]=A.y,p[O]=A.z,r&&(p[P+G]=-A.x,p[V+G]=-A.y,p[O+G]=-A.z)),a.tangent&&(y[P]=x.x,y[V]=x.y,y[O]=x.z,r&&(y[P+G]=-x.x,y[V+G]=-x.y,y[O+G]=-x.z)),a.bitangent&&(g=Q.Cartesian3.normalize(Q.Cartesian3.cross(A,x,g),g),d[P]=g.x,d[V]=g.y,d[O]=g.z,r&&(d[P+G]=g.x,d[V+G]=g.y,d[O+G]=g.z))))}if(a.st){T=c.length;for(var L=0;L<T;L+=2)c[L]=(c[L]-E.x)/(I.x-E.x),c[L+1]=(c[L+1]-E.y)/(I.y-E.y)}var R,j,k,z=new Z.GeometryAttributes;return a.position&&(R=B.EllipseGeometryLibrary.raisePositionsToHeight(e,t,r),z.position=new J.GeometryAttribute({componentDatatype:q.ComponentDatatype.DOUBLE,componentsPerAttribute:3,values:R})),a.st&&(z.st=new J.GeometryAttribute({componentDatatype:q.ComponentDatatype.FLOAT,componentsPerAttribute:2,values:c})),a.normal&&(z.normal=new J.GeometryAttribute({componentDatatype:q.ComponentDatatype.FLOAT,componentsPerAttribute:3,values:p})),a.tangent&&(z.tangent=new J.GeometryAttribute({componentDatatype:q.ComponentDatatype.FLOAT,componentsPerAttribute:3,values:y})),a.bitangent&&(z.bitangent=new J.GeometryAttribute({componentDatatype:q.ComponentDatatype.FLOAT,componentsPerAttribute:3,values:d})),m&&(z.extrudeDirection=new J.GeometryAttribute({componentDatatype:q.ComponentDatatype.FLOAT,componentsPerAttribute:3,values:h})),r&&U.defined(t.offsetAttribute)&&(k=new Uint8Array(l),k=t.offsetAttribute===K.GeometryOffsetAttribute.TOP?K.arrayFill(k,1,0,l/2):(j=t.offsetAttribute===K.GeometryOffsetAttribute.NONE?0:1,K.arrayFill(k,j)),z.applyOffset=new J.GeometryAttribute({componentDatatype:q.ComponentDatatype.UNSIGNED_BYTE,componentsPerAttribute:1,values:k})),z}function M(e){for(var t,r,a=new Array(e*(e+1)*12-6),i=0,n=0,o=1,s=0;s<3;s++)a[i++]=o++,a[i++]=n,a[i++]=o;for(s=2;s<e+1;++s){for(o=s*(s+1)-1,