xiangaodielian / bullet

Automatically exported from code.google.com/p/bullet
Other
0 stars 0 forks source link

Quaternion that returned from btQuaternion::slerp function is invalid #713

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?

code example

btQuaternion q1(0.125155225, -0.293132186, 0.0474233069, 0.946657717);
btQuaternion q2(0.125155225, -0.293132216, 0.0474233069, 0.946657658);
btQuaternion q;

q = q1.slerp( q2, 0.25 );
// q is invalid. element is -1.#IND !!!

Probably, if theta = 0, d is #INF at btQuaternion.h:508 

What is the expected output? What do you see instead?

Always right quaternion returned from function.

What version of the product are you using? On what operating system?

bullet 2.81(bullet-2.81-rev2613.zip ) on windows 7 and VS2012

Please provide any additional information below.

Original issue reported on code.google.com by exceedbl...@gmail.com on 18 May 2013 at 2:05

GoogleCodeExporter commented 9 years ago
You're right. The issue arises from the check used in the conditional,

if(btFabs(product) != btScalar(1))

The product between q1 and q2 results in a value slightly greater than 1 (due 
to roundoff) so it passes this condition. Then, btAcos clamps values to ensure 
they are on the interval [-1,1], so this value of the product is converted to 1 
internally by btAcos which results in theta = 0.

Changing the conditional to

if(btFabs(product) < btScalar(1))

Fixes this problem. I have also added this case as a unit test.

Original comment by joshua.d...@gmail.com on 14 Jun 2013 at 1:30

Attachments:

GoogleCodeExporter commented 9 years ago
Thanks, I'll fix it before next release.

Original comment by erwin.coumans on 9 Jul 2013 at 8:19

GoogleCodeExporter commented 9 years ago
Thanks. I am looking forward to the next release.

Original comment by exceedbl...@gmail.com on 11 Jul 2013 at 1:18

GoogleCodeExporter commented 9 years ago
Actually, it was already fixed last year:
https://code.google.com/p/bullet/source/detail?r=2623

Other than this fix, just curious why are you looking forward to next release?

All development happens in Bullet 3.x at github. The first version of Bullet 
3.x will be OpenCL only, later we'll add all other platform support.

Original comment by erwin.coumans on 11 Jul 2013 at 6:28

GoogleCodeExporter commented 9 years ago

Original comment by erwin.coumans on 10 Sep 2013 at 8:21