Skip to content

Instantly share code, notes, and snippets.

@DeveloperPaul123
Created August 12, 2019 00:33
Show Gist options
  • Select an option

  • Save DeveloperPaul123/4ab1df90949019a7e62cbfe2e6c5ceb8 to your computer and use it in GitHub Desktop.

Select an option

Save DeveloperPaul123/4ab1df90949019a7e62cbfe2e6c5ceb8 to your computer and use it in GitHub Desktop.

Revisions

  1. DeveloperPaul123 renamed this gist Aug 12, 2019. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  2. DeveloperPaul123 created this gist Aug 12, 2019.
    14 changes: 14 additions & 0 deletions main.cpp
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,14 @@
    #include <iostream>
    #include <cmath>

    double interpolate(double input_min, double input_max, double output_min, double output_max, double input_value)
    {
    return output_min + ((output_max - output_min)/(input_max - input_min)) * (input_value - input_min);
    }

    int main()
    {
    std::cout << std::floor(interpolate(-180.0, 180.0, 0.0, 359.0, 152.63)) << std::endl;

    return 0;
    }