/* COPYRIGHT Esri - https://js.arcgis.com/5.0.18/LICENSE.txt */
import{scale as t}from"../../core/libs/gl-matrix-2/math/vec3.js";function n(t){let n=t*t;return t<0&&(n*=-1),n}function a(t){return t.translation[0]=0,t.translation[1]=0,t.translation[2]=0,t.heading=0,t.tilt=0,t}function i(a,i,o){const r=o,s=a.state,e=a.device,l="forward-down"===i.tiltDirection?1:-1,c=1;return"standard"===e.deviceType?(r.translation[0]=n(s.axes[0]),r.translation[1]=n(s.axes[1]),r.translation[2]=n(s.buttons[7])-n(s.buttons[6]),r.heading=n(s.axes[2]),r.tilt=n(s.axes[3])):"spacemouse"===e.deviceType&&(r.translation[0]=1.2*n(s.axes[0]),r.translation[1]=1.2*n(s.axes[1]),r.translation[2]=2*-n(s.axes[2]),r.heading=1.2*n(s.axes[5]),r.tilt=1.2*n(s.axes[3])),r.tilt*=l,t(r.translation,r.translation,c),r}function o(t,n){const a=n;return a.translation[0]=t[1]-t[0],a.translation[1]=t[3]-t[2],a.translation[2]=t[4]-t[5],a.heading=t[7]-t[6],a.tilt=t[8]-t[9],a.zoom=t[10]-t[11],a}function r(t){return 0===t.translation[0]&&0===t.translation[1]&&0===t.translation[2]&&0===t.heading&&0===t.tilt&&0===t.zoom}export{i as extractTransformation,o as extractTransformationKeyboard,r as isZeroTransformation,a as resetTransformation};
