/* COPYRIGHT Esri - https://js.arcgis.com/5.0.18/LICENSE.txt */
import{deg2rad as r}from"../../core/mathUtils.js";import{fromTranslation as t,identity as o}from"../../core/libs/gl-matrix-2/math/mat4.js";import{create as e}from"../../core/libs/gl-matrix-2/factories/vec3f64.js";import{computeENUToPCPFLocalRotation as n,computePCPFToENULocalRotation as s}from"./localRotationUtils.js";import{getProjectorClassification as i,projectionTable as l}from"./projectors.js";import{equals as c}from"../support/spatialReferenceUtils.js";function f(r,e,f,j){const R=i(r,j);if(null==R)return!1;const d=R.source.spatialReferenceId,x=R.dest.spatialReferenceId;if(d===x&&!m(x)&&(0!==d||c(r,j)))return t(f,e),!0;if(m(x)){const r=l[d][10],t=l[10][x];return null!=r&&null!=t&&(r(e,0,a,0),t(a,0,p,0),n(u*a[0],u*a[1],f),f[12]=p[0],f[13]=p[1],f[14]=p[2],!0)}const U=m(d);if((3===x||11===x||2===x||5===x)&&(2===d||U||3===d||5===d)){const r=l[d][10],t=l[10][x];return null!=r&&null!=t&&(r(e,0,a,0),t(a,0,p,0),U?s(u*a[0],u*a[1],f):o(f),f[12]=p[0],f[13]=p[1],f[14]=p[2],!0)}return!1}function m(r){return 1===r||6===r||8===r||4===r}const u=r(1),a=e(),p=e();export{f as computeTranslationToOriginAndRotation};
