UNPKG

@arcgis/core

Version:

ArcGIS Maps SDK for JavaScript: A complete 2D and 3D mapping and data visualization API

6 lines (5 loc) 1.09 kB
/* All material copyright ESRI, All Rights Reserved, unless otherwise specified. See https://js.arcgis.com/4.33/esri/copyright.txt for details. */ import{create as t}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{clone as o,create as r}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{getReferenceEllipsoid as a}from"../../../../geometry/ellipsoidUtils.js";import{computeTranslationToOriginAndRotation as i}from"../../../../geometry/projection/computeTranslationToOriginAndRotation.js";function n(r,a,n,s,e){const h="east-north-up"===n?o(r):c(r,a,s),m=t();return i(s,h,m,e),m}const s=1,e=5-s;function c(t,o,i){const n=r(),c=t[3],h=2**(Math.ceil(Math.log(c)*Math.LOG2E/e)*e+s);if(i.isGeographic){const o=h/a(i).radius*180/Math.PI,r=Math.round(t[1]/o),s=Math.max(-90,Math.min(90,r*o)),e=o/Math.cos((Math.abs(s)-o/2)/180*Math.PI),c=Math.round(t[0]/e)*e;n[0]=c,n[1]=s}else{const o=Math.round(t[0]/h),r=Math.round(t[1]/h);n[0]=o*h,n[1]=r*h}const m=t[2]+o,M=Math.round(m/h);return n[2]=M*h,n}export{n as computeGlobalTransformation,c as getLocalOrigin};