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