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