[SOLVED] QVector3D normalization not working in Qt Creator debug mode?
-
I'm trying to debug a C++ program in Qt Creator and I've encountered a bug that seems very odd. I initialize a QVector3D, call it foo, and after I run foo.normalize(), inspecting the variables show it's not normalized.
Specifically, in the watch window:
normal.x() 1.8946852...
normal.y() 0.7071067...
normal.z() 0.7071067...
normal.length() 0.9999999...This is after a normal.normalize(). How can the length be about 1.0 when the x component is close to 2? It happens with other QVector3D names as well. Could this be memory corruption or am I missing something obvious and should just go to bed :)
-
After shutting down Qt Creator, making sure my build directory was fully cleaned, and recompiling everything, it looks like the error went away. I've got Q_ASSERTs scattered through the code and nothing has hit again, so it must have been just an odd state.