openglsuperbible / sb7code

Source code and supporting material for the 7th Edition of OpenGL SuperBible
727 stars 251 forks source link

bug sb7code/include/vmath.h #50

Open Aha-hub opened 8 months ago

Aha-hub commented 8 months ago

Lines 1298 and 1304 of vmath.h have a bug in the implementation of mix(). According to the definition of linear interpolation, the code implementation seems to be should be

template <typename T>
static inline T mix(const T& A, const T& B, typename T::element_type t)
{
    return A + t * (B - A);
}