define(["exports","./Cartographic-3309dd0d","./Math-119be1a3","./PrimitiveType-a54dc62f","./GeometryAttribute-3a88ba31"],(function(a,r,e,t,i){"use strict";var n={},s=new r.Cartesian3,o=new r.Cartesian3,l=new i.Quaternion,y=new t.Matrix3;function C(a,e,n,C,u,m,c,h,x,M){var d=a+e;r.Cartesian3.multiplyByScalar(C,Math.cos(d),s),r.Cartesian3.multiplyByScalar(n,Math.sin(d),o),r.Cartesian3.add(s,o,s);var z=Math.cos(a);z*=z;var f=Math.sin(a);f*=f;var v=m/Math.sqrt(c*z+u*f)/h;return i.Quaternion.fromAxisAngle(s,v,l),t.Matrix3.fromQuaternion(l,y),t.Matrix3.multiplyByVector(y,x,M),r.Cartesian3.normalize(M,M),r.Cartesian3.multiplyByScalar(M,h,M),M}var u=new r.Cartesian3,m=new r.Cartesian3,c=new r.Cartesian3,h=new r.Cartesian3;n.raisePositionsToHeight=function(a,e,t){for(var i=e.ellipsoid,n=e.height,s=e.extrudedHeight,o=t?a.length/3*2:a.length/3,l=new Float64Array(3*o),y=a.length,C=t?y:0,x=0;x<y;x+=3){var M=x+1,d=x+2,z=r.Cartesian3.fromArray(a,x,u);i.scaleToGeodeticSurface(z,z);var f=r.Cartesian3.clone(z,m),v=i.geodeticSurfaceNormal(z,h),_=r.Cartesian3.multiplyByScalar(v,n,c);r.Cartesian3.add(z,_,z),t&&(r.Cartesian3.multiplyByScalar(v,s,_),r.Cartesian3.add(f,_,f),l[x+C]=f.x,l[M+C]=f.y,l[d+C]=f.z),l[x]=z.x,l[M]=z.y,l[d]=z.z}return l};var x=new r.Cartesian3,M=new r.Cartesian3,d=new r.Cartesian3;n.computeEllipsePositions=function(a,t,i){var n=a.semiMinorAxis,s=a.semiMajorAxis,o=a.rotation,l=a.center,y=8*a.granularity,h=n*n,z=s*s,f=s*n,v=r.Cartesian3.magnitude(l),_=r.Cartesian3.normalize(l,x),p=r.Cartesian3.cross(r.Cartesian3.UNIT_Z,l,M);p=r.Cartesian3.normalize(p,p);var O=r.Cartesian3.cross(_,p,d),P=1+Math.ceil(e.CesiumMath.PI_OVER_TWO/y),w=e.CesiumMath.PI_OVER_TWO/(P-1),T=e.CesiumMath.PI_OVER_TWO-P*w;T<0&&(P-=Math.ceil(Math.abs(T)/w));var g,I,E,A,V,R=t?new Array(3*(P*(P+2)*2)):void 0,W=0,S=u,B=m,b=4*P*3,G=b-1,Q=0,H=i?new Array(b):void 0;for(S=C(T=e.CesiumMath.PI_OVER_TWO,o,O,p,h,f,z,v,_,S),t&&(R[W++]=S.x,R[W++]=S.y,R[W++]=S.z),i&&(H[G--]=S.z,H[G--]=S.y,H[G--]=S.x),T=e.CesiumMath.PI_OVER_TWO-w,g=1;g<P+1;++g){if(S=C(T,o,O,p,h,f,z,v,_,S),B=C(Math.PI-T,o,O,p,h,f,z,v,_,B),t){for(R[W++]=S.x,R[W++]=S.y,R[W++]=S.z,E=2*g+2,I=1;I<E-1;++I)A=I/(E-1),V=r.Cartesian3.lerp(S,B,A,c),R[W++]=V.x,R[W++]=V.y,R[W++]=V.z;R[W++]=B.x,R[W++]=B.y,R[W++]=B.z}i&&(H[G--]=S.z,H[G--]=S.y,H[G--]=S.x,H[Q++]=B.x,H[Q++]=B.y,H[Q++]=B.z),T=e.CesiumMath.PI_OVER_TWO-(g+1)*w}for(g=P;g>1;--g){if(S=C(-(T=e.CesiumMath.PI_OVER_TWO-(g-1)*w),o,O,p,h,f,z,v,_,S),B=C(T+Math.PI,o,O,p,h,f,z,v,_,B),t){for(R[W++]=S.x,R[W++]=S.y,R[W++]=S.z,E=2*(g-1)+2,I=1;I<E-1;++I)A=I/(E-1),V=r.Cartesian3.lerp(S,B,A,c),R[W++]=V.x,R[W++]=V.y,R[W++]=V.z;R[W++]=B.x,R[W++]=B.y,R[W++]=B.z}i&&(H[G--]=S.z,H[G--]=S.y,H[G--]=S.x,H[Q++]=B.x,H[Q++]=B.y,H[Q++]=B.z)}S=C(-(T=e.CesiumMath.PI_OVER_TWO),o,O,p,h,f,z,v,_,S);var N={};return t&&(R[W++]=S.x,R[W++]=S.y,R[W++]=S.z,N.positions=R,N.numPts=P),i&&(H[G--]=S.z,H[G--]=S.y,H[G--]=S.x,N.outerPositions=H),N},a.EllipseGeometryLibrary=n}));
