define(["exports","./arrayRemoveDuplicates-d2f048c5","./Cartographic-3309dd0d","./when-b60132fc","./Math-119be1a3","./PolylinePipeline-971d8853","./Transforms-cb0006b0","./BoundingSphere-561b54d0"],(function(e,i,r,t,n,a,o,l){"use strict";var s={};function h(e,i){return n.CesiumMath.equalsEpsilon(e.latitude,i.latitude,n.CesiumMath.EPSILON10)&&n.CesiumMath.equalsEpsilon(e.longitude,i.longitude,n.CesiumMath.EPSILON10)}var g=new r.Cartographic,d=new r.Cartographic;var p=new Array(2),u=new Array(2),c={positions:void 0,height:void 0,granularity:void 0,ellipsoid:void 0};function y(e,i){for(var t=new Array(e.length),n=0;n<e.length;n+=3){var a=new r.Cartesian3(e[n],e[n+1],e[n+2]);l.Matrix4.multiplyByPoint(i,a,a),t[n]=a.x,t[n+1]=a.y,t[n+2]=a.z}return t}s.computePositions=function(e,s,f,P,v,m,A){var w=function(e,n,a,o){var l=(n=i.arrayRemoveDuplicates(n,r.Cartesian3.equalsEpsilon)).length;if(!(l<2)){var s=t.defined(o),p=t.defined(a),u=!0,c=new Array(l),y=new Array(l),f=new Array(l),P=n[0];c[0]=P;var v=e.cartesianToCartographic(P,g);p&&(v.height=a[0]),u=u&&0==v.height,y[0]=v.height,f[0]=s?o[0]:0;for(var m=1,A=1;A<l;++A){var w=n[A],C=e.cartesianToCartographic(w,d);p&&(C.height=a[A]),u=u&&0==C.height,h(v,C)?v.height<C.height&&(y[m-1]=C.height):(c[m]=w,y[m]=C.height,f[m]=s?o[A]:0,r.Cartographic.clone(C,v),++m)}if(!(u||m<2))return c.length=m,y.length=m,f.length=m,{positions:c,topHeights:y,bottomHeights:f}}}(e,s,f,P);if(t.defined(w)){var C=o.Transforms.eastNorthUpToFixedFrame(w.positions[0],e,new l.Matrix4),b=l.Matrix4.inverse(C,new l.Matrix4);s=w.positions,f=w.topHeights,P=w.bottomHeights;var F,M,x,E,T=s.length,H=T-2,L=n.CesiumMath.chordLength(v,e.maximumRadius),q=c;if(q.minDistance=L,q.ellipsoid=e,m){var D,N=0;for(D=0;D<T-1;D++)N+=a.PolylinePipeline.numberOfPoints(s[D],s[D+1],L)+1;F=new Float64Array(3*N),M=new Float64Array(3*N),t.defined(A)&&(x=new Float64Array(3*N),E=new Float64Array(3*N));var O=p,R=u;q.positions=O,q.height=R;var S=0;for(D=0;D<T-1;D++){O[0]=s[D],O[1]=s[D+1],R[0]=f[D],R[1]=f[D+1];var B=a.PolylinePipeline.generateArc(q);F.set(B,S),t.defined(A)&&x.set(y(B,b),S),R[0]=P[D],R[1]=P[D+1],M.set(a.PolylinePipeline.generateArc(q),S),t.defined(A)&&E.set(y(a.PolylinePipeline.generateArc(q),b),S),S+=B.length}}else q.positions=s,q.height=f,F=new Float64Array(a.PolylinePipeline.generateArc(q)),t.defined(A)&&(x=new Float64Array(y(a.PolylinePipeline.generateArc(q)))),q.height=P,M=new Float64Array(a.PolylinePipeline.generateArc(q)),t.defined(A)&&(E=new Float64Array(y(a.PolylinePipeline.generateArc(q))));var I={pos:{bottomPositions:M,topPositions:F,numCorners:H}};return t.defined(A)&&(I.localPos={bottomPositions:E,topPositions:x,numCorners:H}),I}},e.WallGeometryLibrary=s}));
