NONGYESHUZIDIZUO/public/Cesium/Workers/PolygonPipeline-f2f37e26.js

2 lines
9.3 KiB
JavaScript
Raw Normal View History

2023-11-16 09:58:20 +08:00
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;c<m;c++){var h=e[c],p=h.x,C=h.y,f=h.z;i=Math.min(p,i),o=Math.max(p,o),r=Math.min(C,r),u=Math.max(C,u),s=Math.min(f,s),l=Math.max(f,l)}var y=a.minimum;y.x=i,y.y=r,y.z=s;var g=a.maximum;return g.x=o,g.y=u,g.z=l,a.center=t.Cartesian3.midpoint(y,g,a.center),a},d.clone=function(e,a){if(n.defined(e))return n.defined(a)?(a.minimum=t.Cartesian3.clone(e.minimum,a.minimum),a.maximum=t.Cartesian3.clone(e.maximum,a.maximum),a.center=t.Cartesian3.clone(e.center,a.center),a):new d(e.minimum,e.maximum,e.center)},d.equals=function(e,a){return e===a||n.defined(e)&&n.defined(a)&&t.Cartesian3.equals(e.center,a.center)&&t.Cartesian3.equals(e.minimum,a.minimum)&&t.Cartesian3.equals(e.maximum,a.maximum)};var h=new t.Cartesian3;d.intersectPlane=function(e,a){h=t.Cartesian3.subtract(e.maximum,e.minimum,h);var n=t.Cartesian3.multiplyByScalar(h,.5,h),r=a.normal,s=n.x*Math.abs(r.x)+n.y*Math.abs(r.y)+n.z*Math.abs(r.z),o=t.Cartesian3.dot(e.center,r)+a.distance;return o-s>0?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;r<i;r++){var s=this.projectPointOntoPlane(e[r],t[a]);n.defined(s)&&(t[a]=s,a++)}return t.length=a,t},C.prototype.projectPointToNearestOnPlane=function(e,a){n.defined(a)||(a=new i.Cartesian2);var s=y;s.origin=e,t.Cartesian3.clone(this._plane.normal,s.direction);var o=r.IntersectionTests.rayPlane(s,this._plane,g);n.defined(o)||(t.Cartesian3.negate(s.direction,s.direction),o=r.IntersectionTests.rayPlane(s,this._plane,g));var u=t.Cartesian3.subtract(o,this._origin,o),l=t.Cartesian3.dot(this._xAxis,u),m=t.Cartesian3.do