@arcgis/core
Version:
ArcGIS Maps SDK for JavaScript: A complete 2D and 3D mapping and data visualization API
3 lines (2 loc) • 1.04 kB
JavaScript
/* COPYRIGHT Esri - https://js.arcgis.com/5.0.19/LICENSE.txt */
import{create as t}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{create as o}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{getReferenceEllipsoid as r}from"../../../../geometry/ellipsoidUtils.js";import{computeTranslationToOriginAndRotation as e}from"../../../../geometry/projection/computeTranslationToOriginAndRotation.js";function n(o,r,n,a,i){const s="east-north-up"===n?o.center:c(o,r,a),h=t();return e(a,s,h,i),h}const a=1,i=5-a;function c(t,e,n){const c=o(),s=t.radius,h=2**(Math.ceil(Math.log(s)*Math.LOG2E/i)*i+a);if(n.isGeographic){const o=h/r(n).radius*180/Math.PI,e=Math.round(t.center[1]/o),a=Math.max(-90,Math.min(90,e*o)),i=o/Math.cos((Math.abs(a)-o/2)/180*Math.PI),s=Math.round(t.center[0]/i)*i;c[0]=s,c[1]=a}else{const o=Math.round(t.center[0]/h),r=Math.round(t.center[1]/h);c[0]=o*h,c[1]=r*h}const m=t.center[2]+e,M=Math.round(m/h);return c[2]=M*h,c}export{n as computeGlobalTransformation,c as getLocalOrigin};