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