1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-11-18 14:21:49 -05:00
sdrangel/plugins/feature/map/Cesium/Workers/IntersectionTests-4cf437d5.js

2 lines
13 KiB
JavaScript
Raw Normal View History

2022-02-04 15:41:22 -05:00
define(["exports","./Matrix2-46444433","./when-229515d6","./RuntimeError-608565a6","./Transforms-ab7258fe","./ComponentDatatype-692a36d3"],(function(t,n,e,a,i,r){"use strict";const s={};function o(t,n,e){const a=t+n;return r.CesiumMath.sign(t)!==r.CesiumMath.sign(n)&&Math.abs(a/Math.max(Math.abs(t),Math.abs(n)))<e?0:a}s.computeDiscriminant=function(t,n,e){return n*n-4*t*e},s.computeRealRoots=function(t,n,e){let a;if(0===t)return 0===n?[]:[-e/n];if(0===n){if(0===e)return[0,0];const n=Math.abs(e),i=Math.abs(t);if(n<i&&n/i<r.CesiumMath.EPSILON14)return[0,0];if(n>i&&i/n<r.CesiumMath.EPSILON14)return[];if(a=-e/t,a<0)return[];const s=Math.sqrt(a);return[-s,s]}if(0===e)return a=-n/t,a<0?[a,0]:[0,a];const i=o(n*n,-(4*t*e),r.CesiumMath.EPSILON14);if(i<0)return[];const s=-.5*o(n,r.CesiumMath.sign(n)*Math.sqrt(i),r.CesiumMath.EPSILON14);return n>0?[s/t,e/s]:[e/s,s/t]};const c={};function u(t,n,e,a){const i=t,r=n/3,s=e/3,o=a,c=i*s,u=r*o,l=r*r,C=s*s,h=i*s-l,M=i*o-r*s,m=r*o-C,f=4*h*m-M*M;let d,g;if(f<0){let t,n,e;l*u>=c*C?(t=i,n=h,e=-2*r*h+i*M):(t=o,n=m,e=-o*M+2*s*m);const a=-(e<0?-1:1)*Math.abs(t)*Math.sqrt(-f);g=-e+a;const p=g/2,w=p<0?-Math.pow(-p,1/3):Math.pow(p,1/3),R=g===a?-w:-n/w;return d=n<=0?w+R:-e/(w*w+R*R+n),l*u>=c*C?[(d-r)/i]:[-o/(d+s)]}const p=h,w=-2*r*h+i*M,R=m,S=-o*M+2*s*m,O=Math.sqrt(f),x=Math.sqrt(3)/2;let y=Math.abs(Math.atan2(i*O,-w)/3);d=2*Math.sqrt(-p);let P=Math.cos(y);g=d*P;let N=d*(-P/2-x*Math.sin(y));const b=g+N>2*r?g-r:N-r,q=i,L=b/q;y=Math.abs(Math.atan2(o*O,-S)/3),d=2*Math.sqrt(-R),P=Math.cos(y),g=d*P,N=d*(-P/2-x*Math.sin(y));const I=-o,E=g+N<2*s?g+s:N+s,z=I/E,T=-b*E-q*I,v=(s*T-r*(b*I))/(-r*T+s*(q*E));return L<=v?L<=z?v<=z?[L,v,z]:[L,z,v]:[z,L,v]:L<=z?[v,L,z]:v<=z?[v,z,L]:[z,v,L]}c.computeDiscriminant=function(t,n,e,a){const i=n*n,r=e*e;return 18*t*n*e*a+i*r-27*(t*t)*(a*a)-4*(t*r*e+i*n*a)},c.computeRealRoots=function(t,n,e,a){let i,r;if(0===t)return s.computeRealRoots(n,e,a);if(0===n){if(0===e){if(0===a)return[0,0,0];r=-a/t;const n=r<0?-Math.pow(-r,1/3):Math.pow(r,1/3);return[n,n,n]}return 0===a?(i=s.computeRealRoots(t,0,e),0===i.Length?[0]:[i[0],0,i[1]]):u(t,0,e,a)}return 0===e?0===a?(r=-n/t,r<0?[r,0,0]:[0,0,r]):u(t,n,0,a):0===a?(i=s.computeRealRoots(t,n,e),0===i.length?[0]:i[1]<=0?[i[0],i[1],0]:i[0]>=0?[0,i[0],i[1]]:[i[0],0,i[1]]):u(t,n,e,a)};const l={};function C(t,n,e,a){const i=t*t,o=n-3*i/8,u=e-n*t/2+i*t/8,l=a-e*t/4+n*i/16-3*i*i/256,C=c.computeRealRoots(1,2*o,o*o-4*l,-u*u);if(C.length>0){const n=-t/4,e=C[C.length-1];if(Math.abs(e)<r.CesiumMath.EPSILON14){const t=s.computeRealRoots(1,o,l);if(2===t.length){const e=t[0],a=t[1];let i;if(e>=0&&a>=0){const t=Math.sqrt(e),i=Math.sqrt(a);return[n-i,n-t,n+t,n+i]}if(e>=0&&a<0)return i=Math.sqrt(e),[n-i,n+i];if(e<0&&a>=0)return i=Math.sqrt(a),[n-i,n+i]}return[]}if(e>0){const t=Math.sqrt(e),a=(o+e-u/t)/2,i=(o+e+u/t)/2,r=s.computeRealRoots(1,t,a),c=s.computeRealRoots(1,-t,i);return 0!==r.length?(r[0]+=n,r[1]+=n,0!==c.length?(c[0]+=n,c[1]+=n,r[1]<=c[0]?[r[0],r[1],c[0],c[1]]:c[1]<=r[0]?[c[0],c[1],r[0],r[1]]:r[0]>=c[0]&&r[1]<=c[1]?[c[0],r[0],r[1],c[1]]:c[0]>=r[0]&&c[1]<=r[1]?[r[0],c[0],c[1],r[1]]:r[0]>c[0]&&r[0]<c[1]?[c[0],r[0],c[1],r[1]]:[r[0],c[0],r[1],c[1]]):r):0!==c.length?(c[0]+=n,c[1]+=n,c):[]}}return[]}function h(t,n,e,a){const i=t*t,o=-2*n,u=e*t+n*n-4*a,l=i*a-e*n*t+e*e,C=c.computeRealRoots(1,o,u,l);if(C.length>0){const o=C[0],c=n-o,u=c*c,l=t/2,h=c/2,M=u-4*a,m=u+4*Math.abs(a),f=i-4*o,d=i+4*Math.abs(o);let g,p,w,R,S,O;if(o<0||M*d<f*m){const n=Math.sqrt(f);g=n/2,p=0===n?0:(t*h-e)/n}else{const n=Math.sqrt(M);g=0===n?0:(t*h-e)/n,p=n/2}0===l&&0===g?(w=0,R=0):r.CesiumMath.sign(l)===r.CesiumMath.sign(g)?(w=l+g,R=o/w):(R=l-g,w=o/R),0===h&&0===p?(S=0,O=0):r.CesiumMath.sign(h)===r.CesiumMath.sign(p)?(S=h+p,O=a/S):(O=h-p,S=a/O);const x=s.computeRealRoots(1,w,S),y=s.computeRealRoots(1,R,O);if(0!==x.length)return 0!==y.length?x[1]<=y[0]?[x[0],x[1],y[0],y[1]]:y[1]<=x[0]?[y[0],y[1],x[0],x[1]]:x[0]>=y[0]&&x[1]<=y[1]?[y[0],x[0],x[1],y[1]]:y[0]>=x[0]&&y[1]<=x[1]?[x[0],y[0],y[1],x[1]]:x[0]>y[0]&&x[0]<y[1]?[y[0],x[0],y[1],x[1]]:[x[0],y[0],x[1],y[1]]:x;if(0!==y.length)return y}retu