2 lines
16 KiB
JavaScript
2 lines
16 KiB
JavaScript
|
/* 2020-9-22 15:23:24 | 版权所有 军懋国兴 */
|
||
|
define(["exports","./when-cbf8cd21","./Check-35e1a91d","./Math-69007a69","./Cartesian2-43e3a3be","./Transforms-2d1ac5ec"],function(e,x,P,z,T,U){"use strict";var W={};function d(e,r,t){var a=e+r;return z.CesiumMath.sign(e)!==z.CesiumMath.sign(r)&&Math.abs(a/Math.max(Math.abs(e),Math.abs(r)))<t?0:a}W.computeDiscriminant=function(e,r,t){if("number"!=typeof e)throw new P.DeveloperError("a is a required number.");if("number"!=typeof r)throw new P.DeveloperError("b is a required number.");if("number"!=typeof t)throw new P.DeveloperError("c is a required number.");return r*r-4*e*t},W.computeRealRoots=function(e,r,t){if("number"!=typeof e)throw new P.DeveloperError("a is a required number.");if("number"!=typeof r)throw new P.DeveloperError("b is a required number.");if("number"!=typeof t)throw new P.DeveloperError("c is a required number.");var a;if(0===e)return 0===r?[]:[-t/r];if(0===r){if(0===t)return[0,0];var i=Math.abs(t),n=Math.abs(e);if(i<n&&i/n<z.CesiumMath.EPSILON14)return[0,0];if(n<i&&n/i<z.CesiumMath.EPSILON14)return[];if((a=-t/e)<0)return[];var o=Math.sqrt(a);return[-o,o]}if(0===t)return(a=-r/e)<0?[a,0]:[0,a];var s=d(r*r,-(4*e*t),z.CesiumMath.EPSILON14);if(s<0)return[];var u=-.5*d(r,z.CesiumMath.sign(r)*Math.sqrt(s),z.CesiumMath.EPSILON14);return 0<r?[u/e,t/u]:[t/u,u/e]};var O={};function s(e,r,t,a){var i=e,n=r/3,o=t/3,s=a,u=i*o,d=n*s,f=n*n,l=o*o,h=i*o-f,m=i*s-n*o,p=n*s-l,c=4*h*p-m*m;if(c<0){var C,w,v,M=u*l<=f*d?-2*n*(w=h)+(C=i)*m:-(C=s)*m+2*o*(w=p),b=-(M<0?-1:1)*Math.abs(C)*Math.sqrt(-c),g=(v=b-M)/2,q=g<0?-Math.pow(-g,1/3):Math.pow(g,1/3),E=v===b?-q:-w/q,y=w<=0?q+E:-M/(q*q+E*E+w);return u*l<=f*d?[(y-n)/i]:[-s/(y+o)]}var D=h,R=-2*n*h+i*m,S=p,O=-s*m+2*o*p,x=Math.sqrt(c),P=Math.sqrt(3)/2,N=Math.abs(Math.atan2(i*x,-R)/3);y=2*Math.sqrt(-D);var L=Math.cos(N);v=y*L;var I=y*(-L/2-P*Math.sin(N)),z=2*n<v+I?v-n:I-n,T=i,U=z/T,N=Math.abs(Math.atan2(s*x,-O)/3),W=-s,B=(v=(y=2*Math.sqrt(-S))*(L=Math.cos(N)))+(I=y*(-L/2-P*Math.sin(N)))<2*o?v+o:I+o,V=W/B,Z=-z*B-T*W,k=(o*Z-n*(z*W))/(-n*Z+o*(T*B));return U<=k?U<=V?k<=V?[U,k,V]:[U,V,k]:[V,U,k]:U<=V?[k,U,V]:k<=V?[k,V,U]:[V,k,U]}O.computeDiscriminant=function(e,r,t,a){if("number"!=typeof e)throw new P.DeveloperError("a is a required number.");if("number"!=typeof r)throw new P.DeveloperError("b is a required number.");if("number"!=typeof t)throw new P.DeveloperError("c is a required number.");if("number"!=typeof a)throw new P.DeveloperError("d is a required number.");var i=r*r,n=t*t;return 18*e*r*t*a+i*n-27*(e*e)*(a*a)-4*(e*n*t+i*r*a)},O.computeRealRoots=function(e,r,t,a){if("number"!=typeof e)throw new P.DeveloperError("a is a required number.");if("number"!=typeof r)throw new P.DeveloperError("b is a required number.");if("number"!=typeof t)throw new P.DeveloperError("c is a required number.");if("number"!=typeof a)throw new P.DeveloperError("d is a required number.");var i,n;if(0===e)return W.computeRealRoots(r,t,a);if(0!==r)return 0===t?0===a?(n=-r/e)<0?[n,0,0]:[0,0,n]:s(e,r,0,a):0===a?0===(i=W.computeRealRoots(e,r,t)).length?[0]:i[1]<=0?[i[0],i[1],0]:0<=i[0]?[0,i[0],i[1]]:[i[0],0,i[1]]:s(e,r,t,a);if(0!==t)return 0===a?0===(i=W.computeRealRoots(e,0,t)).Length?[0]:[i[0],0,i[1]]:s(e,0,t,a);if(0===a)return[0,0,0];var o=(n=-a/e)<0?-Math.pow(-n,1/3):Math.pow(n,1/3);return[o,o,o]};var B={};function f(e,r,t,a){var i=e*e,n=r-3*i/8,o=t-r*e/2+i*e/8,s=a-t*e/4+r*i/16-3*i*i/256,u=O.computeRealRoots(1,2*n,n*n-4*s,-o*o);if(0<u.length){var d=-e/4,f=u[u.length-1];if(Math.abs(f)<z.CesiumMath.EPSILON14){var l=W.computeRealRoots(1,n,s);if(2===l.length){var h,m=l[0],p=l[1];if(0<=m&&0<=p){var c=Math.sqrt(m),C=Math.sqrt(p);return[d-C,d-c,d+c,d+C]}if(0<=m&&p<0)return[d-(h=Math.sqrt(m)),d+h];if(m<0&&0<=p)return[d-(h=Math.sqrt(p)),d+h]}return[]}if(0<f){var w=Math.sqrt(f),v=(n+f-o/w)/2,M=(n+f+o/w)/2,b=W.computeRealRoots(1,w,v),g=W.computeRealRoots(1,-w,M);return 0!==b.length?(b[0]+=d,b[1]+=d,0!==g.length?(g[0]+=d,g[1]+=d,b[1]<=g[0]?[b[0],b[1],g[0],g[1]]:g[1]<=b[0]?[g[0],g[1],b[0],b[1]]:b[0]>=g[0]&&b[1]<=g[1]?[g[0],b[0],b[1],g[1]]:g[0]>=b[0]&&g[1]<=b[1]?[b[0],g[0],g[1],b[1]]:b[0]>g[0]&&b[0]<g[1]?[g[0],b[0],g[1],b
|