define(["./when-54335d57","./Rectangle-82621db8","./arrayRemoveDuplicates-6dfd408b","./BoundingRectangle-9e73068f","./Transforms-b51fdb37","./ComponentDatatype-1a100acd","./PolylineVolumeGeometryLibrary-41961142","./Check-24483042","./GeometryAttribute-02fdce7a","./GeometryAttributes-caa08d6c","./GeometryPipeline-6bfd5efb","./IndexDatatype-edb2f4d6","./Math-7a8129d6","./PolygonPipeline-be37706f","./VertexFormat-81ec7207","./PixelFormat-d198afce","./WebGLConstants-95ceb4e9","./RuntimeError-88a32665","./EllipsoidTangentPlane-3e9e5847","./IntersectionTests-afc06c64","./Plane-fd9e13db","./PolylinePipeline-c53252ef","./EllipsoidGeodesic-2a3101f9","./EllipsoidRhumbLine-2550c0e1","./AttributeCompression-3961575e","./EncodedCartesian3-c7ed7a62"],function(c,u,a,o,G,R,l,e,A,D,I,O,i,S,g,t,n,r,s,d,p,y,m,h,f,v){"use strict";var b={};function B(e,t){c.defined(b[e])||(b[e]=!0,console.warn(c.defaultValue(t,e)))}function E(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,l.CornerType.ROUNDED),this._vertexFormat=g.VertexFormat.clone(c.defaultValue(e.vertexFormat,g.VertexFormat.DEFAULT)),this._granularity=c.defaultValue(e.granularity,i.CesiumMath.RADIANS_PER_DEGREE),this._workerName="createPolylineVolumeGeometry";var r=1+t.length*u.Cartesian3.packedLength;r+=1+n.length*u.Cartesian2.packedLength,this.packedLength=r+u.Ellipsoid.packedLength+g.VertexFormat.packedLength+2}B.geometryOutlines="Entity geometry outlines are unsupported on terrain. Outlines will be disabled. To enable outlines, disable geometry terrain clamping by explicitly setting height to 0.",B.geometryZIndex="Entity geometry with zIndex are unsupported when height or extrudedHeight are defined. zIndex will be ignored",B.geometryHeightReference="Entity corridor, ellipse, polygon or rectangle with heightReference must also have a defined height. heightReference will be ignored",B.geometryExtrudedHeightReference="Entity corridor, ellipse, polygon or rectangle with extrudedHeightReference must also have a defined extrudedHeight. extrudedHeightReference will be ignored",E.pack=function(e,t,n){var r;n=c.defaultValue(n,0);var i=e._positions,a=i.length;for(t[n++]=a,r=0;r<a;++r,n+=u.Cartesian3.packedLength)u.Cartesian3.pack(i[r],t,n);var o=e._shape;for(a=o.length,t[n++]=a,r=0;r<a;++r,n+=u.Cartesian2.packedLength)u.Cartesian2.pack(o[r],t,n);return u.Ellipsoid.pack(e._ellipsoid,t,n),n+=u.Ellipsoid.packedLength,g.VertexFormat.pack(e._vertexFormat,t,n),n+=g.VertexFormat.packedLength,t[n++]=e._cornerType,t[n]=e._granularity,t};var P=u.Ellipsoid.clone(u.Ellipsoid.UNIT_SPHERE),_=new g.VertexFormat,x={polylinePositions:void 0,shapePositions:void 0,ellipsoid:P,vertexFormat:_,cornerType:void 0,granularity:void 0};E.unpack=function(e,t,n){var r;t=c.defaultValue(t,0);var i=e[t++],a=new Array(i);for(r=0;r<i;++r,t+=u.Cartesian3.packedLength)a[r]=u.Cartesian3.unpack(e,t);i=e[t++];var o=new Array(i);for(r=0;r<i;++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=g.VertexFormat.unpack(e,t,_);t+=g.VertexFormat.packedLength;var d=e[t++],p=e[t];return c.defined(n)?(n._positions=a,n._shape=o,n._ellipsoid=u.Ellipsoid.clone(l,n._ellipsoid),n._vertexFormat=g.VertexFormat.clone(s,n._vertexFormat),n._cornerType=d,n._granularity=p,n):(x.polylinePositions=a,x.shapePositions=o,x.cornerType=d,x.granularity=p,new E(x))};var k=new o.BoundingRectangle;return E.createGeometry=function(e){var t=e._positions,n=a.arrayRemoveDuplicates(t,u.Cartesian3.equalsEpsilon),r=e._shape;if(r=l.PolylineVolumeGeometryLibrary.removeDuplicatesFromShape(r),!(n.length<2||r.length<3)){S.PolygonPipeline.computeWindingOrder2D(r)===S.WindingOrder.CLOCKWISE&&r.reverse();var i=o.BoundingRectangle.fromPoints(r,k);return function(e,t,n,r){var i=new D.GeometryAttributes;r.position&&(i.position=new A.GeometryAttribute({componentDatatype:R.ComponentDatatype.DOUBLE,componentsPerAttribute:3,values:e}));var a,o,l,s,d,p,c=t.length,u=e.length/3,g=(u-2*c)/(2*c),y=S.PolygonPipeline.triangulate(t),m=(g-1)*c*6+2*y.length,h=O.IndexDatatype.createTypedArray(u,m),f=2*c,v=0;for(a=0;a<g-1;a++){for(o=0;o<c-1;o++)p=(l=2*o+a*c*2)+f,d=(s=l+1)+f,h[v++]=s,h[v++]=l,h[v++]=d,h[v++]=d,h[v++]=l,h[v++]=p;d=(s=1+(l=2*c-2+a*c*2))+f,p=l+f,h[v++]=s,h[v++]=l,h[v++]=d,h[v++]=d,h[v++]=l,h[v++]=p}if(r.st||r.tangent||r.bitangent){var b,E,P=new Float32Array(2*u),_=1/(g-1),x=1/n.height,k=n.height/2,V=0;for(a=0;a<g;a++){for(b=a*_,E=x*(t[0].y+k),P[V++]=b,P[V++]=E,o=1;o<c;o++)E=x*(t[o].y+k),P[V++]=b,P[V++]=E,P[V++]=b,P[V++]=E;E=x*(t[0].y+k),P[V++]=b,P[V++]=E}for(o=0;o<c;o++)b=0,E=x*(t[o].y+k),P[V++]=b,P[V++]=E;for(o=0;o<c;o++)b=(g-1)*_,E=x*(t[o].y+k),P[V++]=b,P[V++]=E;i.st=new A.GeometryAttribute({componentDatatype:R.ComponentDatatype.FLOAT,componentsPerAttribute:2,values:new Float32Array(P)})}var C=u-2*c;for(a=0;a<y.length;a+=3){var F=y[a]+C,L=y[a+1]+C,w=y[a+2]+C;h[v++]=F,h[v++]=L,h[v++]=w,h[v++]=w+c,h[v++]=L+c,h[v++]=F+c}var T=new A.Geometry({attributes:i,indices:h,boundingSphere:G.BoundingSphere.fromVertices(e),primitiveType:A.PrimitiveType.TRIANGLES});if(r.normal&&(T=I.GeometryPipeline.computeNormal(T)),r.tangent||r.bitangent){try{T=I.GeometryPipeline.computeTangentAndBitangent(T)}catch(e){B("polyline-volume-tangent-bitangent","Unable to compute tangents and bitangents for polyline volume geometry")}r.tangent||(T.attributes.tangent=void 0),r.bitangent||(T.attributes.bitangent=void 0),r.st||(T.attributes.st=void 0)}return T}(l.PolylineVolumeGeometryLibrary.computePositions(n,r,i,e,!0),r,i,e._vertexFormat)}},function(e,t){return c.defined(t)&&(e=E.unpack(e,t)),e._ellipsoid=u.Ellipsoid.clone(e._ellipsoid),E.createGeometry(e)}});
|