UNPKG

@doegis/core

Version:

DOE GIS API

3 lines (1 loc) 806 B
import{c as t}from"../../../../chunks/mat4f64.js";import{c as o}from"../../../../chunks/vec3f64.js";import{getReferenceEllipsoid as r}from"../../../../geometry/ellipsoidUtils.js";import{computeTranslationToOriginAndRotation as a}from"../../../../geometry/projection.js";function n(o,r,n,s){const c=h(o,r,n),i=t();return a(n,c,i,s),i}const s=1,c=5-s;function h(t,a,n){const h=o(),i=t[3],e=2**(Math.ceil(Math.log(i)*Math.LOG2E/c)*c+s);if(n.isGeographic){const o=e/r(n).radius*180/Math.PI,a=Math.round(t[1]/o),s=Math.max(-90,Math.min(90,a*o)),c=o/Math.cos((Math.abs(s)-o/2)/180*Math.PI),i=Math.round(t[0]/c)*c;h[0]=i,h[1]=s}else{const o=Math.round(t[0]/e),r=Math.round(t[1]/e);h[0]=o*e,h[1]=r*e}const M=t[2]+a,m=Math.round(M/e);return h[2]=m*e,h}export{n as computeGlobalTransformation,h as getLocalOrigin};