Hi. I’m working on this test:
Scenario : The pixel size for a horizontal canvas
Given c ← camera(200, 125, π/2)
Then c.pixel_size = 0.01
I’m doing this in Haskell, so I’m pulling the following from a Haskell REPL prompt that is doing the same calculations as my code:
> hs = 200
> vs = 125
> fov = (pi/2)
> 1.5707963267948966
> radians = (fov/2) * (pi/180)
> 1.3707783890401887e-2 ==> (0.013707783)
> ar = (fromIntegral hs) / (fromIntegral vs)
> 1.6
> hv = tan radians
> 1.3708642534394055e-2 ==> (0.01370864253)
> hw = calcHalfWidth ar hv
> 1.3708642534394055e-2 ==> (0.01370864253)
> (hw * 2) / (fromIntegral hs) ==> (0.02741728506) / 200
1.3708642534394054e-4 ==> (0.00013708642)
I’m trying to track down where this is going wrong, and every time I double check my calculations, I convince myself that they are correct, even though I’m off by so much.
Does anybody see any obvious issues?