define(["exports","./GeometryOffsetAttribute-ff1e192c","./Transforms-7cd3197b","./Matrix2-f2da41d4","./RuntimeError-ffe03243","./ComponentDatatype-17b06483","./when-229515d6","./EllipseGeometryLibrary-69f5ff56","./GeometryAttribute-80036e07","./GeometryAttributes-b253752a","./GeometryInstance-16601d2a","./GeometryPipeline-5b3fba53","./IndexDatatype-b10faa0b","./VertexFormat-565d6a6c"],(function(e,t,r,a,i,n,o,s,l,u,m,p,y,c){"use strict";var d=new a.Cartesian3,f=new a.Cartesian3,A=new a.Cartesian3,x=new a.Cartesian3,h=new a.Cartesian2,g=new a.Matrix3,_=new a.Matrix3,b=new r.Quaternion,v=new a.Cartesian3,C=new a.Cartesian3,w=new a.Cartesian3,E=new a.Cartographic,M=new a.Cartesian3,I=new a.Cartesian2,T=new a.Cartesian2;function G(e,i,m){var p=i.vertexFormat,y=i.center,c=i.semiMajorAxis,x=i.semiMinorAxis,G=i.ellipsoid,N=i.stRotation,P=m?e.length/3*2:e.length/3,F=i.shadowVolume,V=p.st?new Float32Array(2*P):void 0,D=p.normal?new Float32Array(3*P):void 0,O=p.tangent?new Float32Array(3*P):void 0,S=p.bitangent?new Float32Array(3*P):void 0,L=F?new Float32Array(3*P):void 0,R=0,j=v,z=C,k=w,B=new r.GeographicProjection(G),Y=B.project(G.cartesianToCartographic(y,E),M),H=G.scaleToGeodeticSurface(y,d);G.geodeticSurfaceNormal(H,H);var U=g,Q=_;if(0!==N){var W=r.Quaternion.fromAxisAngle(H,N,b);U=a.Matrix3.fromQuaternion(W,U),W=r.Quaternion.fromAxisAngle(H,-N,b),Q=a.Matrix3.fromQuaternion(W,Q)}else U=a.Matrix3.clone(a.Matrix3.IDENTITY,U),Q=a.Matrix3.clone(a.Matrix3.IDENTITY,Q);for(var J=a.Cartesian2.fromElements(Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY,I),q=a.Cartesian2.fromElements(Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY,T),Z=e.length,K=m?Z:0,X=K/3*2,$=0;$1;--i){for(o[s++]=t++,o[s++]=t,o[s++]=a,r=2*i,n=0;nn.CesiumMath.PI&&(d.north=d.north>0?n.CesiumMath.PI_OVER_TWO-n.CesiumMath.EPSILON7:d.north,d.south=d.south<0?n.CesiumMath.EPSILON7-n.CesiumMath.PI_OVER_TWO:d.south,d.east=n.CesiumMath.PI,d.west=-n.CesiumMath.PI),d}function S(e){var t=(e=o.defaultValue(e,o.defaultValue.EMPTY_OBJECT)).center,r=o.defaultValue(e.ellipsoid,a.Ellipsoid.WGS84),i=e.semiMajorAxis,s=e.semiMinorAxis,l=o.defaultValue(e.granularity,n.CesiumMath.RADIANS_PER_DEGREE),u=o.defaultValue(e.vertexFormat,c.VertexFormat.DEFAULT),m=o.defaultValue(e.height,0),p=o.defaultValue(e.extrudedHeight,m);this._center=a.Cartesian3.clone(t),this._semiMajorAxis=i,this._semiMinorAxis=s,this._ellipsoid=a.Ellipsoid.clone(r),this._rotation=o.defaultValue(e.rotation,0),this._stRotation=o.defaultValue(e.stRotation,0),this._height=Math.max(p,m),this._granularity=l,this._vertexFormat=c.VertexFormat.clone(u),this._extrudedHeight=Math.min(p,m),this._shadowVolume=o.defaultValue(e.shadowVolume,!1),this._workerName="createEllipseGeometry",this._offsetAttribute=e.offsetAttribute,this._rectangle=void 0,this._textureCoordinateRotationPoints=void 0}S.packedLength=a.Cartesian3.packedLength+a.Ellipsoid.packedLength+c.VertexFormat.packedLength+9,S.pack=function(e,t,r){return r=o.defaultValue(r,0),a.Cartesian3.pack(e._center,t,r),r+=a.Cartesian3.packedLength,a.Ellipsoid.pack(e._ellipsoid,t,r),r+=a.Ellipsoid.packedLength,c.VertexFormat.pack(e._vertexFormat,t,r),r+=c.VertexFormat.packedLength,t[r++]=e._semiMajorAxis,t[r++]=e._semiMinorAxis,t[r++]=e._rotation,t[r++]=e._stRotation,t[r++]=e._height,t[r++]=e._granularity,t[r++]=e._extrudedHeight,t[r++]=e._shadowVolume?1:0,t[r]=o.defaultValue(e._offsetAttribute,-1),t};var L=new a.Cartesian3,R=new a.Ellipsoid,j=new c.VertexFormat,z={center:L,ellipsoid:R,vertexFormat:j,semiMajorAxis:void 0,semiMinorAxis:void 0,rotation:void 0,stRotation:void 0,height:void 0,granularity:void 0,extrudedHeight:void 0,shadowVolume:void 0,offsetAttribute:void 0};S.unpack=function(e,t,r){t=o.defaultValue(t,0);var i=a.Cartesian3.unpack(e,t,L);t+=a.Cartesian3.packedLength;var n=a.Ellipsoid.unpack(e,t,R);t+=a.Ellipsoid.packedLength;var s=c.VertexFormat.unpack(e,t,j);t+=c.VertexFormat.packedLength;var l=e[t++],u=e[t++],m=e[t++],p=e[t++],y=e[t++],d=e[t++],f=e[t++],A=1===e[t++],x=e[t];return o.defined(r)?(r._center=a.Cartesian3.clone(i,r._center),r._ellipsoid=a.Ellipsoid.clone(n,r._ellipsoid),r._vertexFormat=c.VertexFormat.clone(s,r._vertexFormat),r._semiMajorAxis=l,r._semiMinorAxis=u,r._rotation=m,r._stRotation=p,r._height=y,r._granularity=d,r._extrudedHeight=f,r._shadowVolume=A,r._offsetAttribute=-1===x?void 0:x,r):(z.height=y,z.extrudedHeight=f,z.granularity=d,z.stRotation=p,z.rotation=m,z.semiMajorAxis=l,z.semiMinorAxis=u,z.shadowVolume=A,z.offsetAttribute=-1===x?void 0:x,new S(z))},S.computeRectangle=function(e,t){var r=(e=o.defaultValue(e,o.defaultValue.EMPTY_OBJECT)).center,i=o.defaultValue(e.ellipsoid,a.Ellipsoid.WGS84),s=e.semiMajorAxis,l=e.semiMinorAxis,u=o.defaultValue(e.granularity,n.CesiumMath.RADIANS_PER_DEGREE);return O(r,s,l,o.defaultValue(e.rotation,0),u,i,t)},S.createGeometry=function(e){if(!(e._semiMajorAxis<=0||e._semiMinorAxis<=0)){var i=e._height,u=e._extrudedHeight,m=!n.CesiumMath.equalsEpsilon(i,u,0,n.CesiumMath.EPSILON2);e._center=e._ellipsoid.scaleToGeodeticSurface(e._center,e._center);var p,c={center:e._center,semiMajorAxis:e._semiMajorAxis,semiMinorAxis:e._semiMinorAxis,ellipsoid:e._ellipsoid,rotation:e._rotation,height:i,granularity:e._granularity,vertexFormat:e._vertexFormat,stRotation:e._stRotation};if(m)c.extrudedHeight=u,c.shadowVolume=e._shadowVolume,c.offsetAttribute=e._offsetAttribute,p=D(c);else if(p=function(e){var t=e.center;P=a.Cartesian3.multiplyByScalar(e.ellipsoid.geodeticSurfaceNormal(t,P),e.height,P),P=a.Cartesian3.add(t,P,P);var i=new r.BoundingSphere(P,e.semiMajorAxis),n=s.EllipseGeometryLibrary.computeEllipsePositions(e,!0,!1),o=n.positions,l=n.numPts,u=G(o,e,!1),m=N(l);return{boundingSphere:i,attributes:u,indices:m=y.IndexDatatype.createTypedArray(o.length/3,m)}}(c),o.defined(e._offsetAttribute)){var d=p.attributes.position.values.length,f=new Uint8Array(d/3),A=e._offsetAttribute===t.GeometryOffsetAttribute.NONE?0:1;t.arrayFill(f,A),p.attributes.applyOffset=new l.GeometryAttribute({componentDatatype:n.ComponentDatatype.UNSIGNED_BYTE,componentsPerAttribute:1,values:f})}return new l.Geometry({attributes:p.attributes,indices:p.indices,primitiveType:l.PrimitiveType.TRIANGLES,boundingSphere:p.boundingSphere,offsetAttribute:e._offsetAttribute})}},S.createShadowVolume=function(e,t,r){var a=e._granularity,i=e._ellipsoid,n=t(a,i),o=r(a,i);return new S({center:e._center,semiMajorAxis:e._semiMajorAxis,semiMinorAxis:e._semiMinorAxis,ellipsoid:i,rotation:e._rotation,stRotation:e._stRotation,granularity:a,extrudedHeight:n,height:o,vertexFormat:c.VertexFormat.POSITION_ONLY,shadowVolume:!0})},Object.defineProperties(S.prototype,{rectangle:{get:function(){return o.defined(this._rectangle)||(this._rectangle=O(this._center,this._semiMajorAxis,this._semiMinorAxis,this._rotation,this._granularity,this._ellipsoid)),this._rectangle}},textureCoordinateRotationPoints:{get:function(){return o.defined(this._textureCoordinateRotationPoints)||(this._textureCoordinateRotationPoints=function(e){var t=-e._stRotation;if(0===t)return[0,0,0,1,1,0];for(var r=s.EllipseGeometryLibrary.computeEllipsePositions({center:e._center,semiMajorAxis:e._semiMajorAxis,semiMinorAxis:e._semiMinorAxis,rotation:e._rotation,granularity:e._granularity},!1,!0).outerPositions,i=r.length/3,n=new Array(i),o=0;o