1 |
- define(["exports","./Cartographic-67e73ef9","./Check-52a7d806","./when-92c6cf3c","./Intersect-b97e930a","./Cartesian2-6033fa5d","./Cartesian4-ad128b5d","./Rectangle-bab7abf0","./IntersectionTests-a42760d9","./PrimitiveType-cdfe443e","./Plane-f8d22530","./GeometryAttribute-ef657318"],(function(t,e,n,i,r,o,a,s,m,c,u,l){"use strict";function f(t,n,r){this.minimum=e.t.clone(i.u(t,e.t.ZERO)),this.maximum=e.t.clone(i.u(n,e.t.ZERO)),r=i.e(r)?e.t.clone(r):e.t.midpoint(this.minimum,this.maximum,new e.t),this.center=r}f.fromPoints=function(t,n){if(i.e(n)||(n=new f),!i.e(t)||0===t.length)return n.minimum=e.t.clone(e.t.ZERO,n.minimum),n.maximum=e.t.clone(e.t.ZERO,n.maximum),n.center=e.t.clone(e.t.ZERO,n.center),n;for(var r=t[0].x,o=t[0].y,a=t[0].z,s=t[0].x,m=t[0].y,c=t[0].z,u=t.length,l=1;l<u;l++){var h=t[l],d=h.x,p=h.y,x=h.z;r=Math.min(d,r),s=Math.max(d,s),o=Math.min(p,o),m=Math.max(p,m),a=Math.min(x,a),c=Math.max(x,c)}var y=n.minimum;y.x=r,y.y=o,y.z=a;var g=n.maximum;return g.x=s,g.y=m,g.z=c,n.center=e.t.midpoint(y,g,n.center),n},f.clone=function(t,n){if(i.e(t))return i.e(n)?(n.minimum=e.t.clone(t.minimum,n.minimum),n.maximum=e.t.clone(t.maximum,n.maximum),n.center=e.t.clone(t.center,n.center),n):new f(t.minimum,t.maximum,t.center)},f.equals=function(t,n){return t===n||i.e(t)&&i.e(n)&&e.t.equals(t.center,n.center)&&e.t.equals(t.minimum,n.minimum)&&e.t.equals(t.maximum,n.maximum)};var h=new e.t;f.intersectPlane=function(t,i){n.o.defined("box",t),n.o.defined("plane",i),h=e.t.subtract(t.maximum,t.minimum,h);var o=e.t.multiplyByScalar(h,.5,h),a=i.normal,s=o.x*Math.abs(a.x)+o.y*Math.abs(a.y)+o.z*Math.abs(a.z),m=e.t.dot(t.center,a)+i.distance;return m-s>0?r.S.INSIDE:m+s<0?r.S.OUTSIDE:r.S.INTERSECTING},f.prototype.clone=function(t){return f.clone(this,t)},f.prototype.intersectPlane=function(t){return f.intersectPlane(this,t)},f.prototype.equals=function(t){return f.equals(this,t)};var d=new a.e;function p(t,r){if(n.o.defined("origin",t),t=(r=i.u(r,s.t.WGS84)).scaleToGeodeticSurface(t),!i.e(t))throw new n.t("origin must not be at the center of the ellipsoid.");var o=l.m.eastNorthUpToFixedFrame(t,r);this._ellipsoid=r,this._origin=t,this._xAxis=e.t.fromCartesian4(c.y.getColumn(o,0,d)),this._yAxis=e.t.fromCartesian4(c.y.getColumn(o,1,d));var a=e.t.fromCartesian4(c.y.getColumn(o,2,d));this._plane=u.o.fromPointNormal(t,a)}Object.defineProperties(p.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 x=new f;p.fromPoints=function(t,e){return n.o.defined("cartesians",t),new p(f.fromPoints(t,x).center,e)};var y=new m.f,g=new e.t;p.prototype.projectPointOntoPlane=function(t,r){n.o.defined("cartesian",t);var a=y;a.origin=t,e.t.normalize(t,a.direction);var s=m.g.rayPlane(a,this._plane,g);if(i.e(s)||(e.t.negate(a.direction,a.direction),s=m.g.rayPlane(a,this._plane,g)),i.e(s)){var c=e.t.subtract(s,this._origin,s),u=e.t.dot(this._xAxis,c),l=e.t.dot(this._yAxis,c);return i.e(r)?(r.x=u,r.y=l,r):new o.o(u,l)}},p.prototype.projectPointsOntoPlane=function(t,e){n.o.defined("cartesians",t),i.e(e)||(e=[]);for(var r=0,o=t.length,a=0;a<o;a++){var s=this.projectPointOntoPlane(t[a],e[r]);i.e(s)&&(e[r]=s,r++)}return e.length=r,e},p.prototype.projectPointToNearestOnPlane=function(t,r){n.o.defined("cartesian",t),i.e(r)||(r=new o.o);var a=y;a.origin=t,e.t.clone(this._plane.normal,a.direction);var s=m.g.rayPlane(a,this._plane,g);i.e(s)||(e.t.negate(a.direction,a.direction),s=m.g.rayPlane(a,this._plane,g));var c=e.t.subtract(s,this._origin,s),u=e.t.dot(this._xAxis,c),l=e.t.dot(this._yAxis,c);return r.x=u,r.y=l,r},p.prototype.projectPointsToNearestOnPlane=function(t,e){n.o.defined("cartesians",t),i.e(e)||(e=[]);var r=t.length;e.length=r;for(var o=0;o<r;o++)e[o]=this.projectPointToNearestOnPlane(t[o],e[o]);return e};var P=new e.t;p.prototype.projectPointOntoEllipsoid=function(t,r){n.o.defined("cartesian",t),i.e(r)||(r=new e.t);var o=this._ellipsoid,a=this._origin,s=this._xAxis,m=this._yAxis,c=P;return e.t.multiplyByScalar(s,t.x,c),r=e.t.add(a,c,r),e.t.multiplyByScalar(m,t.y,c),e.t.add(r,c,r),o.scaleToGeocentricSurface(r,r),r},p.prototype.projectPointsOntoEllipsoid=function(t,e){n.o.defined("cartesians",t);var r=t.length;i.e(e)?e.length=r:e=new Array(r);for(var o=0;o<r;++o)e[o]=this.projectPointOntoEllipsoid(t[o],e[o]);return e},t.e=f,t.f=p}));
|