text: define(["exports","./when-b70f2b05","./Check-4a2da0dd","./Math-6e9be73a","./Cartesian2-e2daacf3","./Transforms-0f378919","./ComponentDatatype-d52b9d48","./GeometryAttribute-59b16415","./GeometryAttributes-bb1678be","./GeometryPipeline-85646a48","./IndexDatatype-1ae72019","./GeometryOffsetAttribute-54300e97","./VertexFormat-5c1f812a","./EllipseGeometryLibrary-91fc28ad","./GeometryInstance-d3c43cfb"],function(t,L,e,p,R,j,k,z,B,m,y,Y,d,H,c){"use strict";var U=new R.Cartesian3,Q=new R.Cartesian3,W=new R.Cartesian3,S=new R.Cartesian3,J=new R.Cartesian2,q=new j.Matrix3,Z=new j.Matrix3,K=new j.Quaternion,X=new R.Cartesian3,$=new R.Cartesian3,tt=new R.Cartesian3,et=new R.Cartographic,rt=new R.Cartesian3,at=new R.Cartesian2,it=new R.Cartesian2;function A(t,e,r){var a=e.vertexFormat,i=e.center,n=e.semiMajorAxis,o=e.semiMinorAxis,s=e.ellipsoid,u=e.stRotation,l=r?t.length/3*2:t.length/3,m=e.shadowVolume,p=a.st?new Float32Array(2*l):void 0,y=a.normal?new Float32Array(3*l):void 0,c=a.tangent?new Float32Array(3*l):void 0,d=a.bitangent?new Float32Array(3*l):void 0,A=m?new Float32Array(3*l):void 0,f=0,h=X,x=$,g=tt,_=new j.GeographicProjection(s),b=_.project(s.cartesianToCartographic(i,et),rt),i=s.scaleToGeodeticSurface(i,U);s.geodeticSurfaceNormal(i,i);var C=q,v=Z;v=0!==u?(S=j.Quaternion.fromAxisAngle(i,u,K),C=j.Matrix3.fromQuaternion(S,C),S=j.Quaternion.fromAxisAngle(i,-u,K),j.Matrix3.fromQuaternion(S,v)):(C=j.Matrix3.clone(j.Matrix3.IDENTITY,C),j.Matrix3.clone(j.Matrix3.IDENTITY,v));for(var w=R.Cartesian2.fromElements(Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY,at),M=R.Cartesian2.fromElements(Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY,it),E=t.length,I=r?E:0,T=I/3*2,G=0;G<E;G+=3){var N,P=G+1,F=G+2,V=R.Cartesian3.fromArray(t,G,U);a.st&&(N=j.Matrix3.multiplyByVector(C,V,Q),N=_.project(s.cartesianToCartographic(N,et),W),R.Cartesian3.subtract(N,b,N),J.x=(N.x+n)/(2*n),J.y=(N.y+o)/(2*o),w.x=Math.min(J.x,w.x),w.y=Math.min(J.y,w.y),M.x=Math.max(J.x,M.x),M.y=Math.max(J.y,M.y),r&&(p[f+T]=J.x,p[f+1+T]=J.y),p[f++]=J.x,p[f++]=J.y),(a.normal||a.tangent||a.bitangent||m)&&(h=s.geodeticSurfaceNormal(V,h),m&&(A[G+I]=-h.x,A[P+I]=-h.y,A[F+I]=-h.z),(a.normal||a.tangent||a.bitangent)&&((a.tangent||a.bitangent)&&(x=R.Cartesian3.normalize(R.Cartesian3.cross(R.Cartesian3.UNIT_Z,h,x),x),j.Matrix3.multiplyByVector(v,x,x)),a.normal&&(y[G]=h.x,y[P]=h.y,y[F]=h.z,r&&(y[G+I]=-h.x,y[P+I]=-h.y,y[F+I]=-h.z)),a.tangent&&(c[G]=x.x,c[P]=x.y,c[F]=x.z,r&&(c[G+I]=-x.x,c[P+I]=-x.y,c[F+I]=-x.z)),a.bitangent&&(g=R.Cartesian3.normalize(R.Cartesian3.cross(h,x,g),g),d[G]=g.x,d[P]=g.y,d[F]=g.z,r&&(d[G+I]=g.x,d[P+I]=g.y,d[F+I]=g.z))))}if(a.st){E=p.length;for(var D=0;D<E;D+=2)p[D]=(p[D]-w.x)/(M.x-w.x),p[D+1]=(p[D+1]-w.y)/(M.y-w.y)}var O,S=new B.GeometryAttributes;return a.position&&(O=H.EllipseGeometryLibrary.raisePositionsToHeight(t,e,r),S.position=new z.GeometryAttribute({componentDatatype:k.ComponentDatatype.DOUBLE,componentsPerAttribute:3,values:O})),a.st&&(S.st=new z.GeometryAttribute({componentDatatype:k.ComponentDatatype.FLOAT,componentsPerAttribute:2,values:p})),a.normal&&(S.normal=new z.GeometryAttribute({componentDatatype:k.ComponentDatatype.FLOAT,componentsPerAttribute:3,values:y})),a.tangent&&(S.tangent=new z.GeometryAttribute({componentDatatype:k.ComponentDatatype.FLOAT,componentsPerAttribute:3,values:c})),a.bitangent&&(S.bitangent=new z.GeometryAttribute({componentDatatype:k.ComponentDatatype.FLOAT,componentsPerAttribute:3,values:d})),m&&(S.extrudeDirection=new z.GeometryAttribute({componentDatatype:k.ComponentDatatype.FLOAT,componentsPerAttribute:3,values:A})),r&&L.defined(e.offsetAttribute)&&(O=new Uint8Array(l),O=e.offsetAttribute===Y.GeometryOffsetAttribute.TOP?Y.arrayFill(O,1,0,l/2):(e=e.offsetAttribute===Y.GeometryOffsetAttribute.NONE?0:1,Y.arrayFill(O,e)),S.applyOffset=new z.GeometryAttribute({componentDatatype:k.ComponentDatatype.UNSIGNED_BYTE,componentsPerAttribute:1,values:O})),S}function f(t){for(var e,r,a=new Array(t*(t+1)*12-6),i=0,n=0,o=1,s=0;s<3;s++)a[i++]=o++,a[i++]=n,a[i++]=o;for(s=2;s<t+1;++s){for(o=s*(s+1)-1,n=(s-1)*s-1,a[i++]=o++,a[i++]=n,a[i++]=o,e=2*s,r=0;r<e-1;++r)a[i++]=o,a[i++]=n++,a[i++]=n,a[i++]=o++,a[i++]=n,a[i++]=o;a[i++]=o++,a[i++]=n,a[i++]=o}for(e=2*t,++o,++n,s=0;s<e-1;++s)a[i++]=o,a[i++]=n++,a[i++]=n,a[i++]=o++,a[i++]=n,a[i++]=o;for(a[i++]=o,a[i++]=n++,a[i++]=n,a[i++]=o++,a[i++]=n++,a[i++]=n,++n,s=t-1;1<s;--s){for(a[i++]=n++,a[i++]=n,a[i++]=o,e=2*s,r=0;r<e-1;++r)a[i++]=o,a[i++]=n++,a[i++]=n,a[i++]=o++,a[i++]=n,a[i++]=o;a[i++]=n++,a[i++]=n++,a[i++]=o++}for(s=0;s<3;s++)a[i++]=n++,a[i++]=n,a[i++]=o;return a}var n=new R.Cartesian3;var h=new j.BoundingSphere,x=new j.BoundingSphere;function o(t){var e=t.center,r=t.ellipsoid,a=t.semiMajorAxis,i=R.Cartesian3.multiplyByScalar(r.geodeticSurfaceNormal(e,U),t.height,U);h.center=R.Cartesian3.add(e,i,h.center),h.radius=a,i=R.Cartesian3.multiplyByScalar(r.geodeticSurfaceNormal(e,i),t.extrudedHeight,i),x.center=R.Cartesian3.add(e,i,x.center),x.radius=a;var n=H.EllipseGeometryLibrary.computeEllipsePositions(t,!0,!0),r=n.positions,e=n.numPts,i=n.outerPositions,a=j.BoundingSphere.union(h,x),n=A(r,t,!0),o=(l=f(e)).length;l.length=2*o;for(var s=r.length/3,u=0;u<o;u+=3)l[u+o]=l[u+2]+s,l[u+1+o]=l[u+1]+s,l[u+2+o]=l[u]+s;var r=y.IndexDatatype.createTypedArray(2*s/3,l),r=new z.Geometry({attributes:n,indices:r,primitiveType:z.PrimitiveType.TRIANGLES}),t=function(t,e){var r=e.vertexFormat,a=e.center,i=e.semiMajorAxis,n=e.semiMinorAxis,o=e.ellipsoid,s=e.height,u=e.extrudedHeight,l=e.stRotation,m=t.length/3*2,p=new Float64Array(3*m),y=r.st?new Float32Array(2*m):void 0,c=r.normal?new Float32Array(3*m):void 0,d=r.tangent?new Float32Array(3*m):void 0,A=r.bitangent?new Float32Array(3*m):void 0,f=e.shadowVolume,h=f?new Float32Array(3*m):void 0,x=0,g=X,_=$,b=tt,C=new j.GeographicProjection(o),v=C.project(o.cartesianToCartographic(a,et),rt),a=o.scaleToGeodeticSurface(a,U);o.geodeticSurfaceNormal(a,a);for(var a=j.Quaternion.fromAxisAngle(a,l,K),w=j.Matrix3.fromQuaternion(a,q),M=R.Cartesian2.fromElements(Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY,at),E=R.Cartesian2.fromElements(Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY,it),I=t.length,T=I/3*2,G=0;G<I;G+=3){var N=G+1,P=G+2,F=R.Cartesian3.fromArray(t,G,U);r.st&&(D=j.Matrix3.multiplyByVector(w,F,Q),V=C.project(o.cartesianToCartographic(D,et),W),R.Cartesian3.subtract(V,v,V),J.x=(V.x+i)/(2*i),J.y=(V.y+n)/(2*n),M.x=Math.min(J.x,M.x),M.y=Math.min(J.y,M.y),E.x=Math.max(J.x,E.x),E.y=Math.max(J.y,E.y),y[x+T]=J.x,y[x+1+T]=J.y,y[x++]=J.x,y[x++]=J.y),F=o.scaleToGeodeticSurface(F,F),D=R.Cartesian3.clone(F,Q),g=o.geodeticSurfaceNormal(F,g),f&&(h[G+I]=-g.x,h[N+I]=-g.y,h[P+I]=-g.z);var V=R.Cartesian3.multiplyByScalar(g,s,S),F=R.Cartesian3.add(F,V,F),V=R.Cartesian3.multiplyByScalar(g,u,V),D=R.Cartesian3.add(D,V,D);r.position&&(p[G+I]=D.x,p[N+I]=D.y,p[P+I]=D.z,p[G]=F.x,p[N]=F.y,p[P]=F.z),(r.normal||r.tangent||r.bitangent)&&(b=R.Cartesian3.clone(g,b),V=R.Cartesian3.fromArray(t,(G+3)%I,S),R.Cartesian3.subtract(V,F,V),F=R.Cartesian3.subtract(D,F,W),g=R.Cartesian3.normalize(R.Cartesian3.cross(F,V,g),g),r.normal&&(c[G]=g.x,c[N]=g.y,c[P]=g.z,c[G+I]=g.x,c[N+I]=g.y,c[P+I]=g.z),r.tangent&&(_=R.Cartesian3.normalize(R.Cartesian3.cross(b,g,_),_),d[G]=_.x,d[N]=_.y,d[P]=_.z,d[G+I]=_.x,d[G+1+I]=_.y,d[G+2+I]=_.z),r.bitangent&&(A[G]=b.x,A[N]=b.y,A[P]=b.z,A[G+I]=b.x,A[N+I]=b.y,A[P+I]=b.z))}if(r.st){I=y.length;for(var O=0;O<I;O+=2)y[O]=(y[O]-M.x)/(E.x-M.x),y[O+1]=(y[O+1]-M.y)/(E.y-M.y)}return l=new B.GeometryAttributes,r.position&&(l.position=new z.GeometryAttribute({componentDatatype:k.ComponentDatatype.DOUBLE,componentsPerAttribute:3,values:p})),r.st&&(l.st=new z.GeometryAttribute({componentDatatype:k.ComponentDatatype.FLOAT,componentsPerAttribute:2,values:y})),r.normal&&(l.normal=new z.GeometryAttribute({componentDatatype:k.ComponentDatatype.FLOAT,componentsPerAttribute:3,values:c})),r.tangent&&(l.tangent=new z.GeometryAttribute({componentDatatype:k.ComponentDatatype.FLOAT,componentsPerAttribute:3,values:d})),r.bitangent&&(l.bitangent=new z.GeometryAttribute({componentDatatype:k.ComponentDatatype.FLOAT,componentsPerAttribute:3,values:A})),f&&(l.extrudeDirection=new z.GeometryAttribute({componentDatatype:k.ComponentDatatype.FLOAT,componentsPerAttribute:3,values:h})),L.defined(e.offsetAttribute)&&(a=new Uint8Array(m),a=e.offsetAttribute===Y.GeometryOffsetAttribute.TOP?Y.arrayFill(a,1,0,m/2):(e=e.offsetAttribute===Y.GeometryOffsetAttribute.NONE?0:1,Y.arrayFill(a,e)),l.applyOffset=new z.GeometryAttribute({componentDatatype:k.ComponentDatatype.UNSIGNED_BYTE,componentsPerAttribute:1,values:a})),l}(i,t),l=function(t){for(var e=t.length/3,r=y.IndexDatatype.createTypedArray(e,6*e),a=0,i=0;i<e;i++){var n=i+e,o=(i+1)%e,s=o+e;r[a++]=i,r[a++]=n,r[a++]=o,r[a++]=o,r[a++]=n,r[a++]=s}return r}(i),i=y.IndexDatatype.createTypedArray(2*i.length/3,l),i=new z.Geometry({attributes:t,indices:i,primitiveType:z.PrimitiveType.TRIANGLES}),i=m.GeometryPipeline.combineInstances([new c.GeometryInstance({geometry:r}),new c.GeometryInstance({geometry:i})]);return{boundingSphere:a,attributes:i[0].attributes,indices:i[0].indices}}function s(t,e,r,a,i,n,o){for(var s=H.EllipseGeometryLibrary.computeEllipsePositions({center:t,semiMajorAxis:e,semiMinorAxis:r,rotation:a,granularity:i},!1,!0).outerPositions,u=s.length/3,l=new Array(u),m=0;m<u;++m)l[m]=R.Cartesian3.fromArray(s,3*m);o=R.Rectangle.fromCartesianArray(l,n,o);return o.width>p.CesiumMath.PI&&(o.north=0<o.north?p.CesiumMath.PI_OVER_TWO-p.CesiumMath.EPSILON7:o.north,o.south=o.south<0?p.CesiumMath.EPSILON7-p.CesiumMath.PI_OVER_TWO:o.south,o.east=p.CesiumMath.PI,o.west=-p.CesiumMath.PI),o}function g(t){var e=(t=L.defaultValue(t,L.defaultValue.EMPTY_OBJECT)).center,r=L.defaultValue(t.ellipsoid,R.Ellipsoid.WGS84),a=t.semiMajorAxis,i=t.semiMinorAxis,n=L.defaultValue(t.granularity,p.CesiumMath.RADIANS_PER_DEGREE),o=L.defaultValue(t.vertexFormat,d.VertexFormat.DEFAULT),s=L.defaultValue(t.height,0),u=L.defaultValue(t.extrudedHeight,s);this._center=R.Cartesian3.clone(e),this._semiMajorAxis=a,this._semiMinorAxis=i,this._ellipsoid=R.Ellipsoid.clone(r),this._rotation=L.defaultValue(t.rotation,0),this._stRotation=L.defaultValue(t.stRotation,0),this._height=Math.max(u,s),this._granularity=n,this._vertexFormat=d.VertexFormat.clone(o),this._extrudedHeight=Math.min(u,s),this._shadowVolume=L.defaultValue(t.shadowVolume,!1),this._workerName="createEllipseGeometry",this._offsetAttribute=t.offsetAttribute,this._rectangle=void 0,this._textureCoordinateRotationPoints=void 0}g.packedLength=R.Cartesian3.packedLength+R.Ellipsoid.packedLength+d.VertexFormat.packedLength+9,g.pack=function(t,e,r){return r=L.defaultValue(r,0),R.Cartesian3.pack(t._center,e,r),r+=R.Cartesian3.packedLength,R.Ellipsoid.pack(t._ellipsoid,e,r),r+=R.Ellipsoid.packedLength,d.VertexFormat.pack(t._vertexFormat,e,r),r+=d.VertexFormat.packedLength,e[r++]=t._semiMajorAxis,e[r++]=t._semiMinorAxis,e[r++]=t._rotation,e[r++]=t._stRotation,e[r++]=t._height,e[r++]=t._granularity,e[r++]=t._extrudedHeight,e[r++]=t._shadowVolume?1:0,e[r]=L.defaultValue(t._offsetAttribute,-1),e};var _=new R.Cartesian3,b=new R.Ellipsoid,C=new d.VertexFormat,v={center:_,ellipsoid:b,vertexFormat:C,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};g.unpack=function(t,e,r){e=L.defaultValue(e,0);var a=R.Cartesian3.unpack(t,e,_);e+=R.Cartesian3.packedLength;var i=R.Ellipsoid.unpack(t,e,b);e+=R.Ellipsoid.packedLength;var n=d.VertexFormat.unpack(t,e,C);e+=d.VertexFormat.packedLength;var o=t[e++],s=t[e++],u=t[e++],l=t[e++],m=t[e++],p=t[e++],y=t[e++],c=1===t[e++],e=t[e];return L.defined(r)?(r._center=R.Cartesian3.clone(a,r._center),r._ellipsoid=R.Ellipsoid.clone(i,r._ellipsoid),r._vertexFormat=d.VertexFormat.clone(n,r._vertexFormat),r._semiMajorAxis=o,r._semiMinorAxis=s,r._rotation=u,r._stRotation=l,r._height=m,r._granularity=p,r._extrudedHeight=y,r._shadowVolume=c,r._offsetAttribute=-1===e?void 0:e,r):(v.height=m,v.extrudedHeight=y,v.granularity=p,v.stRotation=l,v.rotation=u,v.semiMajorAxis=o,v.semiMinorAxis=s,v.shadowVolume=c,v.offsetAttribute=-1===e?void 0:e,new g(v))},g.computeRectangle=function(t,e){var r=(t=L.defaultValue(t,L.defaultValue.EMPTY_OBJECT)).center,a=L.defaultValue(t.ellipsoid,R.Ellipsoid.WGS84),i=t.semiMajorAxis,n=t.semiMinorAxis,o=L.defaultValue(t.granularity,p.CesiumMath.RADIANS_PER_DEGREE);return s(r,i,n,L.defaultValue(t.rotation,0),o,a,e)},g.createGeometry=function(t){if(!(t._semiMajorAxis<=0||t._semiMinorAxis<=0)){var e=t._height,r=t._extrudedHeight,a=!p.CesiumMath.equalsEpsilon(e,r,0,p.CesiumMath.EPSILON2);t._center=t._ellipsoid.scaleToGeodeticSurface(t._center,t._center);var i,e={center:t._center,semiMajorAxis:t._semiMajorAxis,semiMinorAxis:t._semiMinorAxis,ellipsoid:t._ellipsoid,rotation:t._rotation,height:e,granularity:t._granularity,vertexFormat:t._vertexFormat,stRotation:t._stRotation};return a?(e.extrudedHeight=r,e.shadowVolume=t._shadowVolume,e.offsetAttribute=t._offsetAttribute,i=o(e)):(i=function(t){var e=t.center;n=R.Cartesian3.multiplyByScalar(t.ellipsoid.geodeticSurfaceNormal(e,n),t.height,n),n=R.Cartesian3.add(e,n,n);var r=new j.BoundingSphere(n,t.semiMajorAxis),e=(a=H.EllipseGeometryLibrary.computeEllipsePositions(t,!0,!1)).positions,a=a.numPts,t=A(e,t,!1),a=f(a);return{boundingSphere:r,attributes:t,indices:a=y.IndexDatatype.createTypedArray(e.length/3,a)}}(e),L.defined(t._offsetAttribute)&&(r=i.attributes.position.values.length,e=new Uint8Array(r/3),r=t._offsetAttribute===Y.GeometryOffsetAttribute.NONE?0:1,Y.arrayFill(e,r),i.attributes.applyOffset=new z.GeometryAttribute({componentDatatype:k.ComponentDatatype.UNSIGNED_BYTE,componentsPerAttribute:1,values:e}))),new z.Geometry({attributes:i.attributes,indices:i.indices,primitiveType:z.PrimitiveType.TRIANGLES,boundingSphere:i.boundingSphere,offsetAttribute:t._offsetAttribute})}},g.createShadowVolume=function(t,e,r){var a=t._granularity,i=t._ellipsoid,e=e(a,i),r=r(a,i);return new g({center:t._center,semiMajorAxis:t._semiMajorAxis,semiMinorAxis:t._semiMinorAxis,ellipsoid:i,rotation:t._rotation,stRotation:t._stRotation,granularity:a,extrudedHeight:e,height:r,vertexFormat:d.VertexFormat.POSITION_ONLY,shadowVolume:!0})},Object.defineProperties(g.prototype,{rectangle:{get:function(){return L.defined(this._rectangle)||(this._rectangle=s(this._center,this._semiMajorAxis,this._semiMinorAxis,this._rotation,this._granularity,this._ellipsoid)),this._rectangle}},textureCoordinateRotationPoints:{get:function(){return L.defined(this._textureCoordinateRotationPoints)||(this._textureCoordinateRotationPoints=function(t){var e=-t._stRotation;if(0==e)return[0,0,0,1,1,0];for(var r=H.EllipseGeometryLibrary.computeEllipsePositions({center:t._center,semiMajorAxis:t._semiMajorAxis,semiMinorAxis:t._semiMinorAxis,rotation:t._rotation,granularity:t._granularity},!1,!0).outerPositions,a=r.length/3,i=new Array(a),n=0;n<a;++n)i[n]=R.Cartesian3.fromArray(r,3*n);var o=t._ellipsoid,t=t.rectangle;return z.Geometry._textureCoordinateRotationPoints(i,e,o,t)}(this)),this._textureCoordinateRotationPoints}}}),t.EllipseGeometry=g});
  