CollisionTree vs. chamfer cylinder collision bug?

A place to discuss everything related to Newton Dynamics.

Moderators: Sascha Willems, walaber

Re: CollisionTree vs. chamfer cylinder collision bug?

Postby Cannos » Fri Jan 28, 2011 3:14 pm

Yes the images and the code are the exact same meshes and position. The visual for the mesh has a little more detail, but that is purely visual, the collision tree is the exact same one as the code.
Cannos
 
Posts: 129
Joined: Thu Mar 04, 2010 5:41 pm

Re: CollisionTree vs. chamfer cylinder collision bug?

Postby Cannos » Thu Feb 03, 2011 2:54 pm

Hi Julio, I just wanted to check in to see if you've looked at this any more. Thanks!
Cannos
 
Posts: 129
Joined: Thu Mar 04, 2010 5:41 pm

Re: CollisionTree vs. chamfer cylinder collision bug?

Postby Cannos » Wed Feb 09, 2011 5:51 pm

Haven't heard anything on this in a while, is this still on your radar Julio?
Cannos
 
Posts: 129
Joined: Thu Mar 04, 2010 5:41 pm

Re: CollisionTree vs. chamfer cylinder collision bug?

Postby Julio Jerez » Wed Feb 09, 2011 6:07 pm

The reason is that I am organizing the directory structure so that Newton is released as Open Source with zlib licence.
In a few days, problably this weekend I will put the SDK on Google Code, then It will be easier to deal with these problems, since everyone will have to code

I spread out too thin trying to do so many thing at once, and in the end all I have it aboput 10 projects that are half way.
and I am not even counting new Platforms like Movile Devices not just Iphone, PS3 and XBOX 360, even CUDA and OpenCL.

Open Source distribution can help with that for those who want to contribute, or even compile on thier side.
Plus it will be a lot easser to fix Bugs.
So if you give me few days to get everything organized...
Julio Jerez
Moderator
Moderator
 
Posts: 12426
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: CollisionTree vs. chamfer cylinder collision bug?

Postby Cannos » Wed Feb 09, 2011 6:29 pm

I totally understand how busy you are and having multiple projects at once. I can wait. I just wanted to check in to make sure it wasn't forgotten. Thanks for the update Julio.
Cannos
 
Posts: 129
Joined: Thu Mar 04, 2010 5:41 pm

Re: CollisionTree vs. chamfer cylinder collision bug?

Postby Cannos » Wed Mar 16, 2011 5:56 pm

I know you haven't had a chance to look at this, and I started stepping through the source code but it'll take a lot more time for me to figure out what's going on. But I thought I'd at least let you know that I tried changing the CollisionTree to a ConvexHull and this returns a positive penetration amount.
Cannos
 
Posts: 129
Joined: Thu Mar 04, 2010 5:41 pm

Re: CollisionTree vs. chamfer cylinder collision bug?

Postby Julio Jerez » Wed Mar 16, 2011 7:29 pm

is that a Bug?
Can I have a test demo?
Julio Jerez
Moderator
Moderator
 
Posts: 12426
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: CollisionTree vs. chamfer cylinder collision bug?

Postby Cannos » Wed Mar 16, 2011 7:47 pm

The convex hull behaves more correctly. The bug is with the CollisionTree. You can reproduce it with the original code from the first post in this thread, but I have copied it below. I just put this code at the bottom of the Friction function of the BasicFriction demo.

I've also confirmed that it behaves the same in the latest open source version of Newton.
Code: Select all
    // Make collision tree
    NewtonCollision* pCollision = NewtonCreateTreeCollision(world, 0);
    NewtonTreeCollisionBeginBuild(pCollision);

    const int cNumVerts = 8;
    float verts[cNumVerts][3] =
    {
         0.5,    0,    0,
        -0.5,    0,    0,
           0,    0, -2.5,
           0,    0,  2.5,
         0.5, 0.25,    0,
        -0.5, 0.25,    0,
           0, 0.25, -2.5,
           0, 0.25,  2.5
    };
    const int cNumFaces = 12;
    int indices[cNumFaces * 3] =
    {
        0, 1, 2,
        0, 3, 1,
        4, 6, 5,
        4, 5, 7,
        5, 6, 2,
        5, 2, 1,
        7, 5, 1,
        7, 1, 3,
        4, 2, 6,
        4, 0, 2,
        4, 7, 3,
        4, 3, 0
    };

    for (int i = 0; i < cNumFaces; i++)
    {
        int index0 = indices[i * 3];
        int index1 = indices[i * 3 + 1];
        int index2 = indices[i * 3 + 2];

        float faceVerts[3][3];
        faceVerts[0][0] = verts[index0][0];
        faceVerts[0][1] = verts[index0][1];
        faceVerts[0][2] = verts[index0][2];
        faceVerts[1][0] = verts[index1][0];
        faceVerts[1][1] = verts[index1][1];
        faceVerts[1][2] = verts[index1][2];
        faceVerts[2][0] = verts[index2][0];
        faceVerts[2][1] = verts[index2][1];
        faceVerts[2][2] = verts[index2][2];
       
        NewtonTreeCollisionAddFace(pCollision, 3, &(faceVerts[0][0]), 12, 0);
    }
    NewtonTreeCollisionEndBuild(pCollision, 1);

    // Add chamfer cylinder
    float offsetmtx[16] = { 0, 1, 0, 0, -1, 0, 0, 0, 0, 0, 1, 0, 0, 0.1f, 0, 1 };
    NewtonCollision* pCylCollision = NewtonCreateChamferCylinder(world, 0.5f, 0.2f, 1, offsetmtx);

    // Matrices of collision tree and cylinder
    float treeMtx[16] = { 0.70710677f, 0, 0.70710677f, 0, 0, 1, 0, 0, -0.70710677f, 0, 0.70710677f, 0, 26.652052f, 0.5f, 43.713711f, 1 };
    float cylMtx[16] = { 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 26.0855798f, 0.495723963f, 44.80299f, 1.0f };

    // Do collision
    const int cMaxContacts = 15;
    float contacts[cMaxContacts][3];
    float normals[cMaxContacts][3];
    float penetrations[cMaxContacts];
    int numContacts = NewtonCollisionCollide(world, cMaxContacts, pCylCollision, cylMtx, pCollision, treeMtx, &(contacts[0][0]), &(normals[0][0]), &(penetrations[0]), 0);


It would be great to figure out what's going on here, especially if it's a bug, but it isn't a critical priority. I just wanted to give you the new information I found where the CollisionTree reports 0.0 penetration and the ConvexHull reports a positive penetration. The main question is why the CollisionTree reports 0 penetration.
Cannos
 
Posts: 129
Joined: Thu Mar 04, 2010 5:41 pm

Re: CollisionTree vs. chamfer cylinder collision bug?

Postby Julio Jerez » Wed Mar 16, 2011 8:09 pm

Ha ok I remember now. That sure look like a Big bug.

I am in the midle of a feature now and the engine is broken, But this weekend I will have back on and I will check that bug out.
Julio Jerez
Moderator
Moderator
 
Posts: 12426
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: CollisionTree vs. chamfer cylinder collision bug?

Postby Cannos » Wed Mar 16, 2011 8:25 pm

Cool, thanks Julio.
Cannos
 
Posts: 129
Joined: Thu Mar 04, 2010 5:41 pm

Previous

Return to General Discussion

Who is online

Users browsing this forum: No registered users and 2 guests