/* COPYRIGHT Esri - https://js.arcgis.com/5.0/LICENSE.txt */
import{transpose as t,multiply as r,adjoint as i,set as m}from"./libs/gl-matrix-2/math/mat3.js";import{create as s}from"./libs/gl-matrix-2/factories/mat3f64.js";import{set as o}from"./libs/gl-matrix-2/math/vec2.js";import{set as a,transformMat3 as e}from"./libs/gl-matrix-2/math/vec3.js";import{create as f}from"./libs/gl-matrix-2/factories/vec3f64.js";const c=f(),n=s(),l=s(),p=s();function u(r,i,m){return a(c,i[0],i[1],1),e(c,c,t(n,m)),0===c[2]?o(r,c[0],c[1]):o(r,c[0]/c[2],c[1]/c[2])}function x(t,m,s){return b(l,m[0],m[1],m[2],m[3],m[4],m[5],m[6],m[7]),b(p,s[0],s[1],s[2],s[3],s[4],s[5],s[6],s[7]),r(t,i(l,l),p),0!==t[8]&&(t[0]/=t[8],t[1]/=t[8],t[2]/=t[8],t[3]/=t[8],t[4]/=t[8],t[5]/=t[8],t[6]/=t[8],t[7]/=t[8],t[8]/=t[8]),t}function b(s,o,f,l,p,u,x,b,g){m(s,o,l,u,f,p,x,1,1,1),a(c,b,g,1),i(n,s);const[j,h,v]=e(c,c,t(n,n));return m(n,j,0,0,0,h,0,0,0,v),r(s,n,s)}export{x as getProjectiveTransform,u as transformProjective};
