mmp / pbrt-v3

Source code for pbrt, the renderer described in the third edition of "Physically Based Rendering: From Theory To Implementation", by Matt Pharr, Wenzel Jakob, and Greg Humphreys.
http://pbrt.org
BSD 2-Clause "Simplified" License
4.87k stars 1.18k forks source link

Minor code clarification related to continuous/discrete conversion #223

Closed kennyalive closed 4 years ago

kennyalive commented 5 years ago

https://github.com/mmp/pbrt-v3/blob/f7653953b2f9cc5d6a53b46acb5ce03317fd3e8b/src/core/film.cpp#L99

Wouldn't it be more aligned with the definition of how continuous/discrete conversions are done and also with the next line (p1) if we write p0 calculation in the equivalent form shown below?

Point2i p0 = (Point2i)Floor(floatBounds.pMin + halfPixel - filter->radius);

mmp commented 4 years ago

Good suggestion! I'm going to leave that as is for consistency, since that's what's in the printed book, but have made a note to make that improvement in the next edition.

Thanks!