NewtonCollisionCalculateAABB bug?

Report any bugs here and we'll post fixes

Moderators: Sascha Willems, Thomas

Re: NewtonCollisionCalculateAABB bug?

Postby Marc » Fri Nov 27, 2009 5:20 pm

No, I started using it with 2.11 and because of the strange results I got and because you haven't released the version puplicly yet, I tried with another newton version and got different results. And then I tried with even another version and got different results again.
Millenium Project Enterprises - Hobbyist Gamedev Group http://www.mpe-online.org
Walkover is now on Steam => http://store.steampowered.com/app/348700/
User avatar
Marc
 
Posts: 281
Joined: Sun Mar 14, 2004 4:07 pm
Location: Germany

Re: NewtonCollisionCalculateAABB bug?

Postby Marc » Fri Nov 27, 2009 7:13 pm

Ok, I just tried that: Using NewtonCollisionForEachPolygonDo on the collision and doing a simple min and max of all vertices, I get the correct bounding box:

original mesh manually calculated bb: RAW BB: -3.126976 -3.616533 -0.019121 3.500324 3.568864 10.969679
calculated with the supportvector code: NTC BB: -2.006744 -3.275425 -0.019121 3.480575 3.260570 10.969678
calculated with min/max/NewtonCollisionForEachPolygonDo: NTC BBITER: -3.126976 -3.616533 -0.019121 3.500324 3.568864 10.969678

As a sidenote: There is a small rounding accuracy with the last digit of the last value. That's not bothering me though.
Millenium Project Enterprises - Hobbyist Gamedev Group http://www.mpe-online.org
Walkover is now on Steam => http://store.steampowered.com/app/348700/
User avatar
Marc
 
Posts: 281
Joined: Sun Mar 14, 2004 4:07 pm
Location: Germany

Re: NewtonCollisionCalculateAABB bug?

Postby Julio Jerez » Fri Nov 27, 2009 7:19 pm

so the Box using support vertex is wrong?
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: NewtonCollisionCalculateAABB bug?

Postby Marc » Fri Nov 27, 2009 7:22 pm

Yes, unless my code from above, which basically resembles your code from further above is wrong and causes this issue.
Millenium Project Enterprises - Hobbyist Gamedev Group http://www.mpe-online.org
Walkover is now on Steam => http://store.steampowered.com/app/348700/
User avatar
Marc
 
Posts: 281
Joined: Sun Mar 14, 2004 4:07 pm
Location: Germany

Re: NewtonCollisionCalculateAABB bug?

Postby Julio Jerez » Fri Nov 27, 2009 8:05 pm

I see, that looks like a big Bug I will check it out out.


The rounding error is because the AABB using support vertex comes from a Dot product projection while the AABB calcualted fron checking all vertices comes from a direct compare.
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: NewtonCollisionCalculateAABB bug?

Postby Julio Jerez » Fri Nov 27, 2009 8:32 pm

you are righr mark in it totally bogus, I just tested It must happen in version 2.11
I am fixing it now, an dI will post Version 2.11 even if teh destruction is not finish yet.
There are few important Bug fixes that are important.
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: NewtonCollisionCalculateAABB bug?

Postby Marc » Fri Nov 27, 2009 9:08 pm

Ok. I'm looking forward to the new version :)
Millenium Project Enterprises - Hobbyist Gamedev Group http://www.mpe-online.org
Walkover is now on Steam => http://store.steampowered.com/app/348700/
User avatar
Marc
 
Posts: 281
Joined: Sun Mar 14, 2004 4:07 pm
Location: Germany

Re: NewtonCollisionCalculateAABB bug?

Postby Julio Jerez » Fri Nov 27, 2009 10:59 pm

Ok I fixed it, it was a stupid bug I intrudeced in 2.10 when I changed the format to make it share code with the compound shape.
I added this test code to the SDK demos and it seems to work fine.
Code: Select all
   {
      NewtonCollisionInfoRecord collisionInfo;
      NewtonCollisionGetInfo (collision, &collisionInfo);
      if (collisionInfo.m_collisionType == SERIALIZE_ID_TREE) {
         int count;
         dVector p0(-1000, -1000, -1000);
         dVector p1(1000, 1000, 1000);
         const dFloat* vertexArray;
         int vertexStrideInBytes;
         int vertexCount;
         int indexList[256];
         int attributeList[256/3];
         count = NewtonTreeCollisionGetVertexListIndexListInAABB (collision, &p0[0], &p1[0],
                                                     &vertexArray, &vertexCount, &vertexStrideInBytes,
                                                                 indexList, sizeof (indexList)/sizeof (indexList[0]),
                                                                 attributeList);

         // check AABB accuracy

         vertexStrideInBytes /= sizeof (dFloat);
         dVector minP1 ( 1.0e10f,  1.0e10f,  1.0e10f, 0.0f);
         dVector maxP1 (-1.0e10f, -1.0e10f, -1.0e10f, 0.0f);
         for (int i = 0; i < vertexCount; i ++) {
            for (int j = 0; j < 3; j ++ ) {
               minP1[j] = vertexArray[i * vertexStrideInBytes + j] < minP1[j] ? vertexArray[i * vertexStrideInBytes + j] : minP1[j];
               maxP1[j] = vertexArray[i * vertexStrideInBytes + j] > maxP1[j] ? vertexArray[i * vertexStrideInBytes + j] : maxP1[j];
            }
         }

         dVector minP;
         dVector maxP;
         dMatrix matrix (GetIdentityMatrix());
         CalculateAABB (collision, matrix, minP, maxP);

         minP1 -= minP;
         maxP1 -= maxP;
      }
   }


It is late now I will post beta 2.11 tomorrow.
Thank you for the Bug, I would never find it
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: NewtonCollisionCalculateAABB bug?

Postby Marc » Sat Nov 28, 2009 12:10 pm

You are welcome! Thanks for fixing it! :)
Millenium Project Enterprises - Hobbyist Gamedev Group http://www.mpe-online.org
Walkover is now on Steam => http://store.steampowered.com/app/348700/
User avatar
Marc
 
Posts: 281
Joined: Sun Mar 14, 2004 4:07 pm
Location: Germany

Re: NewtonCollisionCalculateAABB bug?

Postby Marc » Mon Nov 30, 2009 7:10 am

Ok in the public 2.11 version the aabb now seems to be correct for me as well :)
Millenium Project Enterprises - Hobbyist Gamedev Group http://www.mpe-online.org
Walkover is now on Steam => http://store.steampowered.com/app/348700/
User avatar
Marc
 
Posts: 281
Joined: Sun Mar 14, 2004 4:07 pm
Location: Germany

Previous

Return to Bugs and Fixes

Who is online

Users browsing this forum: No registered users and 2 guests