define(["exports","./arrayFill-deb10550","./buildModuleUrl-d920237a","./Cartesian2-2b41fabe","./Cartographic-1d953166","./ComponentDatatype-07894a2b","./CylinderGeometryLibrary-a63776ca","./when-d186add7","./Check-2514d21d","./GeometryAttribute-95780fd1","./GeometryAttributes-9c67dd14","./GeometryOffsetAttribute-da5a1d35","./IndexDatatype-61ffec74","./Math-7f5f2992","./FeatureDetection-4281d393","./VertexFormat-769ac289"],(function(t,e,n,o,a,r,i,s,u,d,f,p,m,c,b,l){"use strict";var y=new o.o,v=new a.t,h=new a.t,w=new a.t,g=new a.t;function A(t){var e=(t=s.u(t,s.u.EMPTY_OBJECT)).length,n=t.topRadius,o=t.bottomRadius,a=s.u(t.vertexFormat,l.n.DEFAULT),r=s.u(t.slices,128);if(!s.e(e))throw new u.t("options.length must be defined.");if(!s.e(n))throw new u.t("options.topRadius must be defined.");if(!s.e(o))throw new u.t("options.bottomRadius must be defined.");if(r<3)throw new u.t("options.slices must be greater than or equal to 3.");if(s.e(t.offsetAttribute)&&t.offsetAttribute===p.z.TOP)throw new u.t("GeometryOffsetAttribute.TOP is not a supported options.offsetAttribute for this geometry.");this._length=e,this._topRadius=n,this._bottomRadius=o,this._vertexFormat=l.n.clone(a),this._slices=r,this._offsetAttribute=t.offsetAttribute,this._workerName="createCylinderGeometry"}A.packedLength=l.n.packedLength+5,A.pack=function(t,e,n){if(!s.e(t))throw new u.t("value is required");if(!s.e(e))throw new u.t("array is required");return n=s.u(n,0),l.n.pack(t._vertexFormat,e,n),n+=l.n.packedLength,e[n++]=t._length,e[n++]=t._topRadius,e[n++]=t._bottomRadius,e[n++]=t._slices,e[n]=s.u(t._offsetAttribute,-1),e};var _,x=new l.n,F={vertexFormat:x,length:void 0,topRadius:void 0,bottomRadius:void 0,slices:void 0,offsetAttribute:void 0};A.unpack=function(t,e,n){if(!s.e(t))throw new u.t("array is required");e=s.u(e,0);var o=l.n.unpack(t,e,x);e+=l.n.packedLength;var a=t[e++],r=t[e++],i=t[e++],d=t[e++],f=t[e];return s.e(n)?(n._vertexFormat=l.n.clone(o,n._vertexFormat),n._length=a,n._topRadius=r,n._bottomRadius=i,n._slices=d,n._offsetAttribute=-1===f?void 0:f,n):(F.length=a,F.topRadius=r,F.bottomRadius=i,F.slices=d,F.offsetAttribute=-1===f?void 0:f,new A(F))},A.createGeometry=function(t){var u=t._length,l=t._topRadius,A=t._bottomRadius,_=t._vertexFormat,x=t._slices;if(!(u<=0||l<0||A<0||0===l&&0===A)){var F,R=x+x,D=x+R,O=R+R,T=i.I.computePositions(u,l,A,x,!0),C=_.st?new Float32Array(2*O):void 0,L=_.normal?new Float32Array(3*O):void 0,P=_.tangent?new Float32Array(3*O):void 0,z=_.bitangent?new Float32Array(3*O):void 0,k=_.normal||_.tangent||_.bitangent;if(k){var G=_.tangent||_.bitangent,I=0,M=0,E=0,N=Math.atan2(A-l,u),U=v;U.z=Math.sin(N);var q=Math.cos(N),S=w,B=h;for(F=0;F<x;F++){var Y=F/x*c.e.TWO_PI,Z=q*Math.cos(Y),J=q*Math.sin(Y);k&&(U.x=Z,U.y=J,G&&(S=a.t.normalize(a.t.cross(a.t.UNIT_Z,U,S),S)),_.normal&&(L[I++]=U.x,L[I++]=U.y,L[I++]=U.z,L[I++]=U.x,L[I++]=U.y,L[I++]=U.z),_.tangent&&(P[M++]=S.x,P[M++]=S.y,P[M++]=S.z,P[M++]=S.x,P[M++]=S.y,P[M++]=S.z),_.bitangent&&(B=a.t.normalize(a.t.cross(U,S,B),B),z[E++]=B.x,z[E++]=B.y,z[E++]=B.z,z[E++]=B.x,z[E++]=B.y,z[E++]=B.z))}for(F=0;F<x;F++)_.normal&&(L[I++]=0,L[I++]=0,L[I++]=-1),_.tangent&&(P[M++]=1,P[M++]=0,P[M++]=0),_.bitangent&&(z[E++]=0,z[E++]=-1,z[E++]=0);for(F=0;F<x;F++)_.normal&&(L[I++]=0,L[I++]=0,L[I++]=1),_.tangent&&(P[M++]=1,P[M++]=0,P[M++]=0),_.bitangent&&(z[E++]=0,z[E++]=1,z[E++]=0)}var V=12*x-12,W=m.IndexDatatype.createTypedArray(O,V),j=0,H=0;for(F=0;F<x-1;F++)W[j++]=H,W[j++]=H+2,W[j++]=H+3,W[j++]=H,W[j++]=H+3,W[j++]=H+1,H+=2;for(W[j++]=R-2,W[j++]=0,W[j++]=1,W[j++]=R-2,W[j++]=1,W[j++]=R-1,F=1;F<x-1;F++)W[j++]=R+F+1,W[j++]=R+F,W[j++]=R;for(F=1;F<x-1;F++)W[j++]=D,W[j++]=D+F,W[j++]=D+F+1;var K=0;if(_.st){var Q=Math.max(l,A);for(F=0;F<O;F++){var X=a.t.fromArray(T,3*F,g);C[K++]=(X.x+Q)/(2*Q),C[K++]=(X.y+Q)/(2*Q)}}var $=new f.a;_.position&&($.position=new d.o({componentDatatype:r.ComponentDatatype.DOUBLE,componentsPerAttribute:3,values:T})),_.normal&&($.normal=new d.o({componentDatatype:r.ComponentDatatype.FLOAT,componentsPerAttribute:3,values:L})),_.tangent&&($.tangent=new d.o({componentDatatype:r.ComponentDatatype.FLOAT,componentsPerAttribute:3,values:P})),_.bitangent&&($.bitangent=new d.o({componentDatatype:r.ComponentDatatype.FLOAT,componentsPerAttribute:3,values:z})),_.st&&($.st=new d.o({componentDatatype:r.ComponentDatatype.FLOAT,componentsPerAttribute:2,values:C})),y.x=.5*u,y.y=Math.max(A,l);var tt=new n.i(a.t.ZERO,o.o.magnitude(y));if(s.e(t._offsetAttribute)){u=T.length;var et=new Uint8Array(u/3),nt=t._offsetAttribute===p.z.NONE?0:1;e.d(et,nt),$.applyOffset=new d.o({componentDatatype:r.ComponentDatatype.UNSIGNED_BYTE,componentsPerAttribute:1,values:et})}return new d.I({attributes:$,indices:W,primitiveType:b._0x12cc5d.TRIANGLES,boundingSphere:tt,offsetAttribute:t._offsetAttribute})}},A.getUnitCylinder=function(){return s.e(_)||(_=A.createGeometry(new A({topRadius:1,bottomRadius:1,length:1,vertexFormat:l.n.POSITION_ONLY}))),_},t.l=A}));
