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