define(["./when-54335d57","./Rectangle-82621db8","./Transforms-b51fdb37","./ComponentDatatype-1a100acd","./Check-24483042","./GeometryAttribute-02fdce7a","./GeometryAttributes-caa08d6c","./IndexDatatype-edb2f4d6","./Math-7a8129d6","./VertexFormat-81ec7207","./WallGeometryLibrary-567e4388","./PixelFormat-d198afce","./WebGLConstants-95ceb4e9","./RuntimeError-88a32665","./arrayRemoveDuplicates-6dfd408b","./PolylinePipeline-c53252ef","./EllipsoidGeodesic-2a3101f9","./EllipsoidRhumbLine-2550c0e1","./IntersectionTests-afc06c64","./Plane-fd9e13db"],function(Y,Z,j,K,e,Q,X,$,ee,u,te,t,a,i,r,n,o,s,m,l){"use strict";var ae=new Z.Cartesian3,ie=new Z.Cartesian3,re=new Z.Cartesian3,ne=new Z.Cartesian3,oe=new Z.Cartesian3,se=new Z.Cartesian3,me=new Z.Cartesian3;function p(e){var t=(e=Y.defaultValue(e,Y.defaultValue.EMPTY_OBJECT)).positions,a=e.maximumHeights,i=e.minimumHeights,r=Y.defaultValue(e.vertexFormat,u.VertexFormat.DEFAULT),n=Y.defaultValue(e.granularity,ee.CesiumMath.RADIANS_PER_DEGREE),o=Y.defaultValue(e.ellipsoid,Z.Ellipsoid.WGS84);this._positions=t,this._minimumHeights=i,this._maximumHeights=a,this._vertexFormat=u.VertexFormat.clone(r),this._granularity=n,this._ellipsoid=Z.Ellipsoid.clone(o),this._workerName="createWallGeometry";var s=1+t.length*Z.Cartesian3.packedLength+2;Y.defined(i)&&(s+=i.length),Y.defined(a)&&(s+=a.length),this.packedLength=s+Z.Ellipsoid.packedLength+u.VertexFormat.packedLength+1}p.pack=function(e,t,a){var i;a=Y.defaultValue(a,0);var r=e._positions,n=r.length;for(t[a++]=n,i=0;i<n;++i,a+=Z.Cartesian3.packedLength)Z.Cartesian3.pack(r[i],t,a);var o=e._minimumHeights;if(n=Y.defined(o)?o.length:0,t[a++]=n,Y.defined(o))for(i=0;i<n;++i)t[a++]=o[i];var s=e._maximumHeights;if(n=Y.defined(s)?s.length:0,t[a++]=n,Y.defined(s))for(i=0;i<n;++i)t[a++]=s[i];return Z.Ellipsoid.pack(e._ellipsoid,t,a),a+=Z.Ellipsoid.packedLength,u.VertexFormat.pack(e._vertexFormat,t,a),t[a+=u.VertexFormat.packedLength]=e._granularity,t};var c=Z.Ellipsoid.clone(Z.Ellipsoid.UNIT_SPHERE),y=new u.VertexFormat,f={positions:void 0,minimumHeights:void 0,maximumHeights:void 0,ellipsoid:c,vertexFormat:y,granularity:void 0};return p.unpack=function(e,t,a){var i;t=Y.defaultValue(t,0);var r,n,o=e[t++],s=new Array(o);for(i=0;i<o;++i,t+=Z.Cartesian3.packedLength)s[i]=Z.Cartesian3.unpack(e,t);if(0<(o=e[t++]))for(r=new Array(o),i=0;i<o;++i)r[i]=e[t++];if(0<(o=e[t++]))for(n=new Array(o),i=0;i<o;++i)n[i]=e[t++];var m=Z.Ellipsoid.unpack(e,t,c);t+=Z.Ellipsoid.packedLength;var l=u.VertexFormat.unpack(e,t,y),d=e[t+=u.VertexFormat.packedLength];return Y.defined(a)?(a._positions=s,a._minimumHeights=r,a._maximumHeights=n,a._ellipsoid=Z.Ellipsoid.clone(m,a._ellipsoid),a._vertexFormat=u.VertexFormat.clone(l,a._vertexFormat),a._granularity=d,a):(f.positions=s,f.minimumHeights=r,f.maximumHeights=n,f.granularity=d,new p(f))},p.fromConstantHeights=function(e){var t,a,i=(e=Y.defaultValue(e,Y.defaultValue.EMPTY_OBJECT)).positions,r=e.minimumHeight,n=e.maximumHeight,o=Y.defined(r),s=Y.defined(n);if(o||s){var m=i.length;t=o?new Array(m):void 0,a=s?new Array(m):void 0;for(var l=0;l<m;++l)o&&(t[l]=r),s&&(a[l]=n)}return new p({positions:i,maximumHeights:a,minimumHeights:t,ellipsoid:e.ellipsoid,vertexFormat:e.vertexFormat})},p.createGeometry=function(e){var t=e._positions,a=e._minimumHeights,i=e._maximumHeights,r=e._vertexFormat,n=e._granularity,o=e._ellipsoid,s=te.WallGeometryLibrary.computePositions(o,t,i,a,n,!0);if(Y.defined(s)){var m,l=s.bottomPositions,d=s.topPositions,u=s.numCorners,p=d.length,c=2*p,y=r.position?new Float64Array(c):void 0,f=r.normal?new Float32Array(c):void 0,g=r.tangent?new Float32Array(c):void 0,h=r.bitangent?new Float32Array(c):void 0,v=r.st?new Float32Array(c/3*2):void 0,C=0,x=0,b=0,A=0,_=0,E=me,w=se,F=oe,L=!0,k=0,H=1/((p/=3)-u-1);for(m=0;m<p;++m){var V=3*m,G=Z.Cartesian3.fromArray(d,V,ae),P=Z.Cartesian3.fromArray(l,V,ie);if(r.position&&(y[C++]=P.x,y[C++]=P.y,y[C++]=P.z,y[C++]=G.x,y[C++]=G.y,y[C++]=G.z),r.st&&(v[_++]=k,v[_++]=0,v[_++]=k,v[_++]=1),r.normal||r.tangent||r.bitangent){var D=Z.Cartesian3.clone(Z.Cartesian3.ZERO,ne),T=Z.Cartesian3.subtract(G,o.geodeticSurfaceNormal(G,ie),ie);if(m+1<p&&(D=Z.Cartesian3.fromArray(d,V+3,ne)),L){var z=Z.Cartesian3.subtract(D,G,re),O=Z.Cartesian3.subtract(T,G,ae);E=Z.Cartesian3.normalize(Z.Cartesian3.cross(O,z,E),E),L=!1}Z.Cartesian3.equalsEpsilon(G,D,ee.CesiumMath.EPSILON10)?L=!0:(k+=H,r.tangent&&(w=Z.Cartesian3.normalize(Z.Cartesian3.subtract(D,G,w),w)),r.bitangent&&(F=Z.Cartesian3.normalize(Z.Cartesian3.cross(E,w,F),F))),r.normal&&(f[x++]=E.x,f[x++]=E.y,f[x++]=E.z,f[x++]=E.x,f[x++]=E.y,f[x++]=E.z),r.tangent&&(g[A++]=w.x,g[A++]=w.y,g[A++]=w.z,g[A++]=w.x,g[A++]=w.y,g[A++]=w.z),r.bitangent&&(h[b++]=F.x,h[b++]=F.y,h[b++]=F.z,h[b++]=F.x,h[b++]=F.y,h[b++]=F.z)}}var R=new X.GeometryAttributes;r.position&&(R.position=new Q.GeometryAttribute({componentDatatype:K.ComponentDatatype.DOUBLE,componentsPerAttribute:3,values:y})),r.normal&&(R.normal=new Q.GeometryAttribute({componentDatatype:K.ComponentDatatype.FLOAT,componentsPerAttribute:3,values:f})),r.tangent&&(R.tangent=new Q.GeometryAttribute({componentDatatype:K.ComponentDatatype.FLOAT,componentsPerAttribute:3,values:g})),r.bitangent&&(R.bitangent=new Q.GeometryAttribute({componentDatatype:K.ComponentDatatype.FLOAT,componentsPerAttribute:3,values:h})),r.st&&(R.st=new Q.GeometryAttribute({componentDatatype:K.ComponentDatatype.FLOAT,componentsPerAttribute:2,values:v}));var S=c/3;c-=6*(u+1);var I=$.IndexDatatype.createTypedArray(S,c),N=0;for(m=0;m<S-2;m+=2){var M=m,W=m+2,B=Z.Cartesian3.fromArray(y,3*M,ae),U=Z.Cartesian3.fromArray(y,3*W,ie);if(!Z.Cartesian3.equalsEpsilon(B,U,ee.CesiumMath.EPSILON10)){var q=m+1,J=m+3;I[N++]=q,I[N++]=M,I[N++]=J,I[N++]=J,I[N++]=M,I[N++]=W}}return new Q.Geometry({attributes:R,indices:I,primitiveType:Q.PrimitiveType.TRIANGLES,boundingSphere:new j.BoundingSphere.fromVertices(y)})}},function(e,t){return Y.defined(t)&&(e=p.unpack(e,t)),e._ellipsoid=Z.Ellipsoid.clone(e._ellipsoid),p.createGeometry(e)}});
|