| 1 |
- import{a as c}from"./chunk-LNIYJJXS.js";import{a as h}from"./chunk-4D2ERGZX.js";import{a as o}from"./chunk-EDZQSM3T.js";import{a as b}from"./chunk-PJGSCWXZ.js";import{a as f}from"./chunk-NUC3LT2W.js";function a(e,n,t){this.x=h(e,0),this.y=h(n,0),this.z=h(t,0)}a.fromSpherical=function(e,n){o.typeOf.object("spherical",e),f(n)||(n=new a);var t=e.clock,r=e.cone,i=h(e.magnitude,1),u=i*Math.sin(r);return n.x=u*Math.cos(t),n.y=u*Math.sin(t),n.z=i*Math.cos(r),n};a.fromElements=function(e,n,t,r){return f(r)?(r.x=e,r.y=n,r.z=t,r):new a(e,n,t)};a.clone=function(e,n){if(!!f(e))return f(n)?(n.x=e.x,n.y=e.y,n.z=e.z,n):new a(e.x,e.y,e.z)};a.fromCartesian4=a.clone;a.packedLength=3;a.pack=function(e,n,t){return o.typeOf.object("value",e),o.defined("array",n),t=h(t,0),n[t++]=e.x,n[t++]=e.y,n[t]=e.z,n};a.unpack=function(e,n,t){return o.defined("array",e),n=h(n,0),f(t)||(t=new a),t.x=e[n++],t.y=e[n++],t.z=e[n],t};a.packArray=function(e,n){o.defined("array",e);var t=e.length;f(n)?n.length=t*3:n=new Array(t*3);for(var r=0;r<t;++r)a.pack(e[r],n,r*3);return n};a.unpackArray=function(e,n){if(o.defined("array",e),o.typeOf.number.greaterThanOrEquals("array.length",e.length,3),e.length%3!==0)throw new b("array length must be a multiple of 3.");var t=e.length;f(n)?n.length=t/3:n=new Array(t/3);for(var r=0;r<t;r+=3){var i=r/3;n[i]=a.unpack(e,r,n[i])}return n};a.fromArray=a.unpack;a.maximumComponent=function(e){return o.typeOf.object("cartesian",e),Math.max(e.x,e.y,e.z)};a.minimumComponent=function(e){return o.typeOf.object("cartesian",e),Math.min(e.x,e.y,e.z)};a.minimumByComponent=function(e,n,t){return o.typeOf.object("first",e),o.typeOf.object("second",n),o.typeOf.object("result",t),t.x=Math.min(e.x,n.x),t.y=Math.min(e.y,n.y),t.z=Math.min(e.z,n.z),t};a.maximumByComponent=function(e,n,t){return o.typeOf.object("first",e),o.typeOf.object("second",n),o.typeOf.object("result",t),t.x=Math.max(e.x,n.x),t.y=Math.max(e.y,n.y),t.z=Math.max(e.z,n.z),t};a.magnitudeSquared=function(e){return o.typeOf.object("cartesian",e),e.x*e.x+e.y*e.y+e.z*e.z};a.magnitude=function(e){return Math.sqrt(a.magnitudeSquared(e))};var E=new a;a.distance=function(e,n){return o.typeOf.object("left",e),o.typeOf.object("right",n),a.subtract(e,n,E),a.magnitude(E)};a.distanceSquared=function(e,n){return o.typeOf.object("left",e),o.typeOf.object("right",n),a.subtract(e,n,E),a.magnitudeSquared(E)};a.normalize=function(e,n){o.typeOf.object("cartesian",e),o.typeOf.object("result",n);var t=a.magnitude(e);if(n.x=e.x/t,n.y=e.y/t,n.z=e.z/t,isNaN(n.x)||isNaN(n.y)||isNaN(n.z))throw new b("normalized result is not a number");return n};a.dot=function(e,n){return o.typeOf.object("left",e),o.typeOf.object("right",n),e.x*n.x+e.y*n.y+e.z*n.z};a.multiplyComponents=function(e,n,t){return o.typeOf.object("left",e),o.typeOf.object("right",n),o.typeOf.object("result",t),t.x=e.x*n.x,t.y=e.y*n.y,t.z=e.z*n.z,t};a.divideComponents=function(e,n,t){return o.typeOf.object("left",e),o.typeOf.object("right",n),o.typeOf.object("result",t),t.x=e.x/n.x,t.y=e.y/n.y,t.z=e.z/n.z,t};a.add=function(e,n,t){return o.typeOf.object("left",e),o.typeOf.object("right",n),o.typeOf.object("result",t),t.x=e.x+n.x,t.y=e.y+n.y,t.z=e.z+n.z,t};a.subtract=function(e,n,t){return o.typeOf.object("left",e),o.typeOf.object("right",n),o.typeOf.object("result",t),t.x=e.x-n.x,t.y=e.y-n.y,t.z=e.z-n.z,t};a.multiplyByScalar=function(e,n,t){return o.typeOf.object("cartesian",e),o.typeOf.number("scalar",n),o.typeOf.object("result",t),t.x=e.x*n,t.y=e.y*n,t.z=e.z*n,t};a.divideByScalar=function(e,n,t){return o.typeOf.object("cartesian",e),o.typeOf.number("scalar",n),o.typeOf.object("result",t),t.x=e.x/n,t.y=e.y/n,t.z=e.z/n,t};a.negate=function(e,n){return o.typeOf.object("cartesian",e),o.typeOf.object("result",n),n.x=-e.x,n.y=-e.y,n.z=-e.z,n};a.abs=function(e,n){return o.typeOf.object("cartesian",e),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 F=new a;a.lerp=function(e,n,t,r){return o.typeOf.object("start",e),o.typeOf.object("end",n),o.typeOf.number("t",t),o.typeOf.object("result",r),a.multiplyByScalar(n,t,F),r=a.multiplyByScalar(e,1-t,r),a.add(F,r,r)};var N=new a,Y=new a;a.angleBetween=function(e,n){o.typeOf.object("left",e),o.typeOf.object("right",n),a.normalize(e,N),a.normalize(n,Y);var t=a.dot(N,Y),r=a.magnitude(a.cross(N,Y,N));return Math.atan2(r,t)};var Q=new a;a.mostOrthogonalAxis=function(e,n){o.typeOf.object("cartesian",e),o.typeOf.object("result",n);var t=a.normalize(e,Q);return a.abs(t,t),t.x<=t.y?t.x<=t.z?n=a.clone(a.UNIT_X,n):n=a.clone(a.UNIT_Z,n):t.y<=t.z?n=a.clone(a.UNIT_Y,n):n=a.clone(a.UNIT_Z,n),n};a.projectVector=function(e,n,t){o.defined("a",e),o.defined("b",n),o.defined("result",t);var r=a.dot(e,n)/a.dot(n,n);return a.multiplyByScalar(n,r,t)};a.equals=function(e,n){return e===n||f(e)&&f(n)&&e.x===n.x&&e.y===n.y&&e.z===n.z};a.equalsArray=function(e,n,t){return e.x===n[t]&&e.y===n[t+1]&&e.z===n[t+2]};a.equalsEpsilon=function(e,n,t,r){return e===n||f(e)&&f(n)&&c.equalsEpsilon(e.x,n.x,t,r)&&c.equalsEpsilon(e.y,n.y,t,r)&&c.equalsEpsilon(e.z,n.z,t,r)};a.cross=function(e,n,t){o.typeOf.object("left",e),o.typeOf.object("right",n),o.typeOf.object("result",t);var r=e.x,i=e.y,u=e.z,m=n.x,y=n.y,v=n.z,w=i*v-u*y,x=u*m-r*v,O=r*y-i*m;return t.x=w,t.y=x,t.z=O,t};a.midpoint=function(e,n,t){return o.typeOf.object("left",e),o.typeOf.object("right",n),o.typeOf.object("result",t),t.x=(e.x+n.x)*.5,t.y=(e.y+n.y)*.5,t.z=(e.z+n.z)*.5,t};a.fromDegrees=function(e,n,t,r,i){return o.typeOf.number("longitude",e),o.typeOf.number("latitude",n),e=c.toRadians(e),n=c.toRadians(n),a.fromRadians(e,n,t,r,i)};var z=new a,M=new a,W=new a(6378137*6378137,6378137*6378137,6356752314245179e-9*6356752314245179e-9),$=new a(6378137*6378137,6378137*6378137,6378137*6378137);a.fromRadians=function(e,n,t,r,i){o.typeOf.number("longitude",e),o.typeOf.number("latitude",n),t=h(t,0);var u=f(r)?r.radiiSquared:$;c.equalsEpsilon(c.Radius,6356752314245179e-9,c.EPSILON10)&&(u=f(r)?r.radiiSquared:W);var m=Math.cos(n);z.x=m*Math.cos(e),z.y=m*Math.sin(e),z.z=Math.sin(n),z=a.normalize(z,z),a.multiplyComponents(u,z,M);var y=Math.sqrt(a.dot(z,M));return M=a.divideByScalar(M,y,M),z=a.multiplyByScalar(z,t,z),f(i)||(i=new a),a.add(M,z,i)};a.fromDegreesArray=function(e,n,t){if(o.defined("coordinates",e),e.length<2||e.length%2!==0)throw new b("the number of coordinates must be a multiple of 2 and at least 2");var r=e.length;f(t)?t.length=r/2:t=new Array(r/2);for(var i=0;i<r;i+=2){var u=e[i],m=e[i+1],y=i/2;t[y]=a.fromDegrees(u,m,0,n,t[y])}return t};a.fromRadiansArray=function(e,n,t){if(o.defined("coordinates",e),e.length<2||e.length%2!==0)throw new b("the number of coordinates must be a multiple of 2 and at least 2");var r=e.length;f(t)?t.length=r/2:t=new Array(r/2);for(var i=0;i<r;i+=2){var u=e[i],m=e[i+1],y=i/2;t[y]=a.fromRadians(u,m,0,n,t[y])}return t};a.fromDegreesArrayHeights=function(e,n,t){if(o.defined("coordinates",e),e.length<3||e.length%3!==0)throw new b("the number of coordinates must be a multiple of 3 and at least 3");var r=e.length;f(t)?t.length=r/3:t=new Array(r/3);for(var i=0;i<r;i+=3){var u=e[i],m=e[i+1],y=e[i+2],v=i/3;t[v]=a.fromDegrees(u,m,y,n,t[v])}return t};a.fromRadiansArrayHeights=function(e,n,t){if(o.defined("coordinates",e),e.length<3||e.length%3!==0)throw new b("the number of coordinates must be a multiple of 3 and at least 3");var r=e.length;f(t)?t.length=r/3:t=new Array(r/3);for(var i=0;i<r;i+=3){var u=e[i],m=e[i+1],y=e[i+2],v=i/3;t[v]=a.fromRadians(u,m,y,n,t[v])}return t};a.ZERO=Object.freeze(new a(0,0,0));a.UNIT_X=Object.freeze(new a(1,0,0));a.UNIT_Y=Object.freeze(new a(0,1,0));a.UNIT_Z=Object.freeze(new a(0,0,1));a.UNIT_XYZ=Object.freeze(new a(1,1,1));a.prototype.clone=function(e){return a.clone(this,e)};a.prototype.equals=function(e){return a.equals(this,e)};a.prototype.equalsEpsilon=function(e,n,t){return a.equalsEpsilon(this,e,n,t)};a.prototype.toString=function(){return"("+this.x+", "+this.y+", "+this.z+")"};a.globalOffset=new a(0,0,0);var p=a;var s=new p,ee=new p;function ne(e,n,t,r,i){if(!f(e))throw new b("cartesian is required.");if(!f(n))throw new b("oneOverRadii is required.");if(!f(t))throw new b("oneOverRadiiSquared is required.");if(!f(r))throw new b("centerToleranceSquared is required.");var u=e.x,m=e.y,y=e.z,v=n.x,w=n.y,x=n.z,O=u*u*v*v,T=m*m*w*w,A=y*y*x*x,L=O+T+A,B=Math.sqrt(1/L),S=p.multiplyByScalar(e,B,s);if(L<r)return isFinite(B)?p.clone(S,i):void 0;var k=t.x,Z=t.y,D=t.z,R=ee;R.x=S.x*k*2,R.y=S.y*Z*2,R.z=S.z*D*2;var C=(1-B)*p.magnitude(e)/(.5*p.magnitude(R)),G=0,_,I,j,q,g,l,U,X,P,H,V;do{C-=G,j=1/(1+C*k),q=1/(1+C*Z),g=1/(1+C*D),l=j*j,U=q*q,X=g*g,P=l*j,H=U*q,V=X*g,_=O*l+T*U+A*X-1,I=O*P*k+T*H*Z+A*V*D;var J=-2*I;G=_/J}while(Math.abs(_)>c.EPSILON12);return f(i)?(i.x=u*j,i.y=m*q,i.z=y*g,i):new p(u*j,m*q,y*g)}var K=ne;function d(e,n,t){this.longitude=h(e,0),this.latitude=h(n,0),this.height=h(t,0)}d.fromRadians=function(e,n,t,r){return o.typeOf.number("longitude",e),o.typeOf.number("latitude",n),t=h(t,0),f(r)?(r.longitude=e,r.latitude=n,r.height=t,r):new d(e,n,t)};d.fromDegrees=function(e,n,t,r){return o.typeOf.number("longitude",e),o.typeOf.number("latitude",n),e=c.toRadians(e),n=c.toRadians(n),d.fromRadians(e,n,t,r)};var te=new p,ae=new p,oe=new p,re=new p(1/6378137,1/6378137,1/6356752314245179e-9),ie=new p(1/6378137,1/6378137,1/6378137),fe=new p(1/(6378137*6378137),1/(6378137*6378137),1/(6356752314245179e-9*6356752314245179e-9)),ye=new p(1/(6378137*6378137),1/(6378137*6378137),1/(6378137*6378137)),ue=c.EPSILON1;d.fromCartesian=function(e,n,t){var r=f(n)?n.oneOverRadii:ie,i=f(n)?n.oneOverRadiiSquared:ye,u=f(n)?n._centerToleranceSquared:ue;c.equalsEpsilon(c.Radius,6356752314245179e-9,c.EPSILON10)&&(r=f(n)?n.oneOverRadii:re,i=f(n)?n.oneOverRadiiSquared:fe);var m=K(e,r,i,u,ae);if(!!f(m)){var y=p.multiplyComponents(m,i,te);y=p.normalize(y,y);var v=p.subtract(e,m,oe),w=Math.atan2(y.y,y.x),x=Math.asin(y.z),O=c.sign(p.dot(v,e))*p.magnitude(v);return f(t)?(t.longitude=w,t.latitude=x,t.height=O,t):new d(w,x,O)}};d.toCartesian=function(e,n,t){return o.defined("cartographic",e),p.fromRadians(e.longitude,e.latitude,e.height,n,t)};d.sphericalDistance=function(e,n,t,r){if(o.defined("longitudeA",e),o.defined("longitudeB",t),o.defined("latitudeA",n),o.defined("latitudeB",r),e===t&&n===r)return 0;var i=c.toRadians(n),u=c.toRadians(r),m=c.toRadians(e),y=c.toRadians(t),v=m*m+i*i,w=y*y+u*u,x=(m-y)*(m-y)+(i-u)*(i-u),O=(v+w-x)/(2*Math.sqrt(v)*Math.sqrt(w));return O=c.clamp(O,-1,1),Math.acos(O)*c.Radius};d.clone=function(e,n){if(!!f(e))return f(n)?(n.longitude=e.longitude,n.latitude=e.latitude,n.height=e.height,n):new d(e.longitude,e.latitude,e.height)};d.equals=function(e,n){return e===n||f(e)&&f(n)&&e.longitude===n.longitude&&e.latitude===n.latitude&&e.height===n.height};d.equalsEpsilon=function(e,n,t){return o.typeOf.number("epsilon",t),e===n||f(e)&&f(n)&&Math.abs(e.longitude-n.longitude)<=t&&Math.abs(e.latitude-n.latitude)<=t&&Math.abs(e.height-n.height)<=t};d.ZERO=Object.freeze(new d(0,0,0));d.prototype.clone=function(e){return d.clone(this,e)};d.prototype.equals=function(e){return d.equals(this,e)};d.prototype.equalsEpsilon=function(e,n){return d.equalsEpsilon(this,e,n)};d.prototype.toString=function(){return"("+this.longitude+", "+this.latitude+", "+this.height+")"};var Ce=d;export{p as a,K as b,Ce as c};
|