C OpenGL Mathematics Write a function that supports linear
C++ OpenGL Mathematics
// Write a function that supports linear interpolation between
 // two scalar (doubles) values. It should take two doubles as
 // arguments. These represent the initial and ending values. It
 // should also take a value for the interpolation parameter as
 // an argument. If the parameter is zero or negative, the function
 // should return the initial value. If the parameter is one or
 // greater, the function should return the final value. Otherwise,
 // it should return an interpolated value between the begining
 // and ending values. Use the function to interpolate between 5 and 15.
 // Test it with parameter values of -1, 0, 0.6, 1, and 20. Display
 // the results to the console.
 double linearInterpolateScalars(const double & initial, const double & final, const double & t)
 {
return 0.0;
} // end linearInterpolateScalars
void problem6()
 {
    std::cout << \"Problem 6\" << std::endl;
 } // end Problem6
Solution
#include <glm/vec3.hpp> // glm::vec3
 #include <glm/vec4.hpp> // glm::vec4
 #include <glm/mat4x4.hpp> // glm::mat4
 #include <glm/gtc/matrix_transform.hpp> // glm::translate, glm::rotate, glm::scale, glm::perspective
 glm::mat4 camera(float Translate, glm::vec2 const & Rotate)
 {
 glm::mat4 Projection = glm::perspective(glm::radians(45.0f), 4.0f / 3.0f, 0.1f, 100.f);
 glm::mat4 View = glm::translate(glm::mat4(1.0f), glm::vec3(0.0f, 0.0f, -Translate));
 View = glm::rotate(View, Rotate.y, glm::vec3(-1.0f, 0.0f, 0.0f));
 View = glm::rotate(View, Rotate.x, glm::vec3(0.0f, 1.0f, 0.0f));
 glm::mat4 Model = glm::scale(glm::mat4(1.0f), glm::vec3(0.5f));
 return Projection * View * Model;
 }

