You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
2 lines
8.7 KiB
2 lines
8.7 KiB
12 months ago
|
define(["exports","./when-cbf8cd21","./Check-35e1a91d","./Math-6a1814d8","./Cartesian2-c451a606","./Transforms-e4be2a30","./Plane-929e0674","./EllipsoidTangentPlane-af8ae194"],function(a,q,t,X,j,A,Z,G){"use strict";function T(a,t){this.center=j.Cartesian3.clone(q.defaultValue(a,j.Cartesian3.ZERO)),this.halfAxes=A.Matrix3.clone(q.defaultValue(t,A.Matrix3.ZERO))}T.packedLength=j.Cartesian3.packedLength+A.Matrix3.packedLength,T.pack=function(a,t,e){return e=q.defaultValue(e,0),j.Cartesian3.pack(a.center,t,e),A.Matrix3.pack(a.halfAxes,t,e+j.Cartesian3.packedLength),t},T.unpack=function(a,t,e){return t=q.defaultValue(t,0),q.defined(e)||(e=new T),j.Cartesian3.unpack(a,t,e.center),A.Matrix3.unpack(a,t+j.Cartesian3.packedLength,e.halfAxes),e};var R=new j.Cartesian3,I=new j.Cartesian3,E=new j.Cartesian3,L=new j.Cartesian3,z=new j.Cartesian3,S=new j.Cartesian3,U=new A.Matrix3,V={unitary:new A.Matrix3,diagonal:new A.Matrix3};T.fromPoints=function(a,t){if(q.defined(t)||(t=new T),!q.defined(a)||0===a.length)return t.halfAxes=A.Matrix3.ZERO,t.center=j.Cartesian3.ZERO,t;var e,n=a.length,r=j.Cartesian3.clone(a[0],R);for(e=1;e<n;e++)j.Cartesian3.add(r,a[e],r);var i=1/n;j.Cartesian3.multiplyByScalar(r,i,r);var s,o=0,C=0,c=0,u=0,l=0,d=0;for(e=0;e<n;e++)o+=(s=j.Cartesian3.subtract(a[e],r,I)).x*s.x,C+=s.x*s.y,c+=s.x*s.z,u+=s.y*s.y,l+=s.y*s.z,d+=s.z*s.z;o*=i,C*=i,c*=i,u*=i,l*=i,d*=i;var h=U;h[0]=o,h[1]=C,h[2]=c,h[3]=C,h[4]=u,h[5]=l,h[6]=c,h[7]=l,h[8]=d;var x=A.Matrix3.computeEigenDecomposition(h,V),M=A.Matrix3.clone(x.unitary,t.halfAxes),m=A.Matrix3.getColumn(M,0,L),f=A.Matrix3.getColumn(M,1,z),p=A.Matrix3.getColumn(M,2,S),g=-Number.MAX_VALUE,w=-Number.MAX_VALUE,y=-Number.MAX_VALUE,O=Number.MAX_VALUE,b=Number.MAX_VALUE,P=Number.MAX_VALUE;for(e=0;e<n;e++)s=a[e],g=Math.max(j.Cartesian3.dot(m,s),g),w=Math.max(j.Cartesian3.dot(f,s),w),y=Math.max(j.Cartesian3.dot(p,s),y),O=Math.min(j.Cartesian3.dot(m,s),O),b=Math.min(j.Cartesian3.dot(f,s),b),P=Math.min(j.Cartesian3.dot(p,s),P);m=j.Cartesian3.multiplyByScalar(m,.5*(O+g),m),f=j.Cartesian3.multiplyByScalar(f,.5*(b+w),f),p=j.Cartesian3.multiplyByScalar(p,.5*(P+y),p);var N=j.Cartesian3.add(m,f,t.center);j.Cartesian3.add(N,p,N);var v=E;return v.x=g-O,v.y=w-b,v.z=y-P,j.Cartesian3.multiplyByScalar(v,.5,v),A.Matrix3.multiplyByScale(t.halfAxes,v,t.halfAxes),t};var M=new j.Cartesian3,m=new j.Cartesian3;function F(a,t,e,n,r,i,s,o,C,c,u){q.defined(u)||(u=new T);var l=u.halfAxes;A.Matrix3.setColumn(l,0,t,l),A.Matrix3.setColumn(l,1,e,l),A.Matrix3.setColumn(l,2,n,l);var d=M;d.x=(r+i)/2,d.y=(s+o)/2,d.z=(C+c)/2;var h=m;h.x=(i-r)/2,h.y=(o-s)/2,h.z=(c-C)/2;var x=u.center;return d=A.Matrix3.multiplyByVector(l,d,d),j.Cartesian3.add(a,d,x),A.Matrix3.multiplyByScale(l,h,l),u}var Y=new j.Cartographic,H=new j.Cartesian3,J=new j.Cartographic,K=new j.Cartographic,Q=new j.Cartographic,$=new j.Cartographic,aa=new j.Cartographic,ta=new j.Cartesian3,ea=new j.Cartesian3,na=new j.Cartesian3,ra=new j.Cartesian3,ia=new j.Cartesian3,sa=new j.Cartesian2,oa=new j.Cartesian2,Ca=new j.Cartesian2,ca=new j.Cartesian2,ua=new j.Cartesian2,la=new j.Cartesian3,da=new j.Cartesian3,ha=new j.Cartesian3,xa=new j.Cartesian3,Ma=new j.Cartesian2,ma=new j.Cartesian3,fa=new j.Cartesian3,pa=new j.Cartesian3,ga=new Z.Plane(j.Cartesian3.UNIT_X,0);T.fromRectangle=function(a,t,e,n,r){var i,s,o,C,c,u,l;if(t=q.defaultValue(t,0),e=q.defaultValue(e,0),n=q.defaultValue(n,j.Ellipsoid.WGS84),a.width<=X.CesiumMath.PI){var d=j.Rectangle.center(a,Y),h=n.cartographicToCartesian(d,H),x=new G.EllipsoidTangentPlane(h,n);l=x.plane;var M=d.longitude,m=a.south<0&&0<a.north?0:d.latitude,f=j.Cartographic.fromRadians(M,a.north,e,J),p=j.Cartographic.fromRadians(a.west,a.north,e,K),g=j.Cartographic.fromRadians(a.west,m,e,Q),w=j.Cartographic.fromRadians(a.west,a.south,e,$),y=j.Cartographic.fromRadians(M,a.south,e,aa),O=n.cartographicToCartesian(f,ta),b=n.cartographicToCartesian(p,ea),P=n.cartographicToCartesian(g,na),N=n.cartographicToCartesian(w,ra),v=n.cartographicToCartesian(y,ia),A=x.projectPointToNearestOnPlane(O,sa),T=x.projectPointToNearestOnPlane(b,oa),R=x.projectPointTo
|