raytracing.github.io icon indicating copy to clipboard operation
raytracing.github.io copied to clipboard

Improve `camera.h` naming, commentary

Open hollasch opened this issue 4 years ago • 3 comments
trafficstars

The camera class is moderately complex, with lots of member and intermediate variables. Member variables u, v, w could use a comment indicating what they are and that they're unit length, and some of the intermediate expressions like lower_left_corner + s*horizontal + t*vertical - origin - offset could be either broken into named descriptive components or at least given a descriptive name.

In addition to this general pass, it may be appropriate to split this into one specific to book1, and duplicates specific to books 2 & 3.

hollasch avatar Feb 07 '21 19:02 hollasch

The camera class has member variables s/t the main loop has camera coordinates u/v

From what I can remember in other literature, s/t are typically used for pixel coordinates and u/v are used for texture coordinates.

We use u/vfor the member variables of textures in book 2.

Maybe we should consider renaming the main loop variables to s/t?

trevordblack avatar Apr 22 '22 06:04 trevordblack

Can I get an update on this?

trevordblack avatar Aug 01 '22 06:08 trevordblack

I'll move to s/t where possible and unique.

hollasch avatar Aug 05 '22 22:08 hollasch

Fixed in code in PR #1154 (text updates pending).

hollasch avatar Jun 29 '23 21:06 hollasch