1 |
- define(["exports","./Check-52a7d806","./when-92c6cf3c","./Math-92c3b5f7"],(function(e,t,n,r){"use strict";function o(e,t,r){this.x=n.u(e,0),this.y=n.u(t,0),this.z=n.u(r,0)}o.fromSpherical=function(e,r){t.o.typeOf.object("spherical",e),n.e(r)||(r=new o);var a=e.clock,i=e.cone,u=n.u(e.magnitude,1),f=u*Math.sin(i);return r.x=f*Math.cos(a),r.y=f*Math.sin(a),r.z=u*Math.cos(i),r},o.fromElements=function(e,t,r,a){return n.e(a)?(a.x=e,a.y=t,a.z=r,a):new o(e,t,r)},o.clone=function(e,t){if(n.e(e))return n.e(t)?(t.x=e.x,t.y=e.y,t.z=e.z,t):new o(e.x,e.y,e.z)},o.fromCartesian4=o.clone,o.packedLength=3,o.pack=function(e,r,o){return t.o.typeOf.object("value",e),t.o.defined("array",r),o=n.u(o,0),r[o++]=e.x,r[o++]=e.y,r[o]=e.z,r},o.unpack=function(e,r,a){return t.o.defined("array",e),r=n.u(r,0),n.e(a)||(a=new o),a.x=e[r++],a.y=e[r++],a.z=e[r],a},o.packArray=function(e,r){t.o.defined("array",e);var a=e.length;n.e(r)?r.length=3*a:r=new Array(3*a);for(var i=0;i<a;++i)o.pack(e[i],r,3*i);return r},o.unpackArray=function(e,r){if(t.o.defined("array",e),t.o.typeOf.number.greaterThanOrEquals("array.length",e.length,3),e.length%3!=0)throw new t.t("array length must be a multiple of 3.");var a=e.length;n.e(r)?r.length=a/3:r=new Array(a/3);for(var i=0;i<a;i+=3){var u=i/3;r[u]=o.unpack(e,i,r[u])}return r},o.fromArray=o.unpack,o.maximumComponent=function(e){return t.o.typeOf.object("cartesian",e),Math.max(e.x,e.y,e.z)},o.minimumComponent=function(e){return t.o.typeOf.object("cartesian",e),Math.min(e.x,e.y,e.z)},o.minimumByComponent=function(e,n,r){return t.o.typeOf.object("first",e),t.o.typeOf.object("second",n),t.o.typeOf.object("result",r),r.x=Math.min(e.x,n.x),r.y=Math.min(e.y,n.y),r.z=Math.min(e.z,n.z),r},o.maximumByComponent=function(e,n,r){return t.o.typeOf.object("first",e),t.o.typeOf.object("second",n),t.o.typeOf.object("result",r),r.x=Math.max(e.x,n.x),r.y=Math.max(e.y,n.y),r.z=Math.max(e.z,n.z),r},o.magnitudeSquared=function(e){return t.o.typeOf.object("cartesian",e),e.x*e.x+e.y*e.y+e.z*e.z},o.magnitude=function(e){return Math.sqrt(o.magnitudeSquared(e))};var a=new o;o.distance=function(e,n){return t.o.typeOf.object("left",e),t.o.typeOf.object("right",n),o.subtract(e,n,a),o.magnitude(a)},o.distanceSquared=function(e,n){return t.o.typeOf.object("left",e),t.o.typeOf.object("right",n),o.subtract(e,n,a),o.magnitudeSquared(a)},o.normalize=function(e,n){t.o.typeOf.object("cartesian",e),t.o.typeOf.object("result",n);var r=o.magnitude(e);if(n.x=e.x/r,n.y=e.y/r,n.z=e.z/r,isNaN(n.x)||isNaN(n.y)||isNaN(n.z))throw new t.t("normalized result is not a number");return n},o.dot=function(e,n){return t.o.typeOf.object("left",e),t.o.typeOf.object("right",n),e.x*n.x+e.y*n.y+e.z*n.z},o.multiplyComponents=function(e,n,r){return t.o.typeOf.object("left",e),t.o.typeOf.object("right",n),t.o.typeOf.object("result",r),r.x=e.x*n.x,r.y=e.y*n.y,r.z=e.z*n.z,r},o.divideComponents=function(e,n,r){return t.o.typeOf.object("left",e),t.o.typeOf.object("right",n),t.o.typeOf.object("result",r),r.x=e.x/n.x,r.y=e.y/n.y,r.z=e.z/n.z,r},o.add=function(e,n,r){return t.o.typeOf.object("left",e),t.o.typeOf.object("right",n),t.o.typeOf.object("result",r),r.x=e.x+n.x,r.y=e.y+n.y,r.z=e.z+n.z,r},o.subtract=function(e,n,r){return t.o.typeOf.object("left",e),t.o.typeOf.object("right",n),t.o.typeOf.object("result",r),r.x=e.x-n.x,r.y=e.y-n.y,r.z=e.z-n.z,r},o.multiplyByScalar=function(e,n,r){return t.o.typeOf.object("cartesian",e),t.o.typeOf.number("scalar",n),t.o.typeOf.object("result",r),r.x=e.x*n,r.y=e.y*n,r.z=e.z*n,r},o.divideByScalar=function(e,n,r){return t.o.typeOf.object("cartesian",e),t.o.typeOf.number("scalar",n),t.o.typeOf.object("result",r),r.x=e.x/n,r.y=e.y/n,r.z=e.z/n,r},o.negate=function(e,n){return t.o.typeOf.object("cartesian",e),t.o.typeOf.object("result",n),n.x=-e.x,n.y=-e.y,n.z=-e.z,n},o.abs=function(e,n){return t.o.typeOf.object("cartesian",e),t.o.typeOf.object("result",n),n.x=Math.abs(e.x),n.y=Math.abs(e.y),n.z=Math.abs(e.z),n};var i=new o;o.lerp=function(e,n,r,a){return t.o.typeOf.object("start",e),t.o.typeOf.object("end",n),t.o.typeOf.number("t",r),t.o.typeOf.object("result",a),o.multiplyByScalar(n,r,i),a=o.multiplyByScalar(e,1-r,a),o.add(i,a,a)};var u=new o,f=new o;o.angleBetween=function(e,n){t.o.typeOf.object("left",e),t.o.typeOf.object("right",n),o.normalize(e,u),o.normalize(n,f);var r=o.dot(u,f),a=o.magnitude(o.cross(u,f,u));return Math.atan2(a,r)};var c=new o;o.mostOrthogonalAxis=function(e,n){t.o.typeOf.object("cartesian",e),t.o.typeOf.object("result",n);var r=o.normalize(e,c);return o.abs(r,r),n=r.x<=r.y?r.x<=r.z?o.clone(o.UNIT_X,n):o.clone(o.UNIT_Z,n):r.y<=r.z?o.clone(o.UNIT_Y,n):o.clone(o.UNIT_Z,n)},o.projectVector=function(e,n,r){t.o.defined("a",e),t.o.defined("b",n),t.o.defined("result",r);var a=o.dot(e,n)/o.dot(n,n);return o.multiplyByScalar(n,a,r)},o.equals=function(e,t){return e===t||n.e(e)&&n.e(t)&&e.x===t.x&&e.y===t.y&&e.z===t.z},o.equalsArray=function(e,t,n){return e.x===t[n]&&e.y===t[n+1]&&e.z===t[n+2]},o.equalsEpsilon=function(e,t,o,a){return e===t||n.e(e)&&n.e(t)&&r.e.equalsEpsilon(e.x,t.x,o,a)&&r.e.equalsEpsilon(e.y,t.y,o,a)&&r.e.equalsEpsilon(e.z,t.z,o,a)},o.cross=function(e,n,r){t.o.typeOf.object("left",e),t.o.typeOf.object("right",n),t.o.typeOf.object("result",r);var o=e.x,a=e.y,i=e.z,u=n.x,f=n.y,c=n.z,l=a*c-i*f,s=i*u-o*c,y=o*f-a*u;return r.x=l,r.y=s,r.z=y,r},o.midpoint=function(e,n,r){return t.o.typeOf.object("left",e),t.o.typeOf.object("right",n),t.o.typeOf.object("result",r),r.x=.5*(e.x+n.x),r.y=.5*(e.y+n.y),r.z=.5*(e.z+n.z),r},o.fromDegrees=function(e,n,a,i,u){return t.o.typeOf.number("longitude",e),t.o.typeOf.number("latitude",n),e=r.e.toRadians(e),n=r.e.toRadians(n),o.fromRadians(e,n,a,i,u)};var l=new o,s=new o,y=new o(40680631590769,40680631590769,40408299984661.445),d=new o(40680631590769,40680631590769,40680631590769);o.fromRadians=function(e,a,i,u,f){t.o.typeOf.number("longitude",e),t.o.typeOf.number("latitude",a),i=n.u(i,0);var c=n.e(u)?u.radiiSquared:d;r.e.equalsEpsilon(r.e.Radius,6356752.314245179,r.e.EPSILON10)&&(c=n.e(u)?u.radiiSquared:y);var h=Math.cos(a);l.x=h*Math.cos(e),l.y=h*Math.sin(e),l.z=Math.sin(a),l=o.normalize(l,l),o.multiplyComponents(c,l,s);var p=Math.sqrt(o.dot(l,s));return s=o.divideByScalar(s,p,s),l=o.multiplyByScalar(l,i,l),n.e(f)||(f=new o),o.add(s,l,f)},o.fromDegreesArray=function(e,r,a){if(t.o.defined("coordinates",e),e.length<2||e.length%2!=0)throw new t.t("the number of coordinates must be a multiple of 2 and at least 2");var i=e.length;n.e(a)?a.length=i/2:a=new Array(i/2);for(var u=0;u<i;u+=2){var f=e[u],c=e[u+1],l=u/2;a[l]=o.fromDegrees(f,c,0,r,a[l])}return a},o.fromRadiansArray=function(e,r,a){if(t.o.defined("coordinates",e),e.length<2||e.length%2!=0)throw new t.t("the number of coordinates must be a multiple of 2 and at least 2");var i=e.length;n.e(a)?a.length=i/2:a=new Array(i/2);for(var u=0;u<i;u+=2){var f=e[u],c=e[u+1],l=u/2;a[l]=o.fromRadians(f,c,0,r,a[l])}return a},o.fromDegreesArrayHeights=function(e,r,a){if(t.o.defined("coordinates",e),e.length<3||e.length%3!=0)throw new t.t("the number of coordinates must be a multiple of 3 and at least 3");var i=e.length;n.e(a)?a.length=i/3:a=new Array(i/3);for(var u=0;u<i;u+=3){var f=e[u],c=e[u+1],l=e[u+2],s=u/3;a[s]=o.fromDegrees(f,c,l,r,a[s])}return a},o.fromRadiansArrayHeights=function(e,r,a){if(t.o.defined("coordinates",e),e.length<3||e.length%3!=0)throw new t.t("the number of coordinates must be a multiple of 3 and at least 3");var i=e.length;n.e(a)?a.length=i/3:a=new Array(i/3);for(var u=0;u<i;u+=3){var f=e[u],c=e[u+1],l=e[u+2],s=u/3;a[s]=o.fromRadians(f,c,l,r,a[s])}return a},o.ZERO=Object.freeze(new o(0,0,0)),o.UNIT_X=Object.freeze(new o(1,0,0)),o.UNIT_Y=Object.freeze(new o(0,1,0)),o.UNIT_Z=Object.freeze(new o(0,0,1)),o.UNIT_XYZ=Object.freeze(new o(1,1,1)),o.prototype.clone=function(e){return o.clone(this,e)},o.prototype.equals=function(e){return o.equals(this,e)},o.prototype.equalsEpsilon=function(e,t,n){return o.equalsEpsilon(this,e,t,n)},o.prototype.toString=function(){return"("+this.x+", "+this.y+", "+this.z+")"},o.globalOffset=new o(0,0,0);var h=new o,p=new o;function m(e,a,i,u,f){if(!n.e(e))throw new t.t("cartesian is required.");if(!n.e(a))throw new t.t("oneOverRadii is required.");if(!n.e(i))throw new t.t("oneOverRadiiSquared is required.");if(!n.e(u))throw new t.t("centerToleranceSquared is required.");var c=e.x,l=e.y,s=e.z,y=a.x,d=a.y,m=a.z,b=c*c*y*y,g=l*l*d*d,O=s*s*m*m,z=b+g+O,x=Math.sqrt(1/z),w=o.multiplyByScalar(e,x,h);if(z<u)return isFinite(x)?o.clone(w,f):void 0;var j=i.x,v=i.y,q=i.z,M=p;M.x=w.x*j*2,M.y=w.y*v*2,M.z=w.z*q*2;var R,S,E,N,A,B,C,I=(1-x)*o.magnitude(e)/(.5*o.magnitude(M)),T=0;do{T=(R=b*(A=(S=1/(1+(I-=T)*j))*S)+g*(B=(E=1/(1+I*v))*E)+O*(C=(N=1/(1+I*q))*N)-1)/(-2*(b*(A*S)*j+g*(B*E)*v+O*(C*N)*q))}while(Math.abs(R)>r.e.EPSILON12);return n.e(f)?(f.x=c*S,f.y=l*E,f.z=s*N,f):new o(c*S,l*E,s*N)}function b(e,t,r){this.longitude=n.u(e,0),this.latitude=n.u(t,0),this.height=n.u(r,0)}b.fromRadians=function(e,r,o,a){return t.o.typeOf.number("longitude",e),t.o.typeOf.number("latitude",r),o=n.u(o,0),n.e(a)?(a.longitude=e,a.latitude=r,a.height=o,a):new b(e,r,o)},b.fromDegrees=function(e,n,o,a){return t.o.typeOf.number("longitude",e),t.o.typeOf.number("latitude",n),e=r.e.toRadians(e),n=r.e.toRadians(n),b.fromRadians(e,n,o,a)};var g=new o,O=new o,z=new o,x=new o(1/6378137,1/6378137,1/6356752.314245179),w=new o(1/6378137,1/6378137,1/6378137),j=new o(1/40680631590769,1/40680631590769,1/40408299984661.445),v=new o(1/40680631590769,1/40680631590769,1/40680631590769),q=r.e.EPSILON1;b.fromCartesian=function(e,t,a){var i=n.e(t)?t.oneOverRadii:w,u=n.e(t)?t.oneOverRadiiSquared:v,f=n.e(t)?t._centerToleranceSquared:q;r.e.equalsEpsilon(r.e.Radius,6356752.314245179,r.e.EPSILON10)&&(i=n.e(t)?t.oneOverRadii:x,u=n.e(t)?t.oneOverRadiiSquared:j);var c=m(e,i,u,f,O);if(n.e(c)){var l=o.multiplyComponents(c,u,g);l=o.normalize(l,l);var s=o.subtract(e,c,z),y=Math.atan2(l.y,l.x),d=Math.asin(l.z),h=r.e.sign(o.dot(s,e))*o.magnitude(s);return n.e(a)?(a.longitude=y,a.latitude=d,a.height=h,a):new b(y,d,h)}},b.toCartesian=function(e,n,r){return t.o.defined("cartographic",e),o.fromRadians(e.longitude,e.latitude,e.height,n,r)},b.sphericalDistance=function(e,n,o,a){if(t.o.defined("longitudeA",e),t.o.defined("longitudeB",o),t.o.defined("latitudeA",n),t.o.defined("latitudeB",a),e===o&&n===a)return 0;var i=r.e.toRadians(n),u=r.e.toRadians(a),f=r.e.toRadians(e),c=r.e.toRadians(o),l=f*f+i*i,s=c*c+u*u,y=(l+s-((f-c)*(f-c)+(i-u)*(i-u)))/(2*Math.sqrt(l)*Math.sqrt(s));return y=r.e.clamp(y,-1,1),Math.acos(y)*r.e.Radius},b.clone=function(e,t){if(n.e(e))return n.e(t)?(t.longitude=e.longitude,t.latitude=e.latitude,t.height=e.height,t):new b(e.longitude,e.latitude,e.height)},b.equals=function(e,t){return e===t||n.e(e)&&n.e(t)&&e.longitude===t.longitude&&e.latitude===t.latitude&&e.height===t.height},b.equalsEpsilon=function(e,r,o){return t.o.typeOf.number("epsilon",o),e===r||n.e(e)&&n.e(r)&&Math.abs(e.longitude-r.longitude)<=o&&Math.abs(e.latitude-r.latitude)<=o&&Math.abs(e.height-r.height)<=o},b.ZERO=Object.freeze(new b(0,0,0)),b.prototype.clone=function(e){return b.clone(this,e)},b.prototype.equals=function(e){return b.equals(this,e)},b.prototype.equalsEpsilon=function(e,t){return b.equalsEpsilon(this,e,t)},b.prototype.toString=function(){return"("+this.longitude+", "+this.latitude+", "+this.height+")"},e.P=m,e.t=o,e.t$1=b}));
|