Previous | Next --- Slide 18 of 49
Back to Lecture Thumbnails
Febgreen

Is the calculation of second wrong in this piece of code? I think it equals to first here.

alyssal

I agree, shouldn't the 2 and 1 should only be switched once?

motoole2

@Febgreen @alyssal Good catch. This would be fixed with the following:

NVHNode* first = child1

NVHNode* second = child2

// If child 2 is closer

if (hit2.t <= hit1.t)

// Swap order to make sure we are traversing "front to back"

first = child2

second = child1