bimland/public/Cesium/Workers/EllipsoidOutlineGeometry-7e...

2 lines
4.8 KiB
JavaScript
Raw Permalink Normal View History

2023-07-26 17:04:38 +08:00
define(["exports","./arrayFill-4513d7ad","./buildModuleUrl-4e1b81e7","./Cartographic-3309dd0d","./ComponentDatatype-c140a87d","./when-b60132fc","./Check-7b2a090c","./Cartesian2-47311507","./GeometryAttribute-3a88ba31","./GeometryAttributes-252e9929","./GeometryOffsetAttribute-fbeb6f1a","./IndexDatatype-8a5eead4","./Math-119be1a3","./PrimitiveType-a54dc62f"],(function(i,t,e,a,r,n,o,s,m,u,f,d,l,c){"use strict";var C=new a.Cartesian3(1,1,1),_=Math.cos,h=Math.sin;function p(i){i=n.defaultValue(i,n.defaultValue.EMPTY_OBJECT);var t=n.defaultValue(i.radii,C),e=n.defaultValue(i.innerRadii,t),r=n.defaultValue(i.minimumClock,0),o=n.defaultValue(i.maximumClock,l.CesiumMath.TWO_PI),s=n.defaultValue(i.minimumCone,0),m=n.defaultValue(i.maximumCone,l.CesiumMath.PI),u=Math.round(n.defaultValue(i.stackPartitions,10)),f=Math.round(n.defaultValue(i.slicePartitions,8)),d=Math.round(n.defaultValue(i.subdivisions,128));this._radii=a.Cartesian3.clone(t),this._innerRadii=a.Cartesian3.clone(e),this._minimumClock=r,this._maximumClock=o,this._minimumCone=s,this._maximumCone=m,this._stackPartitions=u,this._slicePartitions=f,this._subdivisions=d,this._offsetAttribute=i.offsetAttribute,this._workerName="createEllipsoidOutlineGeometry"}p.packedLength=2*a.Cartesian3.packedLength+8,p.pack=function(i,t,e){return e=n.defaultValue(e,0),a.Cartesian3.pack(i._radii,t,e),e+=a.Cartesian3.packedLength,a.Cartesian3.pack(i._innerRadii,t,e),e+=a.Cartesian3.packedLength,t[e++]=i._minimumClock,t[e++]=i._maximumClock,t[e++]=i._minimumCone,t[e++]=i._maximumCone,t[e++]=i._stackPartitions,t[e++]=i._slicePartitions,t[e++]=i._subdivisions,t[e]=n.defaultValue(i._offsetAttribute,-1),t};var y=new a.Cartesian3,v=new a.Cartesian3,b={radii:y,innerRadii:v,minimumClock:void 0,maximumClock:void 0,minimumCone:void 0,maximumCone:void 0,stackPartitions:void 0,slicePartitions:void 0,subdivisions:void 0,offsetAttribute:void 0};p.unpack=function(i,t,e){t=n.defaultValue(t,0);var r=a.Cartesian3.unpack(i,t,y);t+=a.Cartesian3.packedLength;var o=a.Cartesian3.unpack(i,t,v);t+=a.Cartesian3.packedLength;var s=i[t++],m=i[t++],u=i[t++],f=i[t++],d=i[t++],l=i[t++],c=i[t++],C=i[t];return n.defined(e)?(e._radii=a.Cartesian3.clone(r,e._radii),e._innerRadii=a.Cartesian3.clone(o,e._innerRadii),e._minimumClock=s,e._maximumClock=m,e._minimumCone=u,e._maximumCone=f,e._stackPartitions=d,e._slicePartitions=l,e._subdivisions=c,e._offsetAttribute=-1===C?void 0:C,e):(b.minimumClock=s,b.maximumClock=m,b.minimumCone=u,b.maximumCone=f,b.stackPartitions=d,b.slicePartitions=l,b.subdivisions=c,b.offsetAttribute=-1===C?void 0:C,new p(b))},p.createGeometry=function(i){var a=i._radii;if(!(a.x<=0||a.y<=0||a.z<=0)){var o=i._innerRadii;if(!(o.x<=0||o.y<=0||o.z<=0)){var C=i._minimumClock,p=i._maximumClock,y=i._minimumCone,v=i._maximumCone,b=i._subdivisions,k=s.Ellipsoid.fromCartesian3(a),A=i._slicePartitions+1,x=i._stackPartitions+1;(A=Math.round(A*Math.abs(p-C)/l.CesiumMath.TWO_PI))<2&&(A=2),(x=Math.round(x*Math.abs(v-y)/l.CesiumMath.PI))<2&&(x=2);var P=0,M=1,w=o.x!==a.x||o.y!==a.y||o.z!==a.z,g=!1,V=!1;w&&(M=2,y>0&&(g=!0,P+=A),v<Math.PI&&(V=!0,P+=A));var G,E,O,D,I=b*M*(x+A),T=new Float64Array(3*I),z=2*(I+P-(A+x)*M),L=d.IndexDatatype.createTypedArray(I,z),R=0,N=new Array(x),B=new Array(x);for(G=0;G<x;G++)D=y+G*(v-y)/(x-1),N[G]=h(D),B[G]=_(D);var S=new Array(b),U=new Array(b);for(G=0;G<b;G++)O=C+G*(p-C)/(b-1),S[G]=h(O),U[G]=_(O);for(G=0;G<x;G++)for(E=0;E<b;E++)T[R++]=a.x*N[G]*U[E],T[R++]=a.y*N[G]*S[E],T[R++]=a.z*B[G];if(w)for(G=0;G<x;G++)for(E=0;E<b;E++)T[R++]=o.x*N[G]*U[E],T[R++]=o.y*N[G]*S[E],T[R++]=o.z*B[G];for(N.length=b,B.length=b,G=0;G<b;G++)D=y+G*(v-y)/(b-1),N[G]=h(D),B[G]=_(D);for(S.length=A,U.length=A,G=0;G<A;G++)O=C+G*(p-C)/(A-1),S[G]=h(O),U[G]=_(O);for(G=0;G<b;G++)for(E=0;E<A;E++)T[R++]=a.x*N[G]*U[E],T[R++]=a.y*N[G]*S[E],T[R++]=a.z*B[G];if(w)for(G=0;G<b;G++)for(E=0;E<A;E++)T[R++]=o.x*N[G]*U[E],T[R++]=o.y*N[G]*S[E],T[R++]=o.z*B[G];for(R=0,G=0;G<x*M;G++){var F=G*b;for(E=0;E<b-1;E++)L[R++]=F+E,L[R++]=F+E+1}var W=x*b*M;for(G=0;G<A;G++)for(E=0;E<b-1;E++)L[R++]=W+G+E*A,L[R++]=W+G+(E+1)*A;if(w)for(W=x*b*M+A*b,G=0;G<A;G++