[fixed]quaternion rotationFromTo #IND00

You discovered a bug in the engine, and you are sure that it is not a problem of your code? Just post it in here. Please read the bug posting guidelines first.
Post Reply
xDan
Competition winner
Posts: 673
Joined: Thu Mar 30, 2006 1:23 pm
Location: UK
Contact:

[fixed]quaternion rotationFromTo #IND00

Post by xDan »

Hi,

The following code produces said error:

Code: Select all

	core::quaternion quat;
	quat.rotationFromTo(core::vector3df(0,0,1), core::vector3df(0,0,-1));
	printf("quat: %f,%f,%f,%f\n", quat.W,quat.X,quat.Y,quat.Z);
Now, looking at the rotationFromTo source I see the function is based on code from Game Programming Gems, so I look up the article and I see this:

Image

Does this mean this is a special case for which there is no solution?
(in which case could this please be noted in the docs?)

or can the check for zero be added? (but I'm not sure what the desirable behaviour should be in this case...)

[real world example: I calculate the rotation for my scene node to look in a particular vector, and this problem occurs on the rare occasion that the node is facing the exact opposite direction.]
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

Yeah, I know this bug and tried to work around this problem in the normals orientation code for some time. But it seems it could be added to the quaternion class instead. Sounds reasonable.
Post Reply