NewtonCollisionPointDistance [SOLVED]

Report any bugs here and we'll post fixes

Moderators: Sascha Willems, Thomas

NewtonCollisionPointDistance [SOLVED]

Postby MeltingPlastic » Sat Sep 22, 2018 4:41 pm

NewtonCollisionPointDistance does not seem to return 0 if the point is inside the given collision.

I setup a quick test inside the ClosestDistance demo to show the bug. It should print something to the console if the point is inside the collision:

https://github.com/MADEAPPS/newton-dynamics/compare/master...TrevorCash:IntersectionTest?expand=1
Last edited by MeltingPlastic on Fri Sep 28, 2018 1:49 pm, edited 1 time in total.
MeltingPlastic
 
Posts: 237
Joined: Fri Feb 07, 2014 11:30 pm

Re: NewtonCollisionPointDistance

Postby Julio Jerez » Sat Sep 22, 2018 8:02 pm

is this a pull request?
how do I check this?
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: NewtonCollisionPointDistance

Postby MeltingPlastic » Sat Sep 22, 2018 8:10 pm

Sorry - That wasn't a very useful link. I just created an actual pull request.

Here is the branch that has my test code: https://github.com/TrevorCash/newton-dynamics/tree/IntersectionTest you should be able to check it out using git.

I also made a full pull request too if its easier:
https://github.com/MADEAPPS/newton-dynamics/pull/126

Thanks
MeltingPlastic
 
Posts: 237
Joined: Fri Feb 07, 2014 11:30 pm

Re: NewtonCollisionPointDistance

Postby Julio Jerez » Sat Sep 22, 2018 8:21 pm

I got the pull request but what I see does not make sence to me.
the cast a point in the middle of the floor to a shape that does not seem to be inside of any shape.
Is that what you meant?
closeDist.png
closeDist.png (150.89 KiB) Viewed 6641 times
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: NewtonCollisionPointDistance

Postby MeltingPlastic » Sat Sep 22, 2018 8:43 pm

I think the visuals look like it is casting from the center of the floor to the shapes but that is because I am not altering the m_castingVisualEntity->m_contact1 array because it did not fit into the function.

In reality It should still be casting from the center of each of the bodies spinning above.

I probably could have manually set the m_castingVisualEntity->m_contact1 to matrixB.m_posit or something to make it clearer.
MeltingPlastic
 
Posts: 237
Joined: Fri Feb 07, 2014 11:30 pm

Re: NewtonCollisionPointDistance

Postby Julio Jerez » Sat Sep 22, 2018 8:56 pm

got me confused there.
basically you want to cast a convex shape from a point that is inside the shape,
and the function should return 0 to indicate the point is inside the shape?

isn't that what you want?
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: NewtonCollisionPointDistance

Postby Julio Jerez » Sat Sep 22, 2018 9:19 pm

The bug is fixed now, the function dgWorld::ClosestPoint was ignoring the result of the calculation.
if you sync, it should be fine now.
I restored it back to the original demo but if you uncomment it locally, you will see the result on the
command window.

Hey MeltingPlastic I guess by now you never thought Newton was going to have all those hidden functionality without any fanfare. :o :shock: :roll: 8)
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: NewtonCollisionPointDistance

Postby MeltingPlastic » Tue Sep 25, 2018 11:38 am

HI Julio,

I still can't get the function to work for me.

I want to see res be 1 and then 0 if you drag the lower body on top of the casting shape (upper rotating shape) and then back to 1 when they are not colliding. No matter what combinations I try I can not get a transition.

This time I am using NewtonCollisionClosestPoint as the original demo has. But the results are the same.

Here is my testing branch: https://github.com/TrevorCash/newton-dynamics/tree/morePointDistanceTest
MeltingPlastic
 
Posts: 237
Joined: Fri Feb 07, 2014 11:30 pm

Re: NewtonCollisionPointDistance

Postby Julio Jerez » Tue Sep 25, 2018 2:03 pm

But I did test that, it should be working.
can you make the pull request in the way you have it set up?
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: NewtonCollisionPointDistance

Postby MeltingPlastic » Tue Sep 25, 2018 2:39 pm

MeltingPlastic
 
Posts: 237
Joined: Fri Feb 07, 2014 11:30 pm

Re: NewtonCollisionPointDistance

Postby Julio Jerez » Tue Sep 25, 2018 3:36 pm

oh you were right, I fixed the bug for convex/convex, the compound follow a different code path and was ignoring the return value of each convex pair.
It needs to break if a return from any pair is negative.

It is fixed now,
Please try again, see if it is ok now
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: NewtonCollisionPointDistance

Postby MeltingPlastic » Tue Sep 25, 2018 6:31 pm

It works now Thanks!

I think the function used in the demo is inverted to what is documented above the function though.
MeltingPlastic
 
Posts: 237
Joined: Fri Feb 07, 2014 11:30 pm

Re: NewtonCollisionPointDistance

Postby Julio Jerez » Tue Sep 25, 2018 8:59 pm

I am not sure what I did but is broken now, I am sure it was fine when I committed the fix but now seems to be reporting incorrect results.
I will compare to older version later and see whats wrong.
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: NewtonCollisionPointDistance

Postby Julio Jerez » Wed Sep 26, 2018 12:38 am

alright now it is fixed for real. I made a mistake in the previous fix.
please check if it behave the way you expect.
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: NewtonCollisionPointDistance

Postby MeltingPlastic » Wed Sep 26, 2018 2:57 pm

Awesome! - Yeah Its working how I expect now in my tests
MeltingPlastic
 
Posts: 237
Joined: Fri Feb 07, 2014 11:30 pm


Return to Bugs and Fixes

Who is online

Users browsing this forum: No registered users and 8 guests

cron