define(["exports","./Cartographic-3309dd0d","./Math-119be1a3","./Matrix4-cde86d0e","./GeometryAttribute-c42d25b7"],(function(a,r,e,t,i){"use strict";var n={},s=new r.Cartesian3,o=new r.Cartesian3,l=new i.Quaternion,C=new t.Matrix3;function y(a,e,n,y,u,c,m,h,x,M){var d=a+e;r.Cartesian3.multiplyByScalar(y,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 _=c/Math.sqrt(m*z+u*f)/h;return i.Quaternion.fromAxisAngle(s,_,l),t.Matrix3.fromQuaternion(l,C),t.Matrix3.multiplyByVector(C,x,M),r.Cartesian3.normalize(M,M),r.Cartesian3.multiplyByScalar(M,h,M),M}var u=new r.Cartesian3,c=new r.Cartesian3,m=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),C=a.length,y=t?C:0,x=0;x<C;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,c),_=i.geodeticSurfaceNormal(z,h),v=r.Cartesian3.multiplyByScalar(_,n,m);r.Cartesian3.add(z,v,z),t&&(r.Cartesian3.multiplyByScalar(_,s,v),r.Cartesian3.add(f,v,f),l[x+y]=f.x,l[M+y]=f.y,l[d+y]=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,C=8*a.granularity,h=n*n,z=s*s,f=s*n,_=r.Cartesian3.magnitude(l),v=r.Cartesian3.normalize(l,x),O=r.Cartesian3.cross(r.Cartesian3.UNIT_Z,l,M);O=r.Cartesian3.normalize(O,O);var p=r.Cartesian3.cross(v,O,d),w=1+Math.ceil(e.CesiumMath.PI_OVER_TWO/C),P=e.CesiumMath.PI_OVER_TWO/(w-1),g=e.CesiumMath.PI_OVER_TWO-w*P;g<0&&(w-=Math.ceil(Math.abs(g)/P));var I,T,E,A,V,R=t?new Array(3*(w*(w+2)*2)):void 0,W=0,S=u,B=c,b=4*w*3,G=b-1,Q=0,H=i?new Array(b):void 0;for(S=y(g=e.CesiumMath.PI_OVER_TWO,o,p,O,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),g=e.CesiumMath.PI_OVER_TWO-P,I=1;I<w+1;++I){if(S=y(g,o,p,O,h,f,z,_,v,S),B=y(Math.PI-g,o,p,O,h,f,z,_,v,B),t){for(R[W++]=S.x,R[W++]=S.y,R[W++]=S.z,E=2*I+2,T=1;T<E-1;++T)A=T/(E-1),V=r.Cartesian3.lerp(S,B,A,m),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),g=e.CesiumMath.PI_OVER_TWO-(I+1)*P}for(I=w;I>1;--I){if(S=y(-(g=e.CesiumMath.PI_OVER_TWO-(I-1)*P),o,p,O,h,f,z,_,v,S),B=y(g+Math.PI,o,p,O,h,f,z,_,v,B),t){for(R[W++]=S.x,R[W++]=S.y,R[W++]=S.z,E=2*(I-1)+2,T=1;T<E-1;++T)A=T/(E-1),V=r.Cartesian3.lerp(S,B,A,m),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=y(-(g=e.CesiumMath.PI_OVER_TWO),o,p,O,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=w),i&&(H[G--]=S.z,H[G--]=S.y,H[G--]=S.x,N.outerPositions=H),N},a.EllipseGeometryLibrary=n}));
