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

Variable name to index mismatch in AnimatedTransform in transform.cpp #231

Closed davechallis closed 4 years ago

davechallis commented 5 years ago

In the AnimatedTransform constructor that computes motion derivate terms, there's a mismatch between the names of some variables and the array indexes they're used to store.

Lines 418 to 427 contain:

    Float t0x = T[0].x;
    Float t0y = T[0].y;
    Float t0z = T[0].z;
    Float t1x = T[1].x;
    Float t1y = T[1].y;
    Float t1z = T[1].z;
    Float q1x = R[0].v.x;
    Float q1y = R[0].v.y;
    Float q1z = R[0].v.z;
    Float q1w = R[0].w;

The first six assignments look correct, but it looks like the last four don't match the array index they're using (i.e. they should be named q0x, q0y etc.).

Either that, or the variable names are correct and the array index is wrong (i.e. perhaps they should be accessing R[1]).

I don't understand the code well enough to know what the intention is here, just noticed that there was a mismatch.

mmp commented 4 years ago

Nice catch--fixed!