bimland/public/Cesium/Workers/IntersectionTests-7386ffbf.js

2 lines
13 KiB
JavaScript
Raw Permalink Normal View History

2023-07-26 17:04:38 +08:00
define(["exports","./Cartographic-3309dd0d","./when-b60132fc","./Check-7b2a090c","./buildModuleUrl-4e1b81e7","./Math-119be1a3","./PrimitiveType-a54dc62f"],(function(a,t,e,r,n,i,s){"use strict";var o={};function u(a,t,e){var r=a+t;return i.CesiumMath.sign(a)!==i.CesiumMath.sign(t)&&Math.abs(r/Math.max(Math.abs(a),Math.abs(t)))<e?0:r}o.computeDiscriminant=function(a,t,e){return t*t-4*a*e},o.computeRealRoots=function(a,t,e){var r;if(0===a)return 0===t?[]:[-e/t];if(0===t){if(0===e)return[0,0];var n=Math.abs(e),s=Math.abs(a);if(n<s&&n/s<i.CesiumMath.EPSILON14)return[0,0];if(n>s&&s/n<i.CesiumMath.EPSILON14)return[];if((r=-e/a)<0)return[];var o=Math.sqrt(r);return[-o,o]}if(0===e)return(r=-t/a)<0?[r,0]:[0,r];var C=u(t*t,-(4*a*e),i.CesiumMath.EPSILON14);if(C<0)return[];var c=-.5*u(t,i.CesiumMath.sign(t)*Math.sqrt(C),i.CesiumMath.EPSILON14);return t>0?[c/a,e/c]:[e/c,c/a]};var C={};function c(a,t,e,r){var n,i,s=a,o=t/3,u=e/3,C=r,c=s*u,l=o*C,h=o*o,M=u*u,f=s*u-h,m=s*C-o*u,d=o*C-M,v=4*f*d-m*m;if(v<0){var g,p,w;h*l>=c*M?(g=s,p=f,w=-2*o*f+s*m):(g=C,p=d,w=-C*m+2*u*d);var R=-(w<0?-1:1)*Math.abs(g)*Math.sqrt(-v),S=(i=-w+R)/2,O=S<0?-Math.pow(-S,1/3):Math.pow(S,1/3),x=i===R?-O:-p/O;return n=p<=0?O+x:-w/(O*O+x*x+p),h*l>=c*M?[(n-o)/s]:[-C/(n+u)]}var y=f,P=-2*o*f+s*m,b=d,N=-C*m+2*u*d,q=Math.sqrt(v),L=Math.sqrt(3)/2,I=Math.abs(Math.atan2(s*q,-P)/3);n=2*Math.sqrt(-y);var E=Math.cos(I);i=n*E;var z=n*(-E/2-L*Math.sin(I)),T=i+z>2*o?i-o:z-o,U=s,W=T/U;I=Math.abs(Math.atan2(C*q,-N)/3);var B=-C,V=(i=(n=2*Math.sqrt(-b))*(E=Math.cos(I)))+(z=n*(-E/2-L*Math.sin(I)))<2*u?i+u:z+u,Z=B/V,A=-T*V-U*B,D=(u*A-o*(T*B))/(-o*A+u*(U*V));return W<=D?W<=Z?D<=Z?[W,D,Z]:[W,Z,D]:[Z,W,D]:W<=Z?[D,W,Z]:D<=Z?[D,Z,W]:[Z,D,W]}C.computeDiscriminant=function(a,t,e,r){var n=t*t,i=e*e;return 18*a*t*e*r+n*i-27*(a*a)*(r*r)-4*(a*i*e+n*t*r)},C.computeRealRoots=function(a,t,e,r){var n,i;if(0===a)return o.computeRealRoots(t,e,r);if(0===t){if(0===e){if(0===r)return[0,0,0];var s=(i=-r/a)<0?-Math.pow(-i,1/3):Math.pow(i,1/3);return[s,s,s]}return 0===r?0===(n=o.computeRealRoots(a,0,e)).Length?[0]:[n[0],0,n[1]]:c(a,0,e,r)}return 0===e?0===r?(i=-t/a)<0?[i,0,0]:[0,0,i]:c(a,t,0,r):0===r?0===(n=o.computeRealRoots(a,t,e)).length?[0]:n[1]<=0?[n[0],n[1],0]:n[0]>=0?[0,n[0],n[1]]:[n[0],0,n[1]]:c(a,t,e,r)};var l={};function h(a,t,e,r){var n=a*a,s=t-3*n/8,u=e-t*a/2+n*a/8,c=r-e*a/4+t*n/16-3*n*n/256,l=C.computeRealRoots(1,2*s,s*s-4*c,-u*u);if(l.length>0){var h=-a/4,M=l[l.length-1];if(Math.abs(M)<i.CesiumMath.EPSILON14){var f=o.computeRealRoots(1,s,c);if(2===f.length){var m,d=f[0],v=f[1];if(d>=0&&v>=0){var g=Math.sqrt(d),p=Math.sqrt(v);return[h-p,h-g,h+g,h+p]}if(d>=0&&v<0)return[h-(m=Math.sqrt(d)),h+m];if(d<0&&v>=0)return[h-(m=Math.sqrt(v)),h+m]}return[]}if(M>0){var w=Math.sqrt(M),R=(s+M-u/w)/2,S=(s+M+u/w)/2,O=o.computeRealRoots(1,w,R),x=o.computeRealRoots(1,-w,S);return 0!==O.length?(O[0]+=h,O[1]+=h,0!==x.length?(x[0]+=h,x[1]+=h,O[1]<=x[0]?[O[0],O[1],x[0],x[1]]:x[1]<=O[0]?[x[0],x[1],O[0],O[1]]:O[0]>=x[0]&&O[1]<=x[1]?[x[0],O[0],O[1],x[1]]:x[0]>=O[0]&&x[1]<=O[1]?[O[0],x[0],x[1],O[1]]:O[0]>x[0]&&O[0]<x[1]?[x[0],O[0],x[1],O[1]]:[O[0],x[0],O[1],x[1]]):O):0!==x.length?(x[0]+=h,x[1]+=h,x):[]}}return[]}function M(a,t,e,r){var n=a*a,s=-2*t,u=e*a+t*t-4*r,c=n*r-e*t*a+e*e,l=C.computeRealRoots(1,s,u,c);if(l.length>0){var h,M,f,m,d,v,g=l[0],p=t-g,w=p*p,R=a/2,S=p/2,O=w-4*r,x=w+4*Math.abs(r),y=n-4*g,P=n+4*Math.abs(g);if(g<0||O*P<y*x){var b=Math.sqrt(y);h=b/2,M=0===b?0:(a*S-e)/b}else{var N=Math.sqrt(O);h=0===N?0:(a*S-e)/N,M=N/2}0===R&&0===h?(f=0,m=0):i.CesiumMath.sign(R)===i.CesiumMath.sign(h)?m=g/(f=R+h):f=g/(m=R-h),0===S&&0===M?(d=0,v=0):i.CesiumMath.sign(S)===i.CesiumMath.sign(M)?v=r/(d=S+M):d=r/(v=S-M);var q=o.computeRealRoots(1,f,d),L=o.computeRealRoots(1,m,v);if(0!==q.length)return 0!==L.length?q[1]<=L[0]?[q[0],q[1],L[0],L[1]]:L[1]<=q[0]?[L[0],L[1],q[0],q[1]]:q[0]>=L[0]&&q[1]<=L[1]?[L[0],q[0],q[1],L[1]]:L[0]>=q[0]&&L[1]<=q[1]?[q[0],L[0],L[1],q[1]]:q[0]>L[0]&&q[0]<L[1]?[L[0],q[0],L[1],q[1]]:[q[0],L[0],q[1],L[1]]:q;if(0!==L.length)return L}return[]}function f(a,r){r=t.Cartesian3.clone(e.defaultValue(r,t.Cartesian3.ZERO)