define(["./when-7b580518","./Cartesian2-40b13f31","./arrayRemoveDuplicates-47b233f1","./BoundingRectangle-df67ecf0","./Transforms-a7d32f6c","./ComponentDatatype-6c2e43c1","./PolylineVolumeGeometryLibrary-ee98d4d3","./Check-3917d765","./GeometryAttribute-8f00b923","./GeometryAttributes-fbd9a3fb","./GeometryPipeline-06778f23","./IndexDatatype-b42089ce","./Math-87254c13","./PolygonPipeline-4cefc824","./VertexFormat-8d463a4f","./combine-83aa7971","./RuntimeError-fad4d3c6","./WebGLConstants-4e26b85a","./EllipsoidTangentPlane-b7b148bd","./AxisAlignedBoundingBox-14881a9b","./IntersectionTests-2dece3b4","./Plane-69fa3eea","./PolylinePipeline-ce297e94","./EllipsoidGeodesic-bdbae7c8","./EllipsoidRhumbLine-6baec512","./AttributeCompression-56959beb","./EncodedCartesian3-942c4568"],function(c,u,i,r,T,G,D,e,w,R,B,S,a,I,m,t,n,o,l,s,p,d,y,g,h,f,b){"use strict";function v(e){var t=(e=c.defaultValue(e,c.defaultValue.EMPTY_OBJECT)).polylinePositions,n=e.shapePositions;this._positions=t,this._shape=n,this._ellipsoid=u.Ellipsoid.clone(c.defaultValue(e.ellipsoid,u.Ellipsoid.WGS84)),this._cornerType=c.defaultValue(e.cornerType,D.CornerType.ROUNDED),this._vertexFormat=m.VertexFormat.clone(c.defaultValue(e.vertexFormat,m.VertexFormat.DEFAULT)),this._granularity=c.defaultValue(e.granularity,a.CesiumMath.RADIANS_PER_DEGREE),this._workerName="createPolylineVolumeGeometry";t=1+t.length*u.Cartesian3.packedLength;t+=1+n.length*u.Cartesian2.packedLength,this.packedLength=t+u.Ellipsoid.packedLength+m.VertexFormat.packedLength+2}v.pack=function(e,t,n){var a;n=c.defaultValue(n,0);var i=e._positions,r=i.length;for(t[n++]=r,a=0;a<r;++a,n+=u.Cartesian3.packedLength)u.Cartesian3.pack(i[a],t,n);var o=e._shape,r=o.length;for(t[n++]=r,a=0;a<r;++a,n+=u.Cartesian2.packedLength)u.Cartesian2.pack(o[a],t,n);return u.Ellipsoid.pack(e._ellipsoid,t,n),n+=u.Ellipsoid.packedLength,m.VertexFormat.pack(e._vertexFormat,t,n),n+=m.VertexFormat.packedLength,t[n++]=e._cornerType,t[n]=e._granularity,t};var P=u.Ellipsoid.clone(u.Ellipsoid.UNIT_SPHERE),E=new m.VertexFormat,_={polylinePositions:void 0,shapePositions:void 0,ellipsoid:P,vertexFormat:E,cornerType:void 0,granularity:void 0};v.unpack=function(e,t,n){t=c.defaultValue(t,0);for(var a=e[t++],i=new Array(a),r=0;r<a;++r,t+=u.Cartesian3.packedLength)i[r]=u.Cartesian3.unpack(e,t);var a=e[t++],o=new Array(a);for(r=0;r<a;++r,t+=u.Cartesian2.packedLength)o[r]=u.Cartesian2.unpack(e,t);var l=u.Ellipsoid.unpack(e,t,P);t+=u.Ellipsoid.packedLength;var s=m.VertexFormat.unpack(e,t,E);t+=m.VertexFormat.packedLength;var p=e[t++],d=e[t];return c.defined(n)?(n._positions=i,n._shape=o,n._ellipsoid=u.Ellipsoid.clone(l,n._ellipsoid),n._vertexFormat=m.VertexFormat.clone(s,n._vertexFormat),n._cornerType=p,n._granularity=d,n):(_.polylinePositions=i,_.shapePositions=o,_.cornerType=p,_.granularity=d,new v(_))};var k=new r.BoundingRectangle;return v.createGeometry=function(e){var t=e._positions,n=i.arrayRemoveDuplicates(t,u.Cartesian3.equalsEpsilon),a=e._shape,a=D.PolylineVolumeGeometryLibrary.removeDuplicatesFromShape(a);if(!(n.length<2||a.length<3)){I.PolygonPipeline.computeWindingOrder2D(a)===I.WindingOrder.CLOCKWISE&&a.reverse();t=r.BoundingRectangle.fromPoints(a,k);return function(e,t,n,a){var i=new R.GeometryAttributes;a.position&&(i.position=new w.GeometryAttribute({componentDatatype:G.ComponentDatatype.DOUBLE,componentsPerAttribute:3,values:e}));var r,o,l,s,p,d=t.length,c=e.length/3,u=(c-2*d)/(2*d),m=I.PolygonPipeline.triangulate(t),y=(u-1)*d*6+2*m.length,g=S.IndexDatatype.createTypedArray(c,y),h=2*d,f=0;for(L=0;L<u-1;L++){for(r=0;r<d-1;r++)p=(o=2*r+L*d*2)+h,s=(l=o+1)+h,g[f++]=l,g[f++]=o,g[f++]=s,g[f++]=s,g[f++]=o,g[f++]=p;s=(l=(o=2*d-2+L*d*2)+1)+h,p=o+h,g[f++]=l,g[f++]=o,g[f++]=s,g[f++]=s,g[f++]=o,g[f++]=p}if(a.st||a.tangent||a.bitangent){for(var b,v,P=new Float32Array(2*c),E=1/(u-1),_=1/n.height,k=n.height/2,C=0,L=0;L<u;L++){for(v=_*(t[0].y+k),P[C++]=b=L*E,P[C++]=v,r=1;r<d;r++)v=_*(t[r].y+k),P[C++]=b,P[C++]=v,P[C++]=b,P[C++]=v;v=_*(t[0].y+k),P[C++]=b,P[C++]=v}for(r=0;r<d;r++)v=_*(t[r].y+k),P[C++]=b=0,P[C++]=v;for(r=0;r<d;r++)v=_*(t[r].y+k),P[C++]=b=(u-1)*E,P[C++]=v;i.st=new w.GeometryAttribute({componentDatatype:G.ComponentDatatype.FLOAT,componentsPerAttribute:2,values:new Float32Array(P)})}var V=c-2*d;for(L=0;L<m.length;L+=3){var F=m[L]+V,x=m[L+1]+V,A=m[L+2]+V;g[f++]=F,g[f++]=x,g[f++]=A,g[f++]=A+d,g[f++]=x+d,g[f++]=F+d}if(e=new w.Geometry({attributes:i,indices:g,boundingSphere:T.BoundingSphere.fromVertices(e),primitiveType:w.PrimitiveType.TRIANGLES}),a.normal&&(e=B.GeometryPipeline.computeNormal(e)),a.tangent||a.bitangent){try{e=B.GeometryPipeline.computeTangentAndBitangent(e)}catch(e){D.oneTimeWarning("polyline-volume-tangent-bitangent","Unable to compute tangents and bitangents for polyline volume geometry")}a.tangent||(e.attributes.tangent=void 0),a.bitangent||(e.attributes.bitangent=void 0),a.st||(e.attributes.st=void 0)}return e}(D.PolylineVolumeGeometryLibrary.computePositions(n,a,t,e,!0),a,t,e._vertexFormat)}},function(e,t){return(e=c.defined(t)?v.unpack(e,t):e)._ellipsoid=u.Ellipsoid.clone(e._ellipsoid),v.createGeometry(e)}});
|