UNPKG

@tindtechnologies/universalviewer

Version:

The Universal Viewer is a community-developed open source project on a mission to help you share your 📚📜📰📽️📻🗿 with the 🌎

2 lines (1 loc) 1.05 kB
var q=function(){function r(t,n){this.x=t,this.y=n}return r}(),w=function(r,t,n,i,a){var o=v(r.y,t.y,n.y,i.y,a);return M(r.x,t.x,n.x,i.x,o[0])},M=function(r,t,n,i,a){var o=3*t*Math.pow(a-1,2),e=-3*n*a+3*n+i*a,s=r*Math.pow(a-1,3);return a*(o+a*e)-s},v=function(r,t,n,i,a){r-=a,t-=a,n-=a,i-=a;var o=f(i-3*n+3*t-r,3*n-6*t+3*r,3*t-3*r,r);return o.filter(function(e){return e>=0&&e<=1})},c=function(r,t,n){var i=t*t-4*r*n;return i<0?[]:[(-t+Math.sqrt(i))/(2*r),(-t-Math.sqrt(i))/(2*r)]},f=function(r,t,n,i){if(r===0)return c(t,n,i);t/=r,n/=r,i/=r;var a=(3*n-t*t)/3,o=(2*t*t*t-9*t*n+27*i)/27;if(a===0)return[Math.pow(-o,1/3)];if(o===0)return[Math.sqrt(-a),-Math.sqrt(-a)];var e=Math.pow(o/2,2)+Math.pow(a/3,3);if(e===0)return[Math.pow(o/2,1/2)-t/3];if(e>0)return[Math.pow(-(o/2)+Math.sqrt(e),1/3)-Math.pow(o/2+Math.sqrt(e),1/3)-t/3];var s=Math.sqrt(Math.pow(-(a/3),3)),u=Math.acos(-(o/(2*Math.sqrt(Math.pow(-(a/3),3))))),h=2*Math.pow(s,1/3);return[h*Math.cos(u/3)-t/3,h*Math.cos((u+2*Math.PI)/3)-t/3,h*Math.cos((u+4*Math.PI)/3)-t/3]};export{q as a,w as b};