define(["exports","./arrayRemoveDuplicates-18786327","./Matrix2-ccd5b911","./when-4bbc8319","./ComponentDatatype-93750d1a","./PolylinePipeline-8457214f"],function(e,f,A,C,w,P){"use strict";var i={};var b=new A.Cartographic,M=new A.Cartographic;function E(e,i,t,r){var a=(i=f.arrayRemoveDuplicates(i,A.Cartesian3.equalsEpsilon)).length;if(!(a<2)){var n=C.defined(r),o=C.defined(t),l=new Array(a),s=new Array(a),h=new Array(a),g=i[0];l[0]=g;var p=e.cartesianToCartographic(g,b);o&&(p.height=t[0]),s[0]=p.height,h[0]=n?r[0]:0;for(var u,c,d=s[0]===h[0],y=1,v=1;v<a;++v){var m=i[v],P=e.cartesianToCartographic(m,M);o&&(P.height=t[v]),d=d&&0===P.height,u=p,c=P,w.CesiumMath.equalsEpsilon(u.latitude,c.latitude,w.CesiumMath.EPSILON10)&&w.CesiumMath.equalsEpsilon(u.longitude,c.longitude,w.CesiumMath.EPSILON10)?p.height<P.height&&(s[y-1]=P.height):(l[y]=m,s[y]=P.height,h[y]=n?r[v]:0,d=d&&s[y]===h[y],A.Cartographic.clone(P,p),++y)}if(!(d||y<2))return l.length=y,s.length=y,h.length=y,{positions:l,topHeights:s,bottomHeights:h}}}var D=new Array(2),F=new Array(2),H={positions:void 0,height:void 0,granularity:void 0,ellipsoid:void 0};i.computePositions=function(e,i,t,r,a,n){var o=E(e,i,t,r);if(C.defined(o)){i=o.positions,t=o.topHeights,r=o.bottomHeights;var l=i.length,o=l-2,s=w.CesiumMath.chordLength(a,e.maximumRadius),h=H;if(h.minDistance=s,h.ellipsoid=e,n){for(var g=0,p=0;p<l-1;p++)g+=P.PolylinePipeline.numberOfPoints(i[p],i[p+1],s)+1;var u=new Float64Array(3*g),c=new Float64Array(3*g),d=D,y=F;h.positions=d,h.height=y;var v=0;for(p=0;p<l-1;p++){d[0]=i[p],d[1]=i[p+1],y[0]=t[p],y[1]=t[p+1];var m=P.PolylinePipeline.generateArc(h);u.set(m,v),y[0]=r[p],y[1]=r[p+1],c.set(P.PolylinePipeline.generateArc(h),v),v+=m.length}}else h.positions=i,h.height=t,u=new Float64Array(P.PolylinePipeline.generateArc(h)),h.height=r,c=new Float64Array(P.PolylinePipeline.generateArc(h));return{bottomPositions:c,topPositions:u,numCorners:o}}},e.WallGeometryLibrary=i});
