define(["./when-cbf8cd21","./Check-35e1a91d","./Math-e66fad2a","./Cartesian2-44433f55","./Matrix3-146a3f23","./Transforms-fc4c03e8","./RuntimeError-f4c64df1","./WebGLConstants-95ceb4e9","./ComponentDatatype-7ee14e67","./GeometryAttribute-dee5e12d","./GeometryAttributes-90846c5f","./IndexDatatype-66caba23","./IntersectionTests-caa0ba1a","./Plane-e04c899a","./arrayRemoveDuplicates-b817241d","./BoundingRectangle-bef3979e","./EllipsoidTangentPlane-d27aa001","./EllipsoidRhumbLine-862a2df4","./PolygonPipeline-b54c9b74","./PolylineVolumeGeometryLibrary-ee2feab7","./EllipsoidGeodesic-7779e55a","./PolylinePipeline-7b01b363"],function(d,e,t,c,i,y,a,n,h,f,g,m,r,o,l,s,p,u,v,E,P,_){"use strict";function b(e){var i=(e=d.defaultValue(e,d.defaultValue.EMPTY_OBJECT)).polylinePositions,a=e.shapePositions;this._positions=i,this._shape=a,this._ellipsoid=c.Ellipsoid.clone(d.defaultValue(e.ellipsoid,c.Ellipsoid.WGS84)),this._cornerType=d.defaultValue(e.cornerType,E.CornerType.ROUNDED),this._granularity=d.defaultValue(e.granularity,t.CesiumMath.RADIANS_PER_DEGREE),this._workerName="createPolylineVolumeOutlineGeometry";var n=1+i.length*c.Cartesian3.packedLength;n+=1+a.length*c.Cartesian2.packedLength,this.packedLength=n+c.Ellipsoid.packedLength+2}b.pack=function(e,i,a){var n;a=d.defaultValue(a,0);var t=e._positions,r=t.length;for(i[a++]=r,n=0;n<r;++n,a+=c.Cartesian3.packedLength)c.Cartesian3.pack(t[n],i,a);var o=e._shape,r=o.length;for(i[a++]=r,n=0;n<r;++n,a+=c.Cartesian2.packedLength)c.Cartesian2.pack(o[n],i,a);return c.Ellipsoid.pack(e._ellipsoid,i,a),a+=c.Ellipsoid.packedLength,i[a++]=e._cornerType,i[a]=e._granularity,i};var k=c.Ellipsoid.clone(c.Ellipsoid.UNIT_SPHERE),C={polylinePositions:void 0,shapePositions:void 0,ellipsoid:k,height:void 0,cornerType:void 0,granularity:void 0};b.unpack=function(e,i,a){i=d.defaultValue(i,0);for(var n=e[i++],t=new Array(n),r=0;r<n;++r,i+=c.Cartesian3.packedLength)t[r]=c.Cartesian3.unpack(e,i);n=e[i++];var o=new Array(n);for(r=0;r<n;++r,i+=c.Cartesian2.packedLength)o[r]=c.Cartesian2.unpack(e,i);var l=c.Ellipsoid.unpack(e,i,k);i+=c.Ellipsoid.packedLength;var s=e[i++],p=e[i];return d.defined(a)?(a._positions=t,a._shape=o,a._ellipsoid=c.Ellipsoid.clone(l,a._ellipsoid),a._cornerType=s,a._granularity=p,a):(C.polylinePositions=t,C.shapePositions=o,C.cornerType=s,C.granularity=p,new b(C))};var L=new s.BoundingRectangle;return b.createGeometry=function(e){var i=e._positions,a=l.arrayRemoveDuplicates(i,c.Cartesian3.equalsEpsilon),n=e._shape,n=E.PolylineVolumeGeometryLibrary.removeDuplicatesFromShape(n);if(!(a.length<2||n.length<3)){v.PolygonPipeline.computeWindingOrder2D(n)===v.WindingOrder.CLOCKWISE&&n.reverse();var t=s.BoundingRectangle.fromPoints(n,L);return function(e,i){var a=new g.GeometryAttributes;a.position=new f.GeometryAttribute({componentDatatype:h.ComponentDatatype.DOUBLE,componentsPerAttribute:3,values:e});var n=i.length,t=a.position.values.length/3,r=e.length/3/n,o=m.IndexDatatype.createTypedArray(t,2*n*(1+r)),l=0,s=0,p=s*n;for(u=0;u<n-1;u++)o[l++]=u+p,o[l++]=u+p+1;for(o[l++]=n-1+p,o[l++]=p,p=(s=r-1)*n,u=0;u<n-1;u++)o[l++]=u+p,o[l++]=u+p+1;for(o[l++]=n-1+p,o[l++]=p,s=0;s<r-1;s++)for(var d=n*s,c=d+n,u=0;u<n;u++)o[l++]=u+d,o[l++]=u+c;return new f.Geometry({attributes:a,indices:m.IndexDatatype.createTypedArray(t,o),boundingSphere:y.BoundingSphere.fromVertices(e),primitiveType:f.PrimitiveType.LINES})}(E.PolylineVolumeGeometryLibrary.computePositions(a,n,t,e,!1),n)}},function(e,i){return d.defined(i)&&(e=b.unpack(e,i)),e._ellipsoid=c.Ellipsoid.clone(e._ellipsoid),b.createGeometry(e)}});