Simple Tools: Interpolation

In my shop, there are many washers – flat little things, varying diameters, metals, types, etc. When I need one, it’s a quick process to sort & select. How are software tools?

I’m working on a small RaspberryPi project with a temperature sensor. It became apparent it would be helpful to map that temperature to the wall thermometer. I ran a quick measurement exercise to build a table of matching temperatures in 10 degree increments.

Then I need some interpolation code to make good guesses. A scan of github yielded interpolation tools that seem to have a lot of other code or large libs or in one case, required me to read & comprehend the offering. Neither struck me as being simple.

What would be a simple tool?

A single file & class. Check.

Unit tests so users don’t have to debug my code. Check.

Generic class to fit several float types. Check.

Simple code, so if one wanted, they could quickly get comfortable with it. Check.

Exception safe. Check

Able to handle out-of-range requests. Check.

So here is an offering for a simple, safe & reasonably robust interpolation class for C++.

Simple Tools: Interpolation