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