define(["./AttributeCompression-f9ee669b","./buildModuleUrl-dba4ec07","./Cartesian2-1b9b0d8a","./Cartographic-1bbcab04","./when-515d5295","./Rectangle-e170be8b","./TerrainEncoding-29e3257b","./IndexDatatype-eefd5922","./Check-3aa71481","./Math-5e38123d","./OrientedBoundingBox-57407e6e","./createTaskProcessorWorker","./Intersect-53434a77","./PrimitiveType-b38a4004","./Cartesian4-034d54d5","./RuntimeError-350acae3","./WebGLConstants-77a84876","./Event-9821f5d9","./ComponentDatatype-d430c7f7","./EllipsoidTangentPlane-fd839d7b","./IntersectionTests-5fa33dbd","./Plane-92c15089","./GeometryAttribute-9bc31a7f","./FeatureDetection-7fae0d5a","./PolygonPipeline-b8b35011","./WindingOrder-8479ef05","./EllipsoidRhumbLine-f50fdea6"],(function(e,t,i,n,r,s,h,u,o,a,p,d,f,l,g,c,m,w,x,v,y,b,B,I,A,C,H){"use strict";var T={clipTriangleAtAxisAlignedThreshold:function(e,t,i,n,s,h){if(!r.t(e))throw new o.t("threshold is required.");if(!r.t(t))throw new o.t("keepAbove is required.");if(!r.t(i))throw new o.t("u0 is required.");if(!r.t(n))throw new o.t("u1 is required.");if(!r.t(s))throw new o.t("u2 is required.");var u,a,p;r.t(h)?h.length=0:h=[],t?(u=ie,a=n>e,p=s>e);var d,f,l,g,c,m,w=u+a+p;return 1===w?u?(d=(e-i)/(n-i),f=(e-i)/(s-i),h.push(1),h.push(2),1!==f&&(h.push(-1),h.push(0),h.push(2),h.push(f)),1!==d&&(h.push(-1),h.push(0),h.push(1),h.push(d))):a?(l=(e-n)/(s-n),g=(e-n)/(i-n),h.push(2),h.push(0),1!==g&&(h.push(-1),h.push(1),h.push(0),h.push(g)),1!==l&&(h.push(-1),h.push(1),h.push(2),h.push(l))):p&&(c=(e-s)/(i-s),m=(e-s)/(n-s),h.push(0),h.push(1),1!==m&&(h.push(-1),h.push(2),h.push(1),h.push(m)),1!==c&&(h.push(-1),h.push(2),h.push(0),h.push(c))):2===w?u||i===e?a||n===e?!p&&s!==e&&(f=(e-i)/(s-i),l=(e-n)/(s-n),h.push(2),h.push(-1),h.push(0),h.push(2),h.push(f),h.push(-1),h.push(1),h.push(2),h.push(l)):(m=(e-s)/(n-s),d=(e-i)/(n-i),h.push(1),h.push(-1),h.push(2),h.push(1),h.push(m),h.push(-1),h.push(0),h.push(1),h.push(d)):(g=(e-n)/(i-n),c=(e-s)/(i-s),h.push(0),h.push(-1),h.push(1),h.push(0),h.push(g),h.push(-1),h.push(2),h.push(0),h.push(c)):3!==w&&(h.push(0),h.push(1),h.push(2)),h},computeBarycentricCoordinates:function(e,t,i,s,h,u,a,p,d){if(!r.t(e))throw new o.t("x is required.");if(!r.t(t))throw new o.t("y is required.");if(!r.t(i))throw new o.t("x1 is required.");if(!r.t(s))throw new o.t("y1 is required.");if(!r.t(h))throw new o.t("x2 is required.");if(!r.t(u))throw new o.t("y2 is required.");if(!r.t(a))throw new o.t("x3 is required.");if(!r.t(p))throw new o.t("y3 is required.");var f=i-a,l=a-h,g=u-p,c=s-p,m=1/(g*f+l*c),w=t-p,x=e-a,v=(g*x+l*w)*m,y=(-c*x+f*w)*m,b=1-v-y;return r.t(d)?(d.x=v,d.y=y,d.z=b,d):new n.a(v,y,b)},computeLineSegmentLineSegmentIntersection:function(e,t,n,s,h,u,a,p,d){o.n.typeOf.number("x00",e),o.n.typeOf.number("y00",t),o.n.typeOf.number("x01",n),o.n.typeOf.number("y01",s),o.n.typeOf.number("x10",h),o.n.typeOf.number("y10",u),o.n.typeOf.number("x11",a),o.n.typeOf.number("y11",p);var f=(p-u)*(n-e)-(a-h)*(s-t);if(0!==f){var l=((a-h)*(t-u)-(p-u)*(e-h))/f,g=((n-e)*(t-u)-(s-t)*(e-h))/f;if(l>=0&&l<=1&&g>=0&&g<=1)return r.t(d)||(d=new i.r),d.x=e+l*(n-e),d.y=t+l*(s-t),d}}},O=32767,z=16383,N=[],V=[],q=[],R=new n.i,E=new n.a,M=[],P=[],U=[],F=[],k=[],D=new n.a,L=new t.c,S=new p.b,W=new i.r,X=new n.a;function K(){this.vertexBuffer=void 0,this.index=void 0,this.first=void 0,this.second=void 0,this.ratio=void 0}K.prototype.clone=function(e){return r.t(e)||(e=new K),e.uBuffer=this.uBuffer,e.vBuffer=this.vBuffer,e.heightBuffer=this.heightBuffer,e.normalBuffer=this.normalBuffer,e.index=this.index,e.first=this.first,e.second=this.second,e.ratio=this.ratio,e},K.prototype.initializeIndexed=function(e,t,i,n,r){this.uBuffer=e,this.vBuffer=t,this.heightBuffer=i,this.normalBuffer=n,this.index=r,this.first=void 0,this.second=void 0,this.ratio=void 0},K.prototype.initializeFromClipResult=function(e,t,i){var n=t+1;return-1!==e[t]?i[e[t]].clone(this):(this.vertexBuffer=void 0,this.index=void 0,this.first=i[e[n]],++n,this.second=i[e[n]],++n,this.ratio=e[n],++n),n},K.prototype.getKey=function(){return this.isIndexed()?this.index:JSON.stringify({first:this.first.getKey(),second:this.second.getKey(),ratio:this.ratio})},K.prototype.isIndexed=function(){return r.t(this.index)},K.prototype.getH=function(e,t){if(r.t(this.index))return this.heightBuffer[this.index];var i=this.first.getH(e,t),n=this.second.getH(e,t);return 0===t+i/O*e||0===t+n/O*e?0:a.n.lerp(this.first.getH(),this.second.getH(),this.ratio)},K.prototype.getU=function(){return r.t(this.index)?this.uBuffer[this.index]:a.n.lerp(this.first.getU(),this.second.getU(),this.ratio)},K.prototype.getV=function(){return r.t(this.index)?this.vBuffer[this.index]:a.n.lerp(this.first.getV(),this.second.getV(),this.ratio)};var Y=new i.r,_=-1,G=[new n.a,new n.a],J=[new n.a,new n.a];function Z(t,i){++_;var r=G[_],s=J[_];return r=e.r.octDecode(t.first.getNormalX(),t.first.getNormalY(),r),s=e.r.octDecode(t.second.getNormalX(),t.second.getNormalY(),s),E=n.a.lerp(r,s,t.ratio,E),n.a.normalize(E,E),e.r.octEncode(E,i),--_,i}K.prototype.getNormalX=function(){return r.t(this.index)?this.normalBuffer[2*this.index]:(Y=Z(this,Y)).x},K.prototype.getNormalY=function(){return r.t(this.index)?this.normalBuffer[2*this.index+1]:(Y=Z(this,Y)).y};var j=[];function Q(e,t,i,n,s,h,u,o,a,p,d){if(0!==u.length){for(var f=0,l=0;l=z||!o&&Y<=z)&&(d&&_>=z||!d&&_<=z)&&(b[C]=j,m.push(Y),w.push(_),x.push(he[C]),J&&(v.push(ue[H]),v.push(ue[H+1])),++j)}var pe=[];pe.push(new K),pe.push(new K),pe.push(new K);var de,fe=[];for(fe.push(new K),fe.push(new K),fe.push(new K),C=0;C=ve.length||((de=fe[0].initializeFromClipResult(ve,de,pe))>=ve.length||(de=fe[1].initializeFromClipResult(ve,de,pe))>=ve.length||(de=fe[2].initializeFromClipResult(ve,de,pe),Q(m,w,x,v,y,b,T.clipTriangleAtAxisAlignedThreshold(z,d,fe[0].getV(),fe[1].getV(),fe[2].getV(),V),fe,J,te,ee),de=l?(Ae.push(C),Y=O):Y=2*Y+ye,m[C]=Y,(_=Math.round(w[C]))<=g?(Ie.push(C),_=0):_>=c?(Ce.push(C),_=O):_=2*_+be,w[C]=_,(A=a.n.lerp(ee,te,x[C]/O))Te&&(Te=A);var Ue=A;(Ue=a.n.clamp(Ue,ie,ne))ze&&(ze=Ue),x[C]=A,R.longitude=a.n.lerp(Pe,Me,Y/O),R.latitude=a.n.lerp(Ee,Re,_/O),R.height=A,Ve.cartographicToCartesian(R,E),Ne.push(E.x),Ne.push(E.y),Ne.push(E.z)}var Fe=t.c.fromVertices(Ne,n.a.ZERO,3,L),ke=p.b.fromRectangle(qe,He,Te,Ve,S),De=p.b.fromRectangle(qe,Oe,ze,Ve,S),Le=new h.c(Ve).computeHorizonCullingPointFromVerticesPossiblyUnderEllipsoid(Fe.center,Ne,3,Fe.center,He,D),Se=Te-He,We=new Uint16Array(m.length+w.length+x.length);for(C=0;C