define(["exports","./Cartesian4-b0ddc4ba","./Check-7b2a090c","./when-b60132fc","./buildModuleUrl-8cce5713","./Plane-5716a082","./GeometryAttribute-923c2729","./earcut-2.2.1-20c8012f","./FeatureDetection-ab6f364c","./EllipsoidRhumbLine-3ee4574a","./Math-31e539c2","./WebGLConstants-aba9fc67"],(function(e,t,a,n,i,r,s,o,u,l,m,c){"use strict";function d(e,a,i){this.minimum=t.Cartesian3.clone(n.defaultValue(e,t.Cartesian3.ZERO)),this.maximum=t.Cartesian3.clone(n.defaultValue(a,t.Cartesian3.ZERO)),i=n.defined(i)?t.Cartesian3.clone(i):t.Cartesian3.midpoint(this.minimum,this.maximum,new t.Cartesian3),this.center=i}d.fromPoints=function(e,a){if(n.defined(a)||(a=new d),!n.defined(e)||0===e.length)return a.minimum=t.Cartesian3.clone(t.Cartesian3.ZERO,a.minimum),a.maximum=t.Cartesian3.clone(t.Cartesian3.ZERO,a.maximum),a.center=t.Cartesian3.clone(t.Cartesian3.ZERO,a.center),a;for(var i=e[0].x,r=e[0].y,s=e[0].z,o=e[0].x,u=e[0].y,l=e[0].z,m=e.length,c=1;c0?i.Intersect.INSIDE:o+s<0?i.Intersect.OUTSIDE:i.Intersect.INTERSECTING},d.prototype.clone=function(e){return d.clone(this,e)},d.prototype.intersectPlane=function(e){return d.intersectPlane(this,e)},d.prototype.equals=function(e){return d.equals(this,e)};var p=new t.Cartesian4;function C(e,a){e=(a=n.defaultValue(a,i.Ellipsoid.WGS84)).scaleToGeodeticSurface(e);var o=s.Transforms.eastNorthUpToFixedFrame(e,a);this._ellipsoid=a,this._origin=e,this._xAxis=t.Cartesian3.fromCartesian4(i.Matrix4.getColumn(o,0,p)),this._yAxis=t.Cartesian3.fromCartesian4(i.Matrix4.getColumn(o,1,p));var u=t.Cartesian3.fromCartesian4(i.Matrix4.getColumn(o,2,p));this._plane=r.Plane.fromPointNormal(e,u)}Object.defineProperties(C.prototype,{ellipsoid:{get:function(){return this._ellipsoid}},origin:{get:function(){return this._origin}},plane:{get:function(){return this._plane}},xAxis:{get:function(){return this._xAxis}},yAxis:{get:function(){return this._yAxis}},zAxis:{get:function(){return this._plane.normal}}});var f=new d;C.fromPoints=function(e,t){return new C(d.fromPoints(e,f).center,t)};var y=new r.Ray,g=new t.Cartesian3;C.prototype.projectPointOntoPlane=function(e,a){var s=y;s.origin=e,t.Cartesian3.normalize(e,s.direction);var o=r.IntersectionTests.rayPlane(s,this._plane,g);if(n.defined(o)||(t.Cartesian3.negate(s.direction,s.direction),o=r.IntersectionTests.rayPlane(s,this._plane,g)),n.defined(o)){var u=t.Cartesian3.subtract(o,this._origin,o),l=t.Cartesian3.dot(this._xAxis,u),m=t.Cartesian3.dot(this._yAxis,u);return n.defined(a)?(a.x=l,a.y=m,a):new i.Cartesian2(l,m)}},C.prototype.projectPointsOntoPlane=function(e,t){n.defined(t)||(t=[]);for(var a=0,i=e.length,r=0;r0?E.COUNTER_CLOCKWISE:E.CLOCKWISE},triangulate:function(e,t){var a=i.Cartesian2.packArray(e);return o.earcut(a,t,2)}},b=new t.Cartesian3,S=new t.Cartesian3,_=new t.Cartesian3,M=new t.Cartesian3,O=new t.Cartesian3,T=new t.Cartesian3,R=new t.Cartesian3;w.computeSubdivision=function(e,a,r,o,l){l=n.defaultValue(l,!1),o=n.defaultValue(o,m.Math3D.RADIANS_PER_DEGREE);var c,d=r.slice(0),h=a.length,p=new Array(3*h),C=0;for(c=0;c0;){var P,A,w=d.pop(),D=d.pop(),z=d.pop(),I=t.Cartesian3.fromArray(p,3*z,b),L=t.Cartesian3.fromArray(p,3*D,S),G=t.Cartesian3.fromArray(p,3*w,_),N=l?I:t.Cartesian3.multiplyByScalar(t.Cartesian3.normalize(I,M),x,M),W=l?L:t.Cartesian3.multiplyByScalar(t.Cartesian3.normalize(L,O),x,O),B=l?G:t.Cartesian3.multiplyByScalar(t.Cartesian3.normalize(G,T),x,T),j=t.Cartesian3.magnitudeSquared(t.Cartesian3.subtract(N,W,R)),U=t.Cartesian3.magnitudeSquared(t.Cartesian3.subtract(W,B,R)),q=t.Cartesian3.magnitudeSquared(t.Cartesian3.subtract(B,N,R)),V=Math.max(j,U,q);V>E?j===V?(c=g[P=Math.min(z,D)+" "+Math.max(z,D)],n.defined(c)||(A=t.Cartesian3.add(I,L,R),t.Cartesian3.multiplyByScalar(A,.5,A),p.push(A.x,A.y,A.z),c=p.length/3-1,g[P]=c),d.push(z,c,w),d.push(c,D,w)):U===V?(c=g[P=Math.min(D,w)+" "+Math.max(D,w)],n.defined(c)||(A=t.Cartesian3.add(L,G,R),t.Cartesian3.multiplyByScalar(A,.5,A),p.push(A.x,A.y,A.z),c=p.length/3-1,g[P]=c),d.push(D,c,z),d.push(c,w,z)):q===V&&(c=g[P=Math.min(w,z)+" "+Math.max(w,z)],n.defined(c)||(A=t.Cartesian3.add(G,I,R),t.Cartesian3.multiplyByScalar(A,.5,A),p.push(A.x,A.y,A.z),c=p.length/3-1,g[P]=c),d.push(w,c,D),d.push(c,z,D)):(y.push(z),y.push(D),y.push(w))}return new s.Geometry({attributes:{position:new s.GeometryAttribute({componentDatatype:u.ComponentDatatype.DOUBLE,componentsPerAttribute:3,values:p})},indices:y,primitiveType:i.PrimitiveType.TRIANGLES})};var D=new t.Cartographic,z=new t.Cartographic,I=new t.Cartographic,L=new t.Cartographic;w.computeRhumbLineSubdivision=function(e,a,r,o){o=n.defaultValue(o,m.Math3D.RADIANS_PER_DEGREE);var c,d=r.slice(0),h=a.length,p=new Array(3*h),C=0;for(c=0;c0;){var w=d.pop(),M=d.pop(),O=d.pop(),T=t.Cartesian3.fromArray(p,3*O,b),G=t.Cartesian3.fromArray(p,3*M,S),N=t.Cartesian3.fromArray(p,3*w,_),W=e.cartesianToCartographic(T,D),B=e.cartesianToCartographic(G,z),j=e.cartesianToCartographic(N,I);E.setEndPoints(W,B);var U=E.surfaceDistance;P.setEndPoints(B,j);var q=P.surfaceDistance;A.setEndPoints(j,W);var V,F,K,Z,k=A.surfaceDistance,H=Math.max(U,q,k);H>v?U===H?(c=g[V=Math.min(O,M)+" "+Math.max(O,M)],n.defined(c)||(F=E.interpolateUsingFraction(.5,L),K=.5*(W.height+B.height),Z=t.Cartesian3.fromRadians(F.longitude,F.latitude,K,e,R),p.push(Z.x,Z.y,Z.z),c=p.length/3-1,g[V]=c),d.push(O,c,w),d.push(c,M,w)):q===H?(c=g[V=Math.min(M,w)+" "+Math.max(M,w)],n.defined(c)||(F=P.interpolateUsingFraction(.5,L),K=.5*(B.height+j.height),Z=t.Cartesian3.fromRadians(F.longitude,F.latitude,K,e,R),p.push(Z.x,Z.y,Z.z),c=p.length/3-1,g[V]=c),d.push(M,c,O),d.push(c,w,O)):k===H&&(c=g[V=Math.min(w,O)+" "+Math.max(w,O)],n.defined(c)||(F=A.interpolateUsingFraction(.5,L),K=.5*(j.height+W.height),Z=t.Cartesian3.fromRadians(F.longitude,F.latitude,K,e,R),p.push(Z.x,Z.y,Z.z),c=p.length/3-1,g[V]=c),d.push(w,c,M),d.push(c,O,M)):(y.push(O),y.push(M),y.push(w))}return new s.Geometry({attributes:{position:new s.GeometryAttribute({componentDatatype:u.ComponentDatatype.DOUBLE,componentsPerAttribute:3,values:p})},indices:y,primitiveType:i.PrimitiveType.TRIANGLES})},w.scaleToGeodeticHeight=function(e,a,r,s){r=n.defaultValue(r,i.Ellipsoid.WGS84);var o=P,u=A;if(a=n.defaultValue(a,0),s=n.defaultValue(s,!0),n.defined(e))for(var l=e.length,m=0;m