/ src / hal / components / hypot.comp
hypot.comp
 1  component hypot "Three-input hypotenuse (Euclidean distance) calculator";
 2  pin in float in0;
 3  pin in float in1;
 4  pin in float in2;
 5  pin out float out "out = sqrt(in0^2 + in1^2 + in2^2)";
 6  function _;
 7  license "GPL";
 8  ;;
 9  #include <rtapi_math.h>
10  FUNCTION(_) {
11      double a = in0, b = in1, c = in2;
12      out = sqrt(a*a + b*b + c*c);
13  }