/* COPYRIGHT Esri - https://js.arcgis.com/5.0/LICENSE.txt */
import{deg2rad as r}from"../../core/mathUtils.js";import{getMetersPerUnitForSR as t,getMetersPerVerticalUnitForSR as o}from"../../core/units.js";import{set as s}from"../../core/libs/gl-matrix-2/math/vec3.js";import{getNormal as a,fromManyPoints as i,create as m}from"./plane.js";function n(t,o,s){const i=c(e,t,o,s)?a(e):[0,0,1];return Math.abs(i[2])>Math.cos(r(80))?2:Math.abs(i[1])>Math.abs(i[0])?1:0}function c(r,a,m,n){const c=(r=>!Array.isArray(r[0]))(a)?(r,t)=>a[3*r+t]:(r,t)=>a[r][t],e=n?t(n)/o(n):1;return i(r,(r,t)=>s(r,c(t,0)*e,c(t,1)*e,c(t,2)),m)}const e=m();export{c as fitPlane,n as leastSignificantAxis};
