All files / domain SensorToBody.res.mjs

100% Statements 11/11
100% Branches 3/3
100% Functions 2/2
100% Lines 11/11

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51          48x   48x   16x 16x   16x 16x   16x 16x   48x       16x               3x                                        
// Generated by ReScript, PLEASE EDIT WITH CARE
 
import * as Quaternion$WsteinRegripCore from "./Quaternion.res.mjs";
 
function value(q, component) {
  let match = component.axis;
  let tmp;
  switch (match) {
    case "X" :
      tmp = q.x;
      break;
    case "Y" :
      tmp = q.y;
      break;
    case "Z" :
      tmp = q.z;
      break;
  }
  return component.sign * tmp;
}
 
function apply(map, q) {
  return Quaternion$WsteinRegripCore.normalize({
    x: value(q, map.x),
    y: value(q, map.y),
    z: value(q, map.z),
    w: q.w
  });
}
 
let $$default = {
  x: {
    axis: "X",
    sign: 1
  },
  y: {
    axis: "Z",
    sign: 1
  },
  z: {
    axis: "Y",
    sign: -1
  }
};
 
export {
  $$default as default,
  apply,
}
/* No side effect */