define(["./when-b60132fc","./Cartesian2-47311507","./buildModuleUrl-57a32107","./Cartographic-3309dd0d","./ComponentDatatype-c140a87d","./Check-7b2a090c","./GeometryAttribute-c42d25b7","./GeometryAttributes-252e9929","./IndexDatatype-8a5eead4","./Math-119be1a3","./WallGeometryLibrary-db59a9c7","./Matrix4-cde86d0e","./Cartesian4-3ca25aab","./RuntimeError-4a5c8994","./WebGLConstants-4ae0db90","./FeatureDetection-c3b71206","./arrayRemoveDuplicates-d2f048c5","./PolylinePipeline-4ec7a59e","./EllipsoidGeodesic-0f19ac62","./EllipsoidRhumbLine-ed1a6bf4","./IntersectionTests-5e35c2ab","./Plane-ca0357f4"],(function(e,i,t,a,n,r,o,s,l,d,m,u,p,c,f,h,g,y,v,_,E,C){"use strict";var b=new a.Cartesian3,H=new a.Cartesian3;function A(t){var n=(t=e.defaultValue(t,e.defaultValue.EMPTY_OBJECT)).positions,r=t.maximumHeights,o=t.minimumHeights,s=e.defaultValue(t.granularity,d.CesiumMath.RADIANS_PER_DEGREE),l=e.defaultValue(t.ellipsoid,i.Ellipsoid.WGS84);this._positions=n,this._minimumHeights=o,this._maximumHeights=r,this._granularity=s,this._ellipsoid=i.Ellipsoid.clone(l),this._workerName="createWallOutlineGeometry";var m=1+n.length*a.Cartesian3.packedLength+2;e.defined(o)&&(m+=o.length),e.defined(r)&&(m+=r.length),this.packedLength=m+i.Ellipsoid.packedLength+1}A.pack=function(t,n,r){var o;r=e.defaultValue(r,0);var s=t._positions,l=s.length;for(n[r++]=l,o=0;o<l;++o,r+=a.Cartesian3.packedLength)a.Cartesian3.pack(s[o],n,r);var d=t._minimumHeights;if(l=e.defined(d)?d.length:0,n[r++]=l,e.defined(d))for(o=0;o<l;++o)n[r++]=d[o];var m=t._maximumHeights;if(l=e.defined(m)?m.length:0,n[r++]=l,e.defined(m))for(o=0;o<l;++o)n[r++]=m[o];return i.Ellipsoid.pack(t._ellipsoid,n,r),n[r+=i.Ellipsoid.packedLength]=t._granularity,n};var k=i.Ellipsoid.clone(i.Ellipsoid.UNIT_SPHERE),w={positions:void 0,minimumHeights:void 0,maximumHeights:void 0,ellipsoid:k,granularity:void 0};return A.unpack=function(t,n,r){var o;n=e.defaultValue(n,0);var s,l,d=t[n++],m=new Array(d);for(o=0;o<d;++o,n+=a.Cartesian3.packedLength)m[o]=a.Cartesian3.unpack(t,n);if((d=t[n++])>0)for(s=new Array(d),o=0;o<d;++o)s[o]=t[n++];if((d=t[n++])>0)for(l=new Array(d),o=0;o<d;++o)l[o]=t[n++];var u=i.Ellipsoid.unpack(t,n,k),p=t[n+=i.Ellipsoid.packedLength];return e.defined(r)?(r._positions=m,r._minimumHeights=s,r._maximumHeights=l,r._ellipsoid=i.Ellipsoid.clone(u,r._ellipsoid),r._granularity=p,r):(w.positions=m,w.minimumHeights=s,w.maximumHeights=l,w.granularity=p,new A(w))},A.fromConstantHeights=function(i){var t,a,n=(i=e.defaultValue(i,e.defaultValue.EMPTY_OBJECT)).positions,r=i.minimumHeight,o=i.maximumHeight,s=e.defined(r),l=e.defined(o);if(s||l){var d=n.length;t=s?new Array(d):void 0,a=l?new Array(d):void 0;for(var m=0;m<d;++m)s&&(t[m]=r),l&&(a[m]=o)}return new A({positions:n,maximumHeights:a,minimumHeights:t,ellipsoid:i.ellipsoid})},A.createGeometry=function(i){var r=i._positions,u=i._minimumHeights,p=i._maximumHeights,c=i._granularity,f=i._ellipsoid,h=m.WallGeometryLibrary.computePositions(f,r,p,u,c,!1);if(e.defined(h)){var g,y=h.pos.bottomPositions,v=h.pos.topPositions,_=v.length,E=2*_,C=new Float64Array(E),A=0;for(_/=3,g=0;g<_;++g){var k=3*g,w=a.Cartesian3.fromArray(v,k,b),x=a.Cartesian3.fromArray(y,k,H);C[A++]=x.x,C[A++]=x.y,C[A++]=x.z,C[A++]=w.x,C[A++]=w.y,C[A++]=w.z}var G=new s.GeometryAttributes({position:new o.GeometryAttribute({componentDatatype:n.ComponentDatatype.DOUBLE,componentsPerAttribute:3,values:C})}),L=E/3;E=2*L-4+L;var P=l.IndexDatatype.createTypedArray(L,E),D=0;for(g=0;g<L-2;g+=2){var T=g,V=g+2,I=a.Cartesian3.fromArray(C,3*T,b),M=a.Cartesian3.fromArray(C,3*V,H);if(!a.Cartesian3.equalsEpsilon(I,M,d.CesiumMath.EPSILON10)){var R=g+1,S=g+3;P[D++]=R,P[D++]=T,P[D++]=R,P[D++]=S,P[D++]=T,P[D++]=V}}return P[D++]=L-2,P[D++]=L-1,new o.Geometry({attributes:G,indices:P,primitiveType:t.PrimitiveType.LINES,boundingSphere:new t.BoundingSphere.fromVertices(C)})}},function(t,a){return e.defined(a)&&(t=A.unpack(t,a)),t._ellipsoid=i.Ellipsoid.clone(t._ellipsoid),A.createGeometry(t)}}));
