aboutsummaryrefslogtreecommitdiffstats
path: root/src/hal/components/hypot.comp
blob: a8fea840b9edb0f9b0c873a47d52a3cd9b423fa3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
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";
author "Jeff Epler";
;;
#include <rtapi_math.h>
FUNCTION(_) {
    double a = in0, b = in1, c = in2;
    out = sqrt(a*a + b*b + c*c);
}
bues.ch cgit interface