You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi @koala999cn, and sorry for the (very!) late reply.
I tried your example, but the problem does not happen.
On picture, below, there is my debug session (tested with both gcc 14.2.1 and clang 18.1. 8):
A value (1.0, 0.0, 0.0) is a condition that can occur/be returmed only if the length of vector "dir" < FLT_EPSILON (alias: NULL vector): and this would not be the case!
Below the code relative, used to avoid a NULL vector and consequentially a division by ZERO
float len = length(dir);
if(len<1.0 && len>= FLT_EPSILON) { normalize(dir); len = 1.0; }
elseif(len< FLT_EPSILON) { dir = vec3(1.f, 0.f, 0.f); len = 1.0; }
q = angleAxis(acosf(dir.x/len), normalize(vec3(FLT_EPSILON, -dir.z, dir.y)));
On the basis of this I can assume that dir is initialized to (0.0, 0.0, 0.0) instead of (-1.0, 0.0, 0.0)
For this reason, please, tell me more about your C/C++ compiler (brand, version and used compiler flags) and your OS
Hello!
When entering the following code, incorrect result appears
It means, I wanna (-1, 0, 0), but get (1, 0, 0).
The text was updated successfully, but these errors were encountered: