@thi.ng/math
Advanced tools
Comparing version 1.7.8 to 1.7.9
@@ -6,2 +6,10 @@ # Change Log | ||
## [1.7.9](https://github.com/thi-ng/umbrella/compare/@thi.ng/math@1.7.8...@thi.ng/math@1.7.9) (2020-05-03) | ||
**Note:** Version bump only for package @thi.ng/math | ||
## [1.7.8](https://github.com/thi-ng/umbrella/compare/@thi.ng/math@1.7.7...@thi.ng/math@1.7.8) (2020-04-28) | ||
@@ -8,0 +16,0 @@ |
@@ -1,1 +0,1 @@ | ||
!function(t,i){"object"==typeof exports&&"undefined"!=typeof module?i(exports):"function"==typeof define&&define.amd?define(["exports"],i):i(((t=t||self).thi=t.thi||{},t.thi.ng=t.thi.ng||{},t.thi.ng.math={}))}(this,(function(t){"use strict";const i=Math.PI,a=2*i,n=i/2,s=i/3,r=i/4,e=i/6,o=1/i,h=1/a,u=1/n,c=i/180,M=180/i,d=(1+Math.sqrt(5))/2,f=Math.SQRT2,l=Math.sqrt(3),m=f/2,p=l/2;var b;(b=t.Crossing||(t.Crossing={}))[b.EQUAL=0]="EQUAL",b[b.FLAT=1]="FLAT",b[b.UNDER=2]="UNDER",b[b.OVER=3]="OVER",b[b.OTHER=4]="OTHER";const x=t=>(t%=a)<0?a+t:t,g=t=>(t=Math.abs(t))>i?a-t:t,R=t=>{const i=t*t;return.99940307+i*(.03679168*i-.49558072)},I=t=>{switch((t%=a)<0&&(t=-t),t*u|0){case 0:return R(t);case 1:return-R(i-t);case 2:return-R(t-i);default:return R(a-t)}},T=Math.abs,E=Math.max,C=(t,i,a=1e-6)=>T(t-i)<=a*E(1,T(t),T(i)),D=(t,i,a,n)=>t<a&&i>n,v=(t,i,a,n)=>t>a&&i<n,A=(t,i,a)=>t>i&&i<a,H=(t,i,a)=>t<i&&i>a,P=(t,i,a=0,n=i.length)=>{n--;for(let s=a+1;s<n;s++)if(t(i[s-1],i[s],i[s+1]))return s;return-1},_=(t,i=0,a=t.length)=>P(A,t,i,a);function*q(t,i,a=0,n=i.length){for(;a<n;){const s=t(i,a,n);if(s<0)return;yield s,a=s+1}}const w=t=>t<0?0:t>1?1:t,S=t=>t<-1?-1:t>1?1:t,O=(t,i)=>0!==t?0!==i?Math.min(t,i):t:i,Q=(t,i,a)=>U(t,i,-a),U=(t,i,a)=>{const n=Math.exp(t*a),s=Math.exp(i*a);return(t*n+i*s)/(n+s)},L=(t,i,a)=>a!==i?(t-i)/(a-i):0,N=255,y=65535,F=t=>128&(t&=N)?t|~N:t,V=t=>32768&(t&=y)?t|~y:t,j=(t,i,a,n=16,s=8,r=0,e=1,o=1e-6)=>{if(s<=0)return(r+e)/2;const h=(e-r)/n;let u=r,c=1/0;for(let s=0;s<=n;s++){const n=r+s*h,e=i(a,t(n));if(e<c){if(e<=o)return n;c=e,u=n}}return j(t,i,a,n,s-1,Math.max(u-h,0),Math.min(u+h,1))},G=(t,i,a)=>t+(i-t)*a,X=t=>t-Math.floor(t);t.DEG2RAD=c,t.EPS=1e-6,t.HALF_PI=n,t.INV_HALF_PI=u,t.INV_PI=o,t.INV_TAU=h,t.PHI=d,t.PI=i,t.QUARTER_PI=r,t.RAD2DEG=M,t.SIXTH=1/6,t.SIXTH_PI=e,t.SQRT2=f,t.SQRT2_2=m,t.SQRT2_3=p,t.SQRT3=l,t.TAU=a,t.THIRD=1/3,t.THIRD_PI=s,t.TWO_THIRD=2/3,t.absDiff=(t,i)=>Math.abs(t-i),t.absInnerAngle=g,t.absMax=(t,i)=>Math.abs(t)>Math.abs(i)?t:i,t.absMin=(t,i)=>Math.abs(t)<Math.abs(i)?t:i,t.absTheta=x,t.addi16=(t,i)=>V((0|t)+(0|i)),t.addi32=(t,i)=>(0|t)+(0|i)|0,t.addi8=(t,i)=>F((0|t)+(0|i)),t.addu16=(t,i)=>(t&y)+(i&y)&y,t.addu32=(t,i)=>(t>>>0)+(i>>>0)>>>0,t.addu8=(t,i)=>(t&N)+(i&N)&N,t.andi16=(t,i)=>V((0|t)&(0|i)),t.andi32=(t,i)=>(0|t)&(0|i),t.andi8=(t,i)=>F((0|t)&(0|i)),t.andu16=(t,i)=>t&y&i&y&y,t.andu32=(t,i)=>(t>>>0&i>>>0)>>>0,t.andu8=(t,i)=>t&N&i&N&N,t.angleDist=(t,i)=>g(x(i%a-t%a)),t.atan2Abs=(t,i)=>x(Math.atan2(t,i)),t.bounce=(t,i,a)=>{const s=a*t;return 1-i*Math.sin(s)/s*Math.cos(a*n)},t.circular=t=>(t=1-t,Math.sqrt(1-t*t)),t.clamp=(t,i,a)=>t<i?i:t>a?a:t,t.clamp01=w,t.clamp05=t=>t<0?0:t>.5?.5:t,t.clamp11=S,t.classifyCrossing=(i,a,n,s,r=1e-6)=>D(i,a,n,s)?t.Crossing.OVER:v(i,a,n,s)?t.Crossing.UNDER:C(i,n,r)&&C(a,s,r)?C(i,s,r)?t.Crossing.FLAT:t.Crossing.EQUAL:t.Crossing.OTHER,t.cosine=t=>1-(.5*Math.cos(t*i)+.5),t.cossin=(t,i=1)=>[Math.cos(t)*i,Math.sin(t)*i],t.cot=t=>1/Math.tan(t),t.csc=t=>1/Math.sin(t),t.cubicPulse=(t,i,a)=>(a=Math.abs(a-i))>t?0:1-(a/=t)*a*(3-2*a),t.decimated=(t,i)=>Math.floor(i*t)/t,t.deg=t=>t*M,t.derivative=(t,i=1e-6)=>a=>(t(a+i)-t(a))/i,t.divi16=(t,i)=>V((0|t)/(0|i)),t.divi32=(t,i)=>(0|t)/(0|i)|0,t.divi8=(t,i)=>F((0|t)/(0|i)),t.divu16=(t,i)=>(t&y)/(i&y)&y,t.divu32=(t,i)=>(t>>>0)/(i>>>0)>>>0,t.divu8=(t,i)=>(t&N)/(i&N)&N,t.ease=(t,i)=>Math.pow(i,t),t.eqDelta=C,t.eqDeltaFixed=(t,i,a=1e-6)=>T(t-i)<=a,t.expFactor=(t,i,a)=>Math.pow(i/t,1/a),t.expStep=(t,i,a)=>1-Math.exp(-t*Math.pow(a,i)),t.fastCos=I,t.fastSin=t=>I(n-t),t.fit=(t,i,a,n,s)=>n+(s-n)*L(t,i,a),t.fit01=(t,i,a)=>i+(a-i)*w(t),t.fit10=(t,i,a)=>a+(i-a)*w(t),t.fit11=(t,i,a)=>i+(a-i)*(.5+.5*S(t)),t.fitClamped=(t,i,a,n,s)=>n+(s-n)*w(L(t,i,a)),t.fmod=(t,i)=>t-i*Math.floor(t/i),t.foldback=(t,i)=>i<-t||i>t?Math.abs(Math.abs((i-t)%(4*t))-2*t)-t:i,t.fract=X,t.gain=(t,i)=>i<.5?.5*Math.pow(2*i,t):1-.5*Math.pow(2-2*i,t),t.impulse=(t,i)=>{const a=t*i;return a*Math.exp(1-a)},t.inOpenRange=(t,i,a)=>t>i&&t<a,t.inRange=(t,i,a)=>t>=i&&t<=a,t.isCrossOver=D,t.isCrossUnder=v,t.isMaxima=H,t.isMinima=A,t.loc=(t,i,a)=>Math.sqrt(t*t+i*i-2*t*i*Math.cos(a)),t.lshifti16=(t,i)=>V((0|t)<<(0|i)),t.lshifti32=(t,i)=>(0|t)<<(0|i),t.lshifti8=(t,i)=>F((0|t)<<(0|i)),t.lshiftu16=(t,i)=>(t&y)<<(i&y)&y,t.lshiftu32=(t,i)=>t>>>0<<(i>>>0)>>>0,t.lshiftu8=(t,i)=>(t&N)<<(i&N)&N,t.max2id=(t,i)=>t>=i?0:1,t.max3id=(t,i,a)=>t>=i?t>=a?0:2:i>=a?1:2,t.max4id=(t,i,a,n)=>t>=i?t>=a?t>=n?0:3:a>=n?2:3:i>=a?i>=n?1:3:a>=n?2:3,t.maximaIndex=(t,i=0,a=t.length)=>P(H,t,i,a),t.maximaIndices=(t,i=0,a=t.length)=>q(_,t,i,a),t.min2id=(t,i)=>t<=i?0:1,t.min3id=(t,i,a)=>t<=i?t<=a?0:2:i<=a?1:2,t.min4id=(t,i,a,n)=>t<=i?t<=a?t<=n?0:3:a<=n?2:3:i<=a?i<=n?1:3:a<=n?2:3,t.minError=j,t.minNonZero2=O,t.minNonZero3=(t,i,a)=>O(O(t,i),a),t.minimaIndex=_,t.minimaIndices=(t,i=0,a=t.length)=>q(_,t,i,a),t.mix=G,t.mixBilinear=(t,i,a,n,s,r)=>G(G(t,i,s),G(a,n,s),r),t.mixCubic=(t,i,a,n,s)=>{const r=s*s,e=1-s,o=e*e;return t*o*e+3*i*o*s+3*a*r*e+n*r*s},t.mixCubicHermite=(t,i,a,n,s)=>{const r=s-1,e=s*s,o=r*r;return(1+2*s)*o*t+s*o*i+e*(3-2*s)*a+e*r*n},t.mixHermite=(t,i,a,n,s)=>{const r=.5*(a-t),e=1.5*(i-a)+.5*(n-t);return((e*s+t-i+r-e)*s+r)*s+i},t.mixQuadratic=(t,i,a,n)=>{const s=1-n;return t*s*s+2*i*s*n+a*n*n},t.muli16=(t,i)=>V((0|t)*(0|i)),t.muli32=(t,i)=>(0|t)*(0|i)|0,t.muli8=(t,i)=>F((0|t)*(0|i)),t.mulu16=(t,i)=>(t&y)*(i&y)&y,t.mulu32=(t,i)=>(t>>>0)*(i>>>0)>>>0,t.mulu8=(t,i)=>(t&N)*(i&N)&N,t.norm=L,t.normCos=t=>{const i=t*t;return 1+i*(2*i-4)},t.noti16=t=>V(~t),t.noti32=t=>~t,t.noti8=t=>F(~t),t.notu16=t=>~t&y,t.notu32=t=>~t>>>0,t.notu8=t=>~t&N,t.ori16=(t,i)=>V(0|t|i),t.ori32=(t,i)=>0|t|i,t.ori8=(t,i)=>F(0|t|i),t.oru16=(t,i)=>(t&y|i&y)&y,t.oru32=(t,i)=>(t>>>0|i>>>0)>>>0,t.oru8=(t,i)=>(t&N|i&N)&N,t.parabola=(t,i)=>Math.pow(4*i*(1-i),t),t.quadrant=t=>x(t)*u|0,t.rad=t=>t*c,t.roundEps=(t,i=1e-6)=>{const a=X(t);return a<=i||a>=1-i?Math.round(t):t},t.roundTo=(t,i=1)=>Math.round(t/i)*i,t.rshifti16=(t,i)=>V((0|t)>>(0|i)),t.rshifti32=(t,i)=>(0|t)>>(0|i),t.rshifti8=(t,i)=>F((0|t)>>(0|i)),t.rshiftu16=(t,i)=>(t&y)>>>(i&y)&y,t.rshiftu32=(t,i)=>t>>>0>>>(i>>>0)>>>0,t.rshiftu8=(t,i)=>(t&N)>>>(i&N)&N,t.safeDiv=(t,i)=>0!==i?t/i:0,t.sclamp=(t,i,a,n)=>Q(U(t,i,n),a,n),t.sec=t=>1/Math.cos(t),t.sigmoid=(t,i)=>1/(1+Math.exp(-t*(2*i-1))),t.sigmoid11=(t,i)=>1/(1+Math.exp(-t*i)),t.sign=(t,i=1e-6)=>t>i?1:t<-i?-1:0,t.signExtend16=V,t.signExtend8=F,t.simplifyRatio=(t,i)=>{let a=Math.abs(t),n=Math.abs(i);for(;;){if(a<n){const t=a;a=n,n=t}const s=a%n;if(!s)return[t/n,i/n];a=s}},t.sinc=(t,a)=>(a=i*(t*a-1),Math.sin(a)/a),t.sincos=(t,i=1)=>[Math.sin(t)*i,Math.cos(t)*i],t.smax=U,t.smin=Q,t.smoothStep=(t,i,a)=>(3-2*(a=w((a-t)/(i-t))))*a*a,t.smootherStep=(t,i,a)=>(a=w((a-t)/(i-t)))*a*a*(a*(6*a-15)+10),t.solveCubic=(t,i,a,n,s=1e-9)=>{const r=t*t,e=i*i,o=i/(3*t),h=(3*t*a-e)/(3*r),u=(2*e*i-9*t*i*a+27*r*n)/(27*r*t);if(Math.abs(h)<s)return[Math.cbrt(-u)-o];if(Math.abs(u)<s)return h<0?[-Math.sqrt(-h)-o,-o,Math.sqrt(-h)-o]:[-o];{const t=u*u/4+h*h*h/27;if(Math.abs(t)<s)return[-1.5*u/h-o,3*u/h-o];if(t>0){const i=Math.cbrt(-u/2-Math.sqrt(t));return[i-h/(3*i)-o]}{const t=2*Math.sqrt(-h/3),i=Math.acos(3*u/h/t)/3,a=2*Math.PI/3;return[t*Math.cos(i)-o,t*Math.cos(i-a)-o,t*Math.cos(i-2*a)-o]}}},t.solveLinear=(t,i)=>-i/t,t.solveQuadratic=(t,i,a,n=1e-9)=>{const s=2*t;let r=i*i-4*t*a;return r<0?[]:r<n?[-i/s]:(r=Math.sqrt(r),[(-i-r)/s,(-i+r)/s])},t.step=(t,i)=>i<t?0:1,t.subi16=(t,i)=>V((0|t)-(0|i)),t.subi32=(t,i)=>(0|t)-(0|i)|0,t.subi8=(t,i)=>F((0|t)-(0|i)),t.subu16=(t,i)=>(t&y)-(i&y)&y,t.subu32=(t,i)=>(t>>>0)-(i>>>0)>>>0,t.subu8=(t,i)=>(t&N)-(i&N)&N,t.tangentCardinal=(t,i,a=.5,n=0,s=2)=>a*((i-t)/(s-n)),t.tangentDiff3=(t,i,a,n=0,s=1,r=2)=>.5*((a-i)/(r-s)+(i-t)/(s-n)),t.trunc=t=>t<0?Math.ceil(t):Math.floor(t),t.tween=(t,i,a)=>n=>G(i,a,t(n)),t.wrap=(t,i,a)=>{if(i===a)return i;if(t>a){const n=a-i;(t-=n)>a&&(t-=n*((t-i)/n|0))}else if(t<i){const n=a-i;(t+=n)<i&&(t+=n*((i-t)/n+1|0))}return t},t.wrap01=t=>t<0?t+1:t>1?t-1:t,t.wrap11=t=>t<-1?t+2:t>1?t-2:t,t.wrapOnce=(t,i,a)=>t<i?t-i+a:t>a?t-a+i:t,t.xori16=(t,i)=>V((0|t)^(0|i)),t.xori32=(t,i)=>(0|t)^(0|i),t.xori8=(t,i)=>F((0|t)^(0|i)),t.xoru16=(t,i)=>(t&y^i&y)&y,t.xoru32=(t,i)=>(t>>>0^i>>>0)>>>0,t.xoru8=(t,i)=>(t&N^i&N)&N,Object.defineProperty(t,"__esModule",{value:!0})})); | ||
!function(t,i){"object"==typeof exports&&"undefined"!=typeof module?i(exports):"function"==typeof define&&define.amd?define(["exports"],i):i(((t=t||self).thi=t.thi||{},t.thi.ng=t.thi.ng||{},t.thi.ng.math={}))}(this,(function(t){"use strict";const i=Math.PI,a=2*i,n=i/2,s=i/3,r=i/4,e=i/6,o=1/i,h=1/a,u=1/n,c=i/180,M=180/i,d=(1+Math.sqrt(5))/2,f=Math.SQRT2,l=Math.sqrt(3),m=f/2,p=l/2;let b=1e-6;var x;(x=t.Crossing||(t.Crossing={}))[x.EQUAL=0]="EQUAL",x[x.FLAT=1]="FLAT",x[x.UNDER=2]="UNDER",x[x.OVER=3]="OVER",x[x.OTHER=4]="OTHER";const g=t=>(t%=a)<0?a+t:t,R=t=>(t=Math.abs(t))>i?a-t:t,I=t=>{const i=t*t;return.99940307+i*(.03679168*i-.49558072)},T=t=>{switch((t%=a)<0&&(t=-t),t*u|0){case 0:return I(t);case 1:return-I(i-t);case 2:return-I(t-i);default:return I(a-t)}},E=Math.abs,C=Math.max,D=(t,i,a=b)=>E(t-i)<=a*C(1,E(t),E(i)),v=(t,i,a,n)=>t<a&&i>n,A=(t,i,a,n)=>t>a&&i<n,H=(t,i,a)=>t>i&&i<a,P=(t,i,a)=>t<i&&i>a,_=(t,i,a=0,n=i.length)=>{n--;for(let s=a+1;s<n;s++)if(t(i[s-1],i[s],i[s+1]))return s;return-1},q=(t,i=0,a=t.length)=>_(H,t,i,a);function*w(t,i,a=0,n=i.length){for(;a<n;){const s=t(i,a,n);if(s<0)return;yield s,a=s+1}}const S=t=>t<0?0:t>1?1:t,O=t=>t<-1?-1:t>1?1:t,Q=(t,i)=>0!==t?0!==i?Math.min(t,i):t:i,U=(t,i,a)=>L(t,i,-a),L=(t,i,a)=>{const n=Math.exp(t*a),s=Math.exp(i*a);return(t*n+i*s)/(n+s)},N=(t,i,a)=>a!==i?(t-i)/(a-i):0,y=255,F=65535,V=t=>128&(t&=y)?t|~y:t,j=t=>32768&(t&=F)?t|~F:t,G=(t,i,a,n=16,s=8,r=0,e=1,o=b)=>{if(s<=0)return(r+e)/2;const h=(e-r)/n;let u=r,c=1/0;for(let s=0;s<=n;s++){const n=r+s*h,e=i(a,t(n));if(e<c){if(e<=o)return n;c=e,u=n}}return G(t,i,a,n,s-1,Math.max(u-h,0),Math.min(u+h,1))},X=(t,i,a)=>t+(i-t)*a,Z=t=>t-Math.floor(t);t.DEG2RAD=c,t.EPS=b,t.HALF_PI=n,t.INV_HALF_PI=u,t.INV_PI=o,t.INV_TAU=h,t.PHI=d,t.PI=i,t.QUARTER_PI=r,t.RAD2DEG=M,t.SIXTH=1/6,t.SIXTH_PI=e,t.SQRT2=f,t.SQRT2_2=m,t.SQRT2_3=p,t.SQRT3=l,t.TAU=a,t.THIRD=1/3,t.THIRD_PI=s,t.TWO_THIRD=2/3,t.absDiff=(t,i)=>Math.abs(t-i),t.absInnerAngle=R,t.absMax=(t,i)=>Math.abs(t)>Math.abs(i)?t:i,t.absMin=(t,i)=>Math.abs(t)<Math.abs(i)?t:i,t.absTheta=g,t.addi16=(t,i)=>j((0|t)+(0|i)),t.addi32=(t,i)=>(0|t)+(0|i)|0,t.addi8=(t,i)=>V((0|t)+(0|i)),t.addu16=(t,i)=>(t&F)+(i&F)&F,t.addu32=(t,i)=>(t>>>0)+(i>>>0)>>>0,t.addu8=(t,i)=>(t&y)+(i&y)&y,t.andi16=(t,i)=>j((0|t)&(0|i)),t.andi32=(t,i)=>(0|t)&(0|i),t.andi8=(t,i)=>V((0|t)&(0|i)),t.andu16=(t,i)=>t&F&i&F&F,t.andu32=(t,i)=>(t>>>0&i>>>0)>>>0,t.andu8=(t,i)=>t&y&i&y&y,t.angleDist=(t,i)=>R(g(i%a-t%a)),t.atan2Abs=(t,i)=>g(Math.atan2(t,i)),t.bounce=(t,i,a)=>{const s=a*t;return 1-i*Math.sin(s)/s*Math.cos(a*n)},t.circular=t=>(t=1-t,Math.sqrt(1-t*t)),t.clamp=(t,i,a)=>t<i?i:t>a?a:t,t.clamp01=S,t.clamp05=t=>t<0?0:t>.5?.5:t,t.clamp11=O,t.classifyCrossing=(i,a,n,s,r=b)=>v(i,a,n,s)?t.Crossing.OVER:A(i,a,n,s)?t.Crossing.UNDER:D(i,n,r)&&D(a,s,r)?D(i,s,r)?t.Crossing.FLAT:t.Crossing.EQUAL:t.Crossing.OTHER,t.cosine=t=>1-(.5*Math.cos(t*i)+.5),t.cossin=(t,i=1)=>[Math.cos(t)*i,Math.sin(t)*i],t.cot=t=>1/Math.tan(t),t.csc=t=>1/Math.sin(t),t.cubicPulse=(t,i,a)=>(a=Math.abs(a-i))>t?0:1-(a/=t)*a*(3-2*a),t.decimated=(t,i)=>Math.floor(i*t)/t,t.deg=t=>t*M,t.derivative=(t,i=b)=>a=>(t(a+i)-t(a))/i,t.divi16=(t,i)=>j((0|t)/(0|i)),t.divi32=(t,i)=>(0|t)/(0|i)|0,t.divi8=(t,i)=>V((0|t)/(0|i)),t.divu16=(t,i)=>(t&F)/(i&F)&F,t.divu32=(t,i)=>(t>>>0)/(i>>>0)>>>0,t.divu8=(t,i)=>(t&y)/(i&y)&y,t.ease=(t,i)=>Math.pow(i,t),t.eqDelta=D,t.eqDeltaFixed=(t,i,a=b)=>E(t-i)<=a,t.expFactor=(t,i,a)=>Math.pow(i/t,1/a),t.expStep=(t,i,a)=>1-Math.exp(-t*Math.pow(a,i)),t.fastCos=T,t.fastSin=t=>T(n-t),t.fit=(t,i,a,n,s)=>n+(s-n)*N(t,i,a),t.fit01=(t,i,a)=>i+(a-i)*S(t),t.fit10=(t,i,a)=>a+(i-a)*S(t),t.fit11=(t,i,a)=>i+(a-i)*(.5+.5*O(t)),t.fitClamped=(t,i,a,n,s)=>n+(s-n)*S(N(t,i,a)),t.fmod=(t,i)=>t-i*Math.floor(t/i),t.foldback=(t,i)=>i<-t||i>t?Math.abs(Math.abs((i-t)%(4*t))-2*t)-t:i,t.fract=Z,t.gain=(t,i)=>i<.5?.5*Math.pow(2*i,t):1-.5*Math.pow(2-2*i,t),t.impulse=(t,i)=>{const a=t*i;return a*Math.exp(1-a)},t.inOpenRange=(t,i,a)=>t>i&&t<a,t.inRange=(t,i,a)=>t>=i&&t<=a,t.isCrossOver=v,t.isCrossUnder=A,t.isMaxima=P,t.isMinima=H,t.loc=(t,i,a)=>Math.sqrt(t*t+i*i-2*t*i*Math.cos(a)),t.lshifti16=(t,i)=>j((0|t)<<(0|i)),t.lshifti32=(t,i)=>(0|t)<<(0|i),t.lshifti8=(t,i)=>V((0|t)<<(0|i)),t.lshiftu16=(t,i)=>(t&F)<<(i&F)&F,t.lshiftu32=(t,i)=>t>>>0<<(i>>>0)>>>0,t.lshiftu8=(t,i)=>(t&y)<<(i&y)&y,t.max2id=(t,i)=>t>=i?0:1,t.max3id=(t,i,a)=>t>=i?t>=a?0:2:i>=a?1:2,t.max4id=(t,i,a,n)=>t>=i?t>=a?t>=n?0:3:a>=n?2:3:i>=a?i>=n?1:3:a>=n?2:3,t.maximaIndex=(t,i=0,a=t.length)=>_(P,t,i,a),t.maximaIndices=(t,i=0,a=t.length)=>w(q,t,i,a),t.min2id=(t,i)=>t<=i?0:1,t.min3id=(t,i,a)=>t<=i?t<=a?0:2:i<=a?1:2,t.min4id=(t,i,a,n)=>t<=i?t<=a?t<=n?0:3:a<=n?2:3:i<=a?i<=n?1:3:a<=n?2:3,t.minError=G,t.minNonZero2=Q,t.minNonZero3=(t,i,a)=>Q(Q(t,i),a),t.minimaIndex=q,t.minimaIndices=(t,i=0,a=t.length)=>w(q,t,i,a),t.mix=X,t.mixBilinear=(t,i,a,n,s,r)=>X(X(t,i,s),X(a,n,s),r),t.mixCubic=(t,i,a,n,s)=>{const r=s*s,e=1-s,o=e*e;return t*o*e+3*i*o*s+3*a*r*e+n*r*s},t.mixCubicHermite=(t,i,a,n,s)=>{const r=s-1,e=s*s,o=r*r;return(1+2*s)*o*t+s*o*i+e*(3-2*s)*a+e*r*n},t.mixHermite=(t,i,a,n,s)=>{const r=.5*(a-t),e=1.5*(i-a)+.5*(n-t);return((e*s+t-i+r-e)*s+r)*s+i},t.mixQuadratic=(t,i,a,n)=>{const s=1-n;return t*s*s+2*i*s*n+a*n*n},t.muli16=(t,i)=>j((0|t)*(0|i)),t.muli32=(t,i)=>(0|t)*(0|i)|0,t.muli8=(t,i)=>V((0|t)*(0|i)),t.mulu16=(t,i)=>(t&F)*(i&F)&F,t.mulu32=(t,i)=>(t>>>0)*(i>>>0)>>>0,t.mulu8=(t,i)=>(t&y)*(i&y)&y,t.norm=N,t.normCos=t=>{const i=t*t;return 1+i*(2*i-4)},t.noti16=t=>j(~t),t.noti32=t=>~t,t.noti8=t=>V(~t),t.notu16=t=>~t&F,t.notu32=t=>~t>>>0,t.notu8=t=>~t&y,t.ori16=(t,i)=>j(0|t|i),t.ori32=(t,i)=>0|t|i,t.ori8=(t,i)=>V(0|t|i),t.oru16=(t,i)=>(t&F|i&F)&F,t.oru32=(t,i)=>(t>>>0|i>>>0)>>>0,t.oru8=(t,i)=>(t&y|i&y)&y,t.parabola=(t,i)=>Math.pow(4*i*(1-i),t),t.quadrant=t=>g(t)*u|0,t.rad=t=>t*c,t.roundEps=(t,i=b)=>{const a=Z(t);return a<=i||a>=1-i?Math.round(t):t},t.roundTo=(t,i=1)=>Math.round(t/i)*i,t.rshifti16=(t,i)=>j((0|t)>>(0|i)),t.rshifti32=(t,i)=>(0|t)>>(0|i),t.rshifti8=(t,i)=>V((0|t)>>(0|i)),t.rshiftu16=(t,i)=>(t&F)>>>(i&F)&F,t.rshiftu32=(t,i)=>t>>>0>>>(i>>>0)>>>0,t.rshiftu8=(t,i)=>(t&y)>>>(i&y)&y,t.safeDiv=(t,i)=>0!==i?t/i:0,t.sclamp=(t,i,a,n)=>U(L(t,i,n),a,n),t.sec=t=>1/Math.cos(t),t.sigmoid=(t,i)=>1/(1+Math.exp(-t*(2*i-1))),t.sigmoid11=(t,i)=>1/(1+Math.exp(-t*i)),t.sign=(t,i=b)=>t>i?1:t<-i?-1:0,t.signExtend16=j,t.signExtend8=V,t.simplifyRatio=(t,i)=>{let a=Math.abs(t),n=Math.abs(i);for(;;){if(a<n){const t=a;a=n,n=t}const s=a%n;if(!s)return[t/n,i/n];a=s}},t.sinc=(t,a)=>(a=i*(t*a-1),Math.sin(a)/a),t.sincos=(t,i=1)=>[Math.sin(t)*i,Math.cos(t)*i],t.smax=L,t.smin=U,t.smoothStep=(t,i,a)=>(3-2*(a=S((a-t)/(i-t))))*a*a,t.smootherStep=(t,i,a)=>(a=S((a-t)/(i-t)))*a*a*(a*(6*a-15)+10),t.solveCubic=(t,i,a,n,s=1e-9)=>{const r=t*t,e=i*i,o=i/(3*t),h=(3*t*a-e)/(3*r),u=(2*e*i-9*t*i*a+27*r*n)/(27*r*t);if(Math.abs(h)<s)return[Math.cbrt(-u)-o];if(Math.abs(u)<s)return h<0?[-Math.sqrt(-h)-o,-o,Math.sqrt(-h)-o]:[-o];{const t=u*u/4+h*h*h/27;if(Math.abs(t)<s)return[-1.5*u/h-o,3*u/h-o];if(t>0){const i=Math.cbrt(-u/2-Math.sqrt(t));return[i-h/(3*i)-o]}{const t=2*Math.sqrt(-h/3),i=Math.acos(3*u/h/t)/3,a=2*Math.PI/3;return[t*Math.cos(i)-o,t*Math.cos(i-a)-o,t*Math.cos(i-2*a)-o]}}},t.solveLinear=(t,i)=>-i/t,t.solveQuadratic=(t,i,a,n=1e-9)=>{const s=2*t;let r=i*i-4*t*a;return r<0?[]:r<n?[-i/s]:(r=Math.sqrt(r),[(-i-r)/s,(-i+r)/s])},t.step=(t,i)=>i<t?0:1,t.subi16=(t,i)=>j((0|t)-(0|i)),t.subi32=(t,i)=>(0|t)-(0|i)|0,t.subi8=(t,i)=>V((0|t)-(0|i)),t.subu16=(t,i)=>(t&F)-(i&F)&F,t.subu32=(t,i)=>(t>>>0)-(i>>>0)>>>0,t.subu8=(t,i)=>(t&y)-(i&y)&y,t.tangentCardinal=(t,i,a=.5,n=0,s=2)=>a*((i-t)/(s-n)),t.tangentDiff3=(t,i,a,n=0,s=1,r=2)=>.5*((a-i)/(r-s)+(i-t)/(s-n)),t.trunc=t=>t<0?Math.ceil(t):Math.floor(t),t.tween=(t,i,a)=>n=>X(i,a,t(n)),t.wrap=(t,i,a)=>{if(i===a)return i;if(t>a){const n=a-i;(t-=n)>a&&(t-=n*((t-i)/n|0))}else if(t<i){const n=a-i;(t+=n)<i&&(t+=n*((i-t)/n+1|0))}return t},t.wrap01=t=>t<0?t+1:t>1?t-1:t,t.wrap11=t=>t<-1?t+2:t>1?t-2:t,t.wrapOnce=(t,i,a)=>t<i?t-i+a:t>a?t-a+i:t,t.xori16=(t,i)=>j((0|t)^(0|i)),t.xori32=(t,i)=>(0|t)^(0|i),t.xori8=(t,i)=>V((0|t)^(0|i)),t.xoru16=(t,i)=>(t&F^i&F)&F,t.xoru32=(t,i)=>(t>>>0^i>>>0)>>>0,t.xoru8=(t,i)=>(t&y^i&y)&y,Object.defineProperty(t,"__esModule",{value:!0})})); |
{ | ||
"name": "@thi.ng/math", | ||
"version": "1.7.8", | ||
"version": "1.7.9", | ||
"description": "Assorted common math functions & utilities", | ||
@@ -36,9 +36,9 @@ "module": "./index.js", | ||
"@istanbuljs/nyc-config-typescript": "^1.0.1", | ||
"@microsoft/api-extractor": "^7.7.8", | ||
"@types/mocha": "^7.0.1", | ||
"@types/node": "^13.7.4", | ||
"mocha": "^7.1.1", | ||
"nyc": "^15.0.0", | ||
"ts-node": "^8.6.2", | ||
"typedoc": "^0.16.10", | ||
"@microsoft/api-extractor": "^7.7.13", | ||
"@types/mocha": "^7.0.2", | ||
"@types/node": "^13.13.4", | ||
"mocha": "^7.1.2", | ||
"nyc": "^15.0.1", | ||
"ts-node": "^8.9.1", | ||
"typedoc": "^0.17.6", | ||
"typescript": "^3.8.3" | ||
@@ -67,3 +67,3 @@ }, | ||
}, | ||
"gitHead": "bb751118ba5a7261d322952a7ec5530860d73881" | ||
"gitHead": "c11f130122cbaa05b8d48d394c3a164e238c8078" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
168519