(Ray tracing) Trouble converting to screen coordinates, objects being stretched
It looks like the parameters to your camera class are not correct
 const int img_ratio = 2;
 ...
 Camera&lt;float&gt; cam1(20.0f, img_ratio, Point3&lt;float&gt;(0.0f, 0.0f, 0.0f), Point3&lt;float&gt;(0.0f, 0.0f, -1.0f), Vec3&lt;float&gt;(0.0f, 1.0f, 0.0f));

In your code you set img_ratio to 2, I would expect it should be something like img_width/img_height (or the reverse img_height/img_width). img_ratio should also be also be a floating point to match the  type the camera class is being instantiated with.