From ce5cf1b60dae81540b2db366b1408a961f771dcc Mon Sep 17 00:00:00 2001 From: Charles Date: Tue, 27 Aug 2019 19:04:34 +0200 Subject: Set visualization Loop throught each pixel and color it black if its in the set, white otherwise. This is eavily inspired by the coding train video on the subject. (https://www.youtube.com/watch?v=6z7GQewK-Ks) --- helper.c | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 helper.c (limited to 'helper.c') diff --git a/helper.c b/helper.c new file mode 100644 index 0000000..9920c5d --- /dev/null +++ b/helper.c @@ -0,0 +1,10 @@ +#include +#include "header.h" + +double map_range(double x, double src_lo, double src_hi, double dest_lo, double dest_hi) +{ + double src_len = fabs(src_hi - src_lo); + double dest_len = fabs(dest_hi - dest_lo); + + return (x - src_lo) / src_len * dest_len + dest_lo; +} -- cgit