/*
All material copyright Esri, All Rights Reserved, unless otherwise specified.
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
*/
import{fromValues as e}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import t from"../MeshGeoreferencedVertexSpace.js";import r from"../MeshLocalVertexSpace.js";import{isGlobal as n}from"./geographicUtils.js";import{convertVertexSpace as i}from"./vertexSpaceConversion.js";function o(e,t,r){return n(t.spatialReference,r?.geographic)?s(e,t,!1,r):c(e,t,r)}function a(e,t,r){return n(t.spatialReference,r?.geographic)?u(e,t,r):p(e,t,r)}function c(r,n,o){const a=e(n.x,n.y,n.z??0);return i({vertexAttributes:r,vertexSpace:new t({origin:a}),spatialReference:n.spatialReference},t.absolute,{sourceUnit:o?.unit})}function s(n,o,a,c){const s=e(o.x,o.y,o.z??0);return i({vertexAttributes:n,vertexSpace:new r({origin:s}),spatialReference:o.spatialReference},new t({origin:null}),{sourceUnit:c?.unit})}function p(r,n,o){const a=e(n.x,n.y,n.z??0);return i({vertexAttributes:r,vertexSpace:t.absolute,spatialReference:n.spatialReference},new t({origin:a}),{targetUnit:o?.unit})}function u(n,o,a){const c=e(o.x,o.y,o.z??0);return i({vertexAttributes:n,spatialReference:o.spatialReference,vertexSpace:t.absolute},new r({origin:c}),{targetUnit:a?.unit})}export{o as georeference,a as ungeoreference};
