UNPKG

cione-comp-lib

Version:

`$ yarn add cione-comp-lib` 或者 `$ npm i cione-comp-lib -S`

2 lines (1 loc) 8.79 kB
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});var t=require("./common.js"),r={create:function(){var r=new t.GLMAT_ARRAY_TYPE(16);return r[0]=1,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=1,r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[10]=1,r[11]=0,r[12]=0,r[13]=0,r[14]=0,r[15]=1,r},clone:function(r){var n=new t.GLMAT_ARRAY_TYPE(16);return n[0]=r[0],n[1]=r[1],n[2]=r[2],n[3]=r[3],n[4]=r[4],n[5]=r[5],n[6]=r[6],n[7]=r[7],n[8]=r[8],n[9]=r[9],n[10]=r[10],n[11]=r[11],n[12]=r[12],n[13]=r[13],n[14]=r[14],n[15]=r[15],n},copy:function(t,r){return t[0]=r[0],t[1]=r[1],t[2]=r[2],t[3]=r[3],t[4]=r[4],t[5]=r[5],t[6]=r[6],t[7]=r[7],t[8]=r[8],t[9]=r[9],t[10]=r[10],t[11]=r[11],t[12]=r[12],t[13]=r[13],t[14]=r[14],t[15]=r[15],t},identity:function(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t},transpose:function(t,r){if(t===r){var n=r[1],a=r[2],o=r[3],e=r[6],u=r[7],i=r[11];t[1]=r[4],t[2]=r[8],t[3]=r[12],t[4]=n,t[6]=r[9],t[7]=r[13],t[8]=a,t[9]=e,t[11]=r[14],t[12]=o,t[13]=u,t[14]=i}else t[0]=r[0],t[1]=r[4],t[2]=r[8],t[3]=r[12],t[4]=r[1],t[5]=r[5],t[6]=r[9],t[7]=r[13],t[8]=r[2],t[9]=r[6],t[10]=r[10],t[11]=r[14],t[12]=r[3],t[13]=r[7],t[14]=r[11],t[15]=r[15];return t},invert:function(t,r){var n=r[0],a=r[1],o=r[2],e=r[3],u=r[4],i=r[5],M=r[6],f=r[7],c=r[8],h=r[9],s=r[10],p=r[11],l=r[12],v=r[13],w=r[14],A=r[15],m=n*i-a*u,L=n*M-o*u,T=n*f-e*u,_=a*M-o*i,d=a*f-e*i,y=o*f-e*M,b=c*v-h*l,P=c*w-s*l,q=c*A-p*l,E=h*w-s*v,G=h*A-p*v,S=s*A-p*w,O=m*S-L*G+T*E+_*q-d*P+y*b;return O?(O=1/O,t[0]=(i*S-M*G+f*E)*O,t[1]=(o*G-a*S-e*E)*O,t[2]=(v*y-w*d+A*_)*O,t[3]=(s*d-h*y-p*_)*O,t[4]=(M*q-u*S-f*P)*O,t[5]=(n*S-o*q+e*P)*O,t[6]=(w*T-l*y-A*L)*O,t[7]=(c*y-s*T+p*L)*O,t[8]=(u*G-i*q+f*b)*O,t[9]=(a*q-n*G-e*b)*O,t[10]=(l*d-v*T+A*m)*O,t[11]=(h*T-c*d-p*m)*O,t[12]=(i*P-u*E-M*b)*O,t[13]=(n*E-a*P+o*b)*O,t[14]=(v*L-l*_-w*m)*O,t[15]=(c*_-h*L+s*m)*O,t):null},adjoint:function(t,r){var n=r[0],a=r[1],o=r[2],e=r[3],u=r[4],i=r[5],M=r[6],f=r[7],c=r[8],h=r[9],s=r[10],p=r[11],l=r[12],v=r[13],w=r[14],A=r[15];return t[0]=i*(s*A-p*w)-h*(M*A-f*w)+v*(M*p-f*s),t[1]=-(a*(s*A-p*w)-h*(o*A-e*w)+v*(o*p-e*s)),t[2]=a*(M*A-f*w)-i*(o*A-e*w)+v*(o*f-e*M),t[3]=-(a*(M*p-f*s)-i*(o*p-e*s)+h*(o*f-e*M)),t[4]=-(u*(s*A-p*w)-c*(M*A-f*w)+l*(M*p-f*s)),t[5]=n*(s*A-p*w)-c*(o*A-e*w)+l*(o*p-e*s),t[6]=-(n*(M*A-f*w)-u*(o*A-e*w)+l*(o*f-e*M)),t[7]=n*(M*p-f*s)-u*(o*p-e*s)+c*(o*f-e*M),t[8]=u*(h*A-p*v)-c*(i*A-f*v)+l*(i*p-f*h),t[9]=-(n*(h*A-p*v)-c*(a*A-e*v)+l*(a*p-e*h)),t[10]=n*(i*A-f*v)-u*(a*A-e*v)+l*(a*f-e*i),t[11]=-(n*(i*p-f*h)-u*(a*p-e*h)+c*(a*f-e*i)),t[12]=-(u*(h*w-s*v)-c*(i*w-M*v)+l*(i*s-M*h)),t[13]=n*(h*w-s*v)-c*(a*w-o*v)+l*(a*s-o*h),t[14]=-(n*(i*w-M*v)-u*(a*w-o*v)+l*(a*M-o*i)),t[15]=n*(i*s-M*h)-u*(a*s-o*h)+c*(a*M-o*i),t},determinant:function(t){var r=t[0],n=t[1],a=t[2],o=t[3],e=t[4],u=t[5],i=t[6],M=t[7],f=t[8],c=t[9],h=t[10],s=t[11],p=t[12],l=t[13],v=t[14],w=t[15];return(r*u-n*e)*(h*w-s*v)-(r*i-a*e)*(c*w-s*l)+(r*M-o*e)*(c*v-h*l)+(n*i-a*u)*(f*w-s*p)-(n*M-o*u)*(f*v-h*p)+(a*M-o*i)*(f*l-c*p)},multiply:function(t,r,n){var a=r[0],o=r[1],e=r[2],u=r[3],i=r[4],M=r[5],f=r[6],c=r[7],h=r[8],s=r[9],p=r[10],l=r[11],v=r[12],w=r[13],A=r[14],m=r[15],L=n[0],T=n[1],_=n[2],d=n[3];return t[0]=L*a+T*i+_*h+d*v,t[1]=L*o+T*M+_*s+d*w,t[2]=L*e+T*f+_*p+d*A,t[3]=L*u+T*c+_*l+d*m,L=n[4],T=n[5],_=n[6],d=n[7],t[4]=L*a+T*i+_*h+d*v,t[5]=L*o+T*M+_*s+d*w,t[6]=L*e+T*f+_*p+d*A,t[7]=L*u+T*c+_*l+d*m,L=n[8],T=n[9],_=n[10],d=n[11],t[8]=L*a+T*i+_*h+d*v,t[9]=L*o+T*M+_*s+d*w,t[10]=L*e+T*f+_*p+d*A,t[11]=L*u+T*c+_*l+d*m,L=n[12],T=n[13],_=n[14],d=n[15],t[12]=L*a+T*i+_*h+d*v,t[13]=L*o+T*M+_*s+d*w,t[14]=L*e+T*f+_*p+d*A,t[15]=L*u+T*c+_*l+d*m,t},multiplyAffine:function(t,r,n){var a=r[0],o=r[1],e=r[2],u=r[4],i=r[5],M=r[6],f=r[8],c=r[9],h=r[10],s=r[12],p=r[13],l=r[14],v=n[0],w=n[1],A=n[2];return t[0]=v*a+w*u+A*f,t[1]=v*o+w*i+A*c,t[2]=v*e+w*M+A*h,v=n[4],w=n[5],A=n[6],t[4]=v*a+w*u+A*f,t[5]=v*o+w*i+A*c,t[6]=v*e+w*M+A*h,v=n[8],w=n[9],A=n[10],t[8]=v*a+w*u+A*f,t[9]=v*o+w*i+A*c,t[10]=v*e+w*M+A*h,v=n[12],w=n[13],A=n[14],t[12]=v*a+w*u+A*f+s,t[13]=v*o+w*i+A*c+p,t[14]=v*e+w*M+A*h+l,t}};r.mul=r.multiply,r.mulAffine=r.multiplyAffine,r.translate=function(t,r,n){var a,o,e,u,i,M,f,c,h,s,p,l,v=n[0],w=n[1],A=n[2];return r===t?(t[12]=r[0]*v+r[4]*w+r[8]*A+r[12],t[13]=r[1]*v+r[5]*w+r[9]*A+r[13],t[14]=r[2]*v+r[6]*w+r[10]*A+r[14],t[15]=r[3]*v+r[7]*w+r[11]*A+r[15]):(a=r[0],o=r[1],e=r[2],u=r[3],i=r[4],M=r[5],f=r[6],c=r[7],h=r[8],s=r[9],p=r[10],l=r[11],t[0]=a,t[1]=o,t[2]=e,t[3]=u,t[4]=i,t[5]=M,t[6]=f,t[7]=c,t[8]=h,t[9]=s,t[10]=p,t[11]=l,t[12]=a*v+i*w+h*A+r[12],t[13]=o*v+M*w+s*A+r[13],t[14]=e*v+f*w+p*A+r[14],t[15]=u*v+c*w+l*A+r[15]),t},r.scale=function(t,r,n){var a=n[0],o=n[1],e=n[2];return t[0]=r[0]*a,t[1]=r[1]*a,t[2]=r[2]*a,t[3]=r[3]*a,t[4]=r[4]*o,t[5]=r[5]*o,t[6]=r[6]*o,t[7]=r[7]*o,t[8]=r[8]*e,t[9]=r[9]*e,t[10]=r[10]*e,t[11]=r[11]*e,t[12]=r[12],t[13]=r[13],t[14]=r[14],t[15]=r[15],t},r.rotate=function(r,n,a,o){var e,u,i,M,f,c,h,s,p,l,v,w,A,m,L,T,_,d,y,b,P,q,E,G,S=o[0],O=o[1],R=o[2],Y=Math.sqrt(S*S+O*O+R*R);return Math.abs(Y)<t.GLMAT_EPSILON?null:(S*=Y=1/Y,O*=Y,R*=Y,e=Math.sin(a),i=1-(u=Math.cos(a)),M=n[0],f=n[1],c=n[2],h=n[3],s=n[4],p=n[5],l=n[6],v=n[7],w=n[8],A=n[9],m=n[10],L=n[11],T=S*S*i+u,_=O*S*i+R*e,d=R*S*i-O*e,y=S*O*i-R*e,b=O*O*i+u,P=R*O*i+S*e,q=S*R*i+O*e,E=O*R*i-S*e,G=R*R*i+u,r[0]=M*T+s*_+w*d,r[1]=f*T+p*_+A*d,r[2]=c*T+l*_+m*d,r[3]=h*T+v*_+L*d,r[4]=M*y+s*b+w*P,r[5]=f*y+p*b+A*P,r[6]=c*y+l*b+m*P,r[7]=h*y+v*b+L*P,r[8]=M*q+s*E+w*G,r[9]=f*q+p*E+A*G,r[10]=c*q+l*E+m*G,r[11]=h*q+v*E+L*G,n!==r&&(r[12]=n[12],r[13]=n[13],r[14]=n[14],r[15]=n[15]),r)},r.rotateX=function(t,r,n){var a=Math.sin(n),o=Math.cos(n),e=r[4],u=r[5],i=r[6],M=r[7],f=r[8],c=r[9],h=r[10],s=r[11];return r!==t&&(t[0]=r[0],t[1]=r[1],t[2]=r[2],t[3]=r[3],t[12]=r[12],t[13]=r[13],t[14]=r[14],t[15]=r[15]),t[4]=e*o+f*a,t[5]=u*o+c*a,t[6]=i*o+h*a,t[7]=M*o+s*a,t[8]=f*o-e*a,t[9]=c*o-u*a,t[10]=h*o-i*a,t[11]=s*o-M*a,t},r.rotateY=function(t,r,n){var a=Math.sin(n),o=Math.cos(n),e=r[0],u=r[1],i=r[2],M=r[3],f=r[8],c=r[9],h=r[10],s=r[11];return r!==t&&(t[4]=r[4],t[5]=r[5],t[6]=r[6],t[7]=r[7],t[12]=r[12],t[13]=r[13],t[14]=r[14],t[15]=r[15]),t[0]=e*o-f*a,t[1]=u*o-c*a,t[2]=i*o-h*a,t[3]=M*o-s*a,t[8]=e*a+f*o,t[9]=u*a+c*o,t[10]=i*a+h*o,t[11]=M*a+s*o,t},r.rotateZ=function(t,r,n){var a=Math.sin(n),o=Math.cos(n),e=r[0],u=r[1],i=r[2],M=r[3],f=r[4],c=r[5],h=r[6],s=r[7];return r!==t&&(t[8]=r[8],t[9]=r[9],t[10]=r[10],t[11]=r[11],t[12]=r[12],t[13]=r[13],t[14]=r[14],t[15]=r[15]),t[0]=e*o+f*a,t[1]=u*o+c*a,t[2]=i*o+h*a,t[3]=M*o+s*a,t[4]=f*o-e*a,t[5]=c*o-u*a,t[6]=h*o-i*a,t[7]=s*o-M*a,t},r.fromRotationTranslation=function(t,r,n){var a=r[0],o=r[1],e=r[2],u=r[3],i=a+a,M=o+o,f=e+e,c=a*i,h=a*M,s=a*f,p=o*M,l=o*f,v=e*f,w=u*i,A=u*M,m=u*f;return t[0]=1-(p+v),t[1]=h+m,t[2]=s-A,t[3]=0,t[4]=h-m,t[5]=1-(c+v),t[6]=l+w,t[7]=0,t[8]=s+A,t[9]=l-w,t[10]=1-(c+p),t[11]=0,t[12]=n[0],t[13]=n[1],t[14]=n[2],t[15]=1,t},r.fromQuat=function(t,r){var n=r[0],a=r[1],o=r[2],e=r[3],u=n+n,i=a+a,M=o+o,f=n*u,c=a*u,h=a*i,s=o*u,p=o*i,l=o*M,v=e*u,w=e*i,A=e*M;return t[0]=1-h-l,t[1]=c+A,t[2]=s-w,t[3]=0,t[4]=c-A,t[5]=1-f-l,t[6]=p+v,t[7]=0,t[8]=s+w,t[9]=p-v,t[10]=1-f-h,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t},r.frustum=function(t,r,n,a,o,e,u){var i=1/(n-r),M=1/(o-a),f=1/(e-u);return t[0]=2*e*i,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=2*e*M,t[6]=0,t[7]=0,t[8]=(n+r)*i,t[9]=(o+a)*M,t[10]=(u+e)*f,t[11]=-1,t[12]=0,t[13]=0,t[14]=u*e*2*f,t[15]=0,t},r.perspective=function(t,r,n,a,o){var e=1/Math.tan(r/2),u=1/(a-o);return t[0]=e/n,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=e,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=(o+a)*u,t[11]=-1,t[12]=0,t[13]=0,t[14]=2*o*a*u,t[15]=0,t},r.ortho=function(t,r,n,a,o,e,u){var i=1/(r-n),M=1/(a-o),f=1/(e-u);return t[0]=-2*i,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=-2*M,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=2*f,t[11]=0,t[12]=(r+n)*i,t[13]=(o+a)*M,t[14]=(u+e)*f,t[15]=1,t},r.lookAt=function(n,a,o,e){var u,i,M,f,c,h,s,p,l,v,w=a[0],A=a[1],m=a[2],L=e[0],T=e[1],_=e[2],d=o[0],y=o[1],b=o[2];return Math.abs(w-d)<t.GLMAT_EPSILON&&Math.abs(A-y)<t.GLMAT_EPSILON&&Math.abs(m-b)<t.GLMAT_EPSILON?r.identity(n):(s=w-d,p=A-y,l=m-b,u=T*(l*=v=1/Math.sqrt(s*s+p*p+l*l))-_*(p*=v),i=_*(s*=v)-L*l,M=L*p-T*s,(v=Math.sqrt(u*u+i*i+M*M))?(u*=v=1/v,i*=v,M*=v):(u=0,i=0,M=0),f=p*M-l*i,c=l*u-s*M,h=s*i-p*u,(v=Math.sqrt(f*f+c*c+h*h))?(f*=v=1/v,c*=v,h*=v):(f=0,c=0,h=0),n[0]=u,n[1]=f,n[2]=s,n[3]=0,n[4]=i,n[5]=c,n[6]=p,n[7]=0,n[8]=M,n[9]=h,n[10]=l,n[11]=0,n[12]=-(u*w+i*A+M*m),n[13]=-(f*w+c*A+h*m),n[14]=-(s*w+p*A+l*m),n[15]=1,n)},r.frob=function(t){return Math.sqrt(Math.pow(t[0],2)+Math.pow(t[1],2)+Math.pow(t[2],2)+Math.pow(t[3],2)+Math.pow(t[4],2)+Math.pow(t[5],2)+Math.pow(t[6],2)+Math.pow(t[7],2)+Math.pow(t[8],2)+Math.pow(t[9],2)+Math.pow(t[10],2)+Math.pow(t[11],2)+Math.pow(t[12],2)+Math.pow(t[13],2)+Math.pow(t[14],2)+Math.pow(t[15],2))};var n=r;exports.default=n;