Ray Tracing Distortion

My ray tracer works, but when I try to render a sphere with 60 degree fovy, 1820x1080, there is a large amount of distortion.

https://dl.dropbox.com/u/41733151/test.png

Ideas?

My bet is the aspect ratio: width/height —> (float)width/height

I use:


fovx = fovy * width / height;

and


alpha = Math.tan(Math.toRadians(fovx / 2)) * (pixel[0] - (width / 2)) / (width / 2);
beta = Math.tan(Math.toRadians(fovy / 2)) * ((height / 2) - pixel[1]) / (height / 2);
dir = normalize(sub(add(scale(uTemp, alpha), scale(vTemp, beta)), wTemp));

Found the problem. I thought the ratio was:


fovx / fovy = width / heigth

I dound it was:


tan(fovx / 2) / tan(fovy / 2) = width / height