2 lines
14 KiB
JavaScript
2 lines
14 KiB
JavaScript
|
|
define(["exports","./Cartographic-1bbcab04","./when-515d5295","./Check-3aa71481","./buildModuleUrl-dba4ec07","./Math-5e38123d","./PrimitiveType-b38a4004"],(function(r,e,t,n,a,i,o){"use strict";var u={};function s(r,e,t){var n=r+e;return i.n.sign(r)!==i.n.sign(e)&&Math.abs(n/Math.max(Math.abs(r),Math.abs(e)))<t?0:n}u.computeDiscriminant=function(r,e,t){if("number"!=typeof r)throw new n.t("a is a required number.");if("number"!=typeof e)throw new n.t("b is a required number.");if("number"!=typeof t)throw new n.t("c is a required number.");return e*e-4*r*t},u.computeRealRoots=function(r,e,t){if("number"!=typeof r)throw new n.t("a is a required number.");if("number"!=typeof e)throw new n.t("b is a required number.");if("number"!=typeof t)throw new n.t("c is a required number.");var a;if(0===r)return 0===e?[]:[-t/e];if(0===e){if(0===t)return[0,0];var o=Math.abs(t),u=Math.abs(r);if(o<u&&o/u<i.n.EPSILON14)return[0,0];if(o>u&&u/o<i.n.EPSILON14)return[];if((a=-t/r)<0)return[];var f=Math.sqrt(a);return[-f,f]}if(0===t)return(a=-e/r)<0?[a,0]:[0,a];var c=s(e*e,-(4*r*t),i.n.EPSILON14);if(c<0)return[];var w=-.5*s(e,i.n.sign(e)*Math.sqrt(c),i.n.EPSILON14);return e>0?[w/r,t/w]:[t/w,w/r]};var f={};function c(r,e,t,n){var a,i,o=r,u=e/3,s=t/3,f=n,c=o*s,w=u*f,h=u*u,l=s*s,d=o*s-h,m=o*f-u*s,p=u*f-l,b=4*d*p-m*m;if(b<0){var g,v,q;h*w>=c*l?(g=o,v=d,q=-2*u*d+o*m):(g=f,v=p,q=-f*m+2*s*p);var M=-(q<0?-1:1)*Math.abs(g)*Math.sqrt(-b),y=(i=-q+M)/2,R=y<0?-Math.pow(-y,1/3):Math.pow(y,1/3),S=i===M?-R:-v/R;return a=v<=0?R+S:-q/(R*R+S*S+v),h*w>=c*l?[(a-u)/o]:[-f/(a+s)]}var O=d,P=-2*u*d+o*m,N=p,L=-f*m+2*s*p,E=Math.sqrt(b),I=Math.sqrt(3)/2,C=Math.abs(Math.atan2(o*E,-P)/3);a=2*Math.sqrt(-O);var x=Math.cos(C);i=a*x;var z=a*(-x/2-I*Math.sin(C)),T=i+z>2*u?i-u:z-u,U=o,W=T/U;C=Math.abs(Math.atan2(f*E,-L)/3);var B=-f,Z=(i=(a=2*Math.sqrt(-N))*(x=Math.cos(C)))+(z=a*(-x/2-I*Math.sin(C)))<2*s?i+s:z+s,V=B/Z,A=-T*Z-U*B,D=(s*A-u*(T*B))/(-u*A+s*(U*Z));return W<=D?W<=V?D<=V?[W,D,V]:[W,V,D]:[V,W,D]:W<=V?[D,W,V]:D<=V?[D,V,W]:[V,D,W]}f.computeDiscriminant=function(r,e,t,a){if("number"!=typeof r)throw new n.t("a is a required number.");if("number"!=typeof e)throw new n.t("b is a required number.");if("number"!=typeof t)throw new n.t("c is a required number.");if("number"!=typeof a)throw new n.t("d is a required number.");var i=e*e,o=t*t;return 18*r*e*t*a+i*o-27*(r*r)*(a*a)-4*(r*o*t+i*e*a)},f.computeRealRoots=function(r,e,t,a){if("number"!=typeof r)throw new n.t("a is a required number.");if("number"!=typeof e)throw new n.t("b is a required number.");if("number"!=typeof t)throw new n.t("c is a required number.");if("number"!=typeof a)throw new n.t("d is a required number.");var i,o;if(0===r)return u.computeRealRoots(e,t,a);if(0===e){if(0===t){if(0===a)return[0,0,0];var s=(o=-a/r)<0?-Math.pow(-o,1/3):Math.pow(o,1/3);return[s,s,s]}return 0===a?0===(i=u.computeRealRoots(r,0,t)).Length?[0]:[i[0],0,i[1]]:c(r,0,t,a)}return 0===t?0===a?(o=-e/r)<0?[o,0,0]:[0,0,o]:c(r,e,0,a):0===a?0===(i=u.computeRealRoots(r,e,t)).length?[0]:i[1]<=0?[i[0],i[1],0]:i[0]>=0?[0,i[0],i[1]]:[i[0],0,i[1]]:c(r,e,t,a)};var w={};function h(r,e,t,n){var a=r*r,o=e-3*a/8,s=t-e*r/2+a*r/8,c=n-t*r/4+e*a/16-3*a*a/256,w=f.computeRealRoots(1,2*o,o*o-4*c,-s*s);if(w.length>0){var h=-r/4,l=w[w.length-1];if(Math.abs(l)<i.n.EPSILON14){var d=u.computeRealRoots(1,o,c);if(2===d.length){var m,p=d[0],b=d[1];if(p>=0&&b>=0){var g=Math.sqrt(p),v=Math.sqrt(b);return[h-v,h-g,h+g,h+v]}if(p>=0&&b<0)return[h-(m=Math.sqrt(p)),h+m];if(p<0&&b>=0)return[h-(m=Math.sqrt(b)),h+m]}return[]}if(l>0){var q=Math.sqrt(l),M=(o+l-s/q)/2,y=(o+l+s/q)/2,R=u.computeRealRoots(1,q,M),S=u.computeRealRoots(1,-q,y);return 0!==R.length?(R[0]+=h,R[1]+=h,0!==S.length?(S[0]+=h,S[1]+=h,R[1]<=S[0]?[R[0],R[1],S[0],S[1]]:S[1]<=R[0]?[S[0],S[1],R[0],R[1]]:R[0]>=S[0]&&R[1]<=S[1]?[S[0],R[0],R[1],S[1]]:S[0]>=R[0]&&S[1]<=R[1]?[R[0],S[0],S[1],R[1]]:R[0]>S[0]&&R[0]<S[1]?[S[0],R[0],S[1],R[1]]:[R[0],S[0],R[1],S[1]]):R):0!==S.length?(S[0]+=h,S[1]+=h,S):[]}}return[]}function l(r,e,t,n){var a=r*r,o=-2*e,s=t*r+e*e-4*n,c=a*n-t*e*r+t*t,w=f.computeRealRoots(1,o,s,c);if(w.length>0){var h,l,
|