define(["./defaultValue-81eec7ed","./Cartesian2-bd414876","./BoundingSphere-9a3b5656","./Cartesian3-e0307675","./ComponentDatatype-aaeec80f","./Check-741c5f3c","./GeometryAttribute-2b42a913","./GeometryAttributes-32b29525","./IndexDatatype-3f3c99e8","./Math-e73894ab","./VertexFormat-d50a69ba","./WallGeometryLibrary-2f7aa617","./GeographicProjection-c931c7fb","./Matrix4-4c545f70","./RuntimeError-26acdd3b","./Rectangle-cf3e0e3e","./WebGLConstants-508b9636","./Matrix2-dc0c61cc","./Transforms-5b829630","./when-422ea0ae","./Resource-8ae1a924","./combine-3c023bda","./arrayRemoveDuplicates-cea3b206","./PolylinePipeline-0e56eeb9","./EllipsoidGeodesic-e7a5ca44","./EllipsoidRhumbLine-592e8885","./IntersectionTests-80510c7b","./Plane-bc8b6777"],(function(e,t,n,i,a,o,r,s,l,m,c,u,p,d,y,f,g,h,b,C,x,A,_,E,w,F,v,L){"use strict";const k=new i.Cartesian3,V=new i.Cartesian3,G=new i.Cartesian3,H=new i.Cartesian3,P=new i.Cartesian3,D=new i.Cartesian3,T=new i.Cartesian3;function z(n){const a=(n=e.defaultValue(n,e.defaultValue.EMPTY_OBJECT)).positions,o=n.maximumHeights,r=n.minimumHeights,s=e.defaultValue(n.vertexFormat,c.VertexFormat.DEFAULT),l=e.defaultValue(n.granularity,m.CesiumMath.RADIANS_PER_DEGREE),u=e.defaultValue(n.ellipsoid,t.Ellipsoid.WGS84);this._positions=a,this._minimumHeights=r,this._maximumHeights=o,this._vertexFormat=c.VertexFormat.clone(s),this._granularity=l,this._ellipsoid=t.Ellipsoid.clone(u),this._workerName="createWallGeometry";let p=1+a.length*i.Cartesian3.packedLength+2;e.defined(r)&&(p+=r.length),e.defined(o)&&(p+=o.length),this.packedLength=p+t.Ellipsoid.packedLength+c.VertexFormat.packedLength+1}z.pack=function(n,a,o){let r;o=e.defaultValue(o,0);const s=n._positions;let l=s.length;for(a[o++]=l,r=0;r<l;++r,o+=i.Cartesian3.packedLength)i.Cartesian3.pack(s[r],a,o);const m=n._minimumHeights;if(l=e.defined(m)?m.length:0,a[o++]=l,e.defined(m))for(r=0;r<l;++r)a[o++]=m[r];const u=n._maximumHeights;if(l=e.defined(u)?u.length:0,a[o++]=l,e.defined(u))for(r=0;r<l;++r)a[o++]=u[r];return t.Ellipsoid.pack(n._ellipsoid,a,o),o+=t.Ellipsoid.packedLength,c.VertexFormat.pack(n._vertexFormat,a,o),a[o+=c.VertexFormat.packedLength]=n._granularity,a};const R=t.Ellipsoid.clone(t.Ellipsoid.UNIT_SPHERE),O=new c.VertexFormat,S={positions:void 0,minimumHeights:void 0,maximumHeights:void 0,ellipsoid:R,vertexFormat:O,granularity:void 0};return z.unpack=function(n,a,o){let r;a=e.defaultValue(a,0);let s=n[a++];const l=new Array(s);for(r=0;r<s;++r,a+=i.Cartesian3.packedLength)l[r]=i.Cartesian3.unpack(n,a);let m,u;if(s=n[a++],s>0)for(m=new Array(s),r=0;r<s;++r)m[r]=n[a++];if(s=n[a++],s>0)for(u=new Array(s),r=0;r<s;++r)u[r]=n[a++];const p=t.Ellipsoid.unpack(n,a,R);a+=t.Ellipsoid.packedLength;const d=c.VertexFormat.unpack(n,a,O),y=n[a+=c.VertexFormat.packedLength];return e.defined(o)?(o._positions=l,o._minimumHeights=m,o._maximumHeights=u,o._ellipsoid=t.Ellipsoid.clone(p,o._ellipsoid),o._vertexFormat=c.VertexFormat.clone(d,o._vertexFormat),o._granularity=y,o):(S.positions=l,S.minimumHeights=m,S.maximumHeights=u,S.granularity=y,new z(S))},z.fromConstantHeights=function(t){const n=(t=e.defaultValue(t,e.defaultValue.EMPTY_OBJECT)).positions;let i,a;const o=t.minimumHeight,r=t.maximumHeight,s=e.defined(o),l=e.defined(r);if(s||l){const e=n.length;i=s?new Array(e):void 0,a=l?new Array(e):void 0;for(let t=0;t<e;++t)s&&(i[t]=o),l&&(a[t]=r)}return new z({positions:n,maximumHeights:a,minimumHeights:i,ellipsoid:t.ellipsoid,vertexFormat:t.vertexFormat})},z.createGeometry=function(t){const o=t._positions,c=t._minimumHeights,p=t._maximumHeights,d=t._vertexFormat,y=t._granularity,f=t._ellipsoid,g=u.WallGeometryLibrary.computePositions(f,o,p,c,y,!0);if(!e.defined(g))return;const h=g.bottomPositions,b=g.topPositions,C=g.numCorners;let x=b.length,A=2*x;const _=d.position?new Float64Array(A):void 0,E=d.normal?new Float32Array(A):void 0,w=d.tangent?new Float32Array(A):void 0,F=d.bitangent?new Float32Array(A):void 0,v=d.st?new Float32Array(A/3*2):void 0;let L,z=0,R=0,O=0,S=0,I=0,M=T,N=D,B=P,W=!0;x/=3;let U=0;const q=1/(x-C-1);for(L=0;L<x;++L){const e=3*L,t=i.Cartesian3.fromArray(b,e,k),n=i.Cartesian3.fromArray(h,e,V);if(d.position&&(_[z++]=n.x,_[z++]=n.y,_[z++]=n.z,_[z++]=t.x,_[z++]=t.y,_[z++]=t.z),d.st&&(v[I++]=U,v[I++]=0,v[I++]=U,v[I++]=1),d.normal||d.tangent||d.bitangent){let n=i.Cartesian3.clone(i.Cartesian3.ZERO,H);const a=i.Cartesian3.subtract(t,f.geodeticSurfaceNormal(t,V),V);if(L+1<x&&(n=i.Cartesian3.fromArray(b,e+3,H)),W){const e=i.Cartesian3.subtract(n,t,G),o=i.Cartesian3.subtract(a,t,k);M=i.Cartesian3.normalize(i.Cartesian3.cross(o,e,M),M),W=!1}i.Cartesian3.equalsEpsilon(t,n,m.CesiumMath.EPSILON10)?W=!0:(U+=q,d.tangent&&(N=i.Cartesian3.normalize(i.Cartesian3.subtract(n,t,N),N)),d.bitangent&&(B=i.Cartesian3.normalize(i.Cartesian3.cross(M,N,B),B))),d.normal&&(E[R++]=M.x,E[R++]=M.y,E[R++]=M.z,E[R++]=M.x,E[R++]=M.y,E[R++]=M.z),d.tangent&&(w[S++]=N.x,w[S++]=N.y,w[S++]=N.z,w[S++]=N.x,w[S++]=N.y,w[S++]=N.z),d.bitangent&&(F[O++]=B.x,F[O++]=B.y,F[O++]=B.z,F[O++]=B.x,F[O++]=B.y,F[O++]=B.z)}}const J=new s.GeometryAttributes;d.position&&(J.position=new r.GeometryAttribute({componentDatatype:a.ComponentDatatype.DOUBLE,componentsPerAttribute:3,values:_})),d.normal&&(J.normal=new r.GeometryAttribute({componentDatatype:a.ComponentDatatype.FLOAT,componentsPerAttribute:3,values:E})),d.tangent&&(J.tangent=new r.GeometryAttribute({componentDatatype:a.ComponentDatatype.FLOAT,componentsPerAttribute:3,values:w})),d.bitangent&&(J.bitangent=new r.GeometryAttribute({componentDatatype:a.ComponentDatatype.FLOAT,componentsPerAttribute:3,values:F})),d.st&&(J.st=new r.GeometryAttribute({componentDatatype:a.ComponentDatatype.FLOAT,componentsPerAttribute:2,values:v}));const Y=A/3;A-=6*(C+1);const j=l.IndexDatatype.createTypedArray(Y,A);let Z=0;for(L=0;L<Y-2;L+=2){const e=L,t=L+2,n=i.Cartesian3.fromArray(_,3*e,k),a=i.Cartesian3.fromArray(_,3*t,V);if(i.Cartesian3.equalsEpsilon(n,a,m.CesiumMath.EPSILON10))continue;const o=L+1,r=L+3;j[Z++]=o,j[Z++]=e,j[Z++]=r,j[Z++]=r,j[Z++]=e,j[Z++]=t}return new r.Geometry({attributes:J,indices:j,primitiveType:r.PrimitiveType.TRIANGLES,boundingSphere:new n.BoundingSphere.fromVertices(_)})},function(n,i){return e.defined(i)&&(n=z.unpack(n,i)),n._ellipsoid=t.Ellipsoid.clone(n._ellipsoid),z.createGeometry(n)}}));