/*
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
See https://js.arcgis.com/4.24/esri/copyright.txt for details.
*/
define(["exports","../../../core/Logger","../../../core/maybe","../../../chunks/mat3","../../../chunks/mat3f64","../../../chunks/mat4f64","../../../chunks/vec3","../../../chunks/vec3f64","../../projection","../../projectionEllipsoid","./geographicUtils","./projection"],(function(e,t,o,r,n,i,s,a,c,g,l,f){"use strict";const p=t.getLogger("esri.geometry.support.meshUtils.offset");function u(e,t,r){if(e.vertexAttributes&&e.vertexAttributes.position)if(o.isSome(e.transform))null!=(null==r?void 0:r.geographic)&&r.geographic!==e.transform.geographic&&p.warn(`Specifying the 'geographic' parameter (${r.geographic}) different from the Mesh transform setting (${e.transform.geographic}) is not supported`),m(e.transform,t);else{l.isGeographicMesh(e.spatialReference,r)?h(e,t):P(e,t)}}function m(e,t){const o=e.origin;e.origin=s.add(a.create(),o,t)}function h(e,t){const n=e.spatialReference,i=e.vertexAttributes.position,a=e.vertexAttributes.normal,l=e.vertexAttributes.tangent,p=new Float64Array(i.length),u=o.isSome(a)?new Float32Array(a.length):null,m=o.isSome(l)?new Float32Array(l.length):null,h=e.extent.center,P=v;c.computeTranslationToOriginAndRotation(n,[h.x,h.y,h.z],F,g.getSphericalPCPF(n)),r.fromMat4(A,F),s.transformMat3(P,t,A),f.projectToPCPF(i,n,p),o.isSome(a)&&f.projectNormalToPCPF(a,i,p,n,u),o.isSome(l)&&f.projectTangentToPCPF(l,i,p,n,m),d(p,P),f.projectFromPCPF(p,i,n),o.isSome(a)&&f.projectNormalFromPCPF(u,i,p,n,a),o.isSome(l)&&f.projectTangentFromPCPF(m,i,p,n,l),e.vertexAttributesChanged()}function P(e,t){d(e.vertexAttributes.position,t),e.vertexAttributesChanged()}function d(e,t){if(e)for(let o=0;o<e.length;o+=3)for(let r=0;r<3;r++)e[o+r]+=t[r]}const v=a.create(),F=i.create(),A=n.create();e.offset=u,Object.defineProperties(e,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}));
