Page 2 of 3

Re: Distance between 2 objects

PostPosted: Mon Oct 18, 2010 11:32 am
by Julio Jerez
Ok try this

http://www.newtondynamics.com/downloads/NewtonWin-2.25.rar
there are problems with the SDK and the asycronous physics update when changing demos from the menu, but if you take the DLL or library you the bug should be fixed.
I will fixed thing this week.
I did not have time to make the optimized closest distance, so I enabled the naive one which works fine for shapes with small number of subparts.
That will let you continues until I write the more sofisticated one which is one order of magnitud faster for very complex meshes.
the demo show the calculation on closest distance in between different shapes with a coumpound shape.
I hope this is what you wanted.

Re: Distance between 2 objects

PostPosted: Tue Oct 19, 2010 7:02 am
by Cyrus
Thanks a lot.
I will check with this fix.

Re: Distance between 2 objects

PostPosted: Tue Oct 19, 2010 9:52 am
by Julio Jerez
download it again, I fixed the crash bug in the SDK when swiching demos.

Also some shapes the cast does not seem to be accurate, this is because there is a Bug in the Alchemedia exporter that is not writing the offset matrix of the shape right.
when I add debug display funtionality to the demos I will see hoe the shape is oriented and I will fix that.
that does not affect whe you are doing in any way.

Re: Distance between 2 objects

PostPosted: Mon Oct 25, 2010 10:03 am
by Cyrus
Thanks for the update,
I am a bit delayed as I have to use this with MogreNewt.
As soon as I get that working I will post the results.

Re: Distance between 2 objects

PostPosted: Mon Oct 25, 2010 1:17 pm
by Julio Jerez
does MogreNewt use OgreNewt?

I posted a patch to OgreNewt that integrate teh new funtionality into OgreNewt, but I do not think peopel too a look at it

Re: Distance between 2 objects

PostPosted: Wed Oct 27, 2010 10:58 am
by Cyrus
Hi Julio
I tested my application with newton 2.25 ( we are using mogrenewt which is built with newton 2.25 http://www.ogre3d.org/addonforums/viewt ... =8&t=13541), the api NewtonCollisionClosestPoint always returning one now eventhought object is joint or disjoint.
Can you please check for us, we are running out of time :cry:

Regards
Cyrus

Re: Distance between 2 objects

PostPosted: Wed Oct 27, 2010 2:05 pm
by Julio Jerez
Cyrus wrote:Can you please check for us, we are running out of time :cry:
Cyrus

But it is you that take few day to respond


what do you mean?
NewtonCollisionClosestPoint(world, collisionA, &matrix[0][0], m_shape, &matrix1[0][0], &contact0[0], &contact1[0], &normal[0], 0)) ;
will return 1 if the object are disjoint, zero if they are penetration,
are you saying that if the penetrate, the function still returns 1? (that woul be a Bug yes, I will check it out)
I believe that if the object are penetration the distance betwenn contact0 and contact1is zero.
can you chek that?

anyway try to reply today, so taht I can chek it out.
This should be very, very trail to get it going.
Plus I do not want to be the reason why you can not finish your project.
What are you doing?

Re: Distance between 2 objects

PostPosted: Thu Oct 28, 2010 3:35 am
by Cyrus
I believe that if the object are penetration the distance betwenn contact0 and contact1is zero

I am getting the distance between contact0 and contact1 always greater than zero eventhough objects are penetrated!!


We are trying to create a scene editor where we can arrange the objects in an optimized way (space efficiency)

Thanks
Cyrus

Re: Distance between 2 objects

PostPosted: Thu Oct 28, 2010 12:25 pm
by Julio Jerez
Ok I fix it. Please download 2.25 again.
http://www.newtondynamics.com/downloads/NewtonWin-2.25.rar


I also added a Patch for update ogrenewt to 2.25, maybe you cal let the people hwo maintain it to make the update.
It adds the file format, to ogenewt, so that debugging is easier than it has being so far.
it also adds a blender plug-in for the file format(early yet)
It adds the ability to run Ogrenewt physic concurrently in a thread, with the application, theis make any application using physics is a multicore system, one order of magnitude faster, and still maintaining determinism.
http://www.newtondynamics.com/downloads/UpdateToNewton25_VS9.patch

Re: Distance between 2 objects

PostPosted: Thu Oct 28, 2010 1:03 pm
by Cyrus
Hi Julio
Thanks for the quick response.

With the new version of newton library(2.25), creation of CollisionPrimitives.ConvexHull() crashes, we got the following stack trace

at NewtonReleaseCollision(NewtonWorld* , NewtonCollision* )
at MogreNewt.Collision.!Collision()
at MogreNewt.Collision.Dispose(Boolean )
at MogreNewt.CollisionPrimitives.ConvexHull..ctor(World world, Vector3[] verts, Single tolerance, Int32 id)

We are still invstigating this issue, can you also verify if it works with our model?

Thanks and Regards
Cyrus

Re: Distance between 2 objects

PostPosted: Thu Oct 28, 2010 1:48 pm
by Julio Jerez
it should not crash.
if you downloaded early this morning, please try downloading again, there was still another Bug.

In the last version I fix a memory leak the happened if someone create a convexHull collision and hull routine fail, it was sopose to deallocate the memory, but in fact was not.
I am not sure if it crashes because of the change, but it it is them it mean you has a leak before.

See if the update I put in 2.25 before leaving for work works now. If the crash is there let me know,

Cyrus wrote:...
We are still invstigating this issue, can you also verify if it works with our model?Cyrus

How do I do that?
do you have a running demo I can try?

Re: Distance between 2 objects

PostPosted: Tue Nov 02, 2010 2:15 am
by Cyrus
Hello Julio
Still it is crashing while creating convexHull collision with the latest newton dll.

Thanks
Cyrus

Re: Distance between 2 objects

PostPosted: Tue Nov 02, 2010 8:23 am
by Julio Jerez
I do not know what that is, it does not crash here.
without a test I do not know what to do.
I have tested with around a million convex hull (programatically for the feature I am working on now) without any error.
do you have a running demo?

Re: Distance between 2 objects

PostPosted: Fri Nov 12, 2010 3:04 am
by Cyrus
Hi
Sorry for late reply.
The crash is not happening with the latest newton library.
But still we have the same problem with the return value of NewtonCollisionClosestPoint api (always returns one) and the distance between contact0 and contact1 is always greater than zero
I attached a model for testing (use the same model as 2 different objects), I PMed the password for attached model.

Thanks
Cyrus

Re: Distance between 2 objects

PostPosted: Fri Nov 12, 2010 12:28 pm
by Julio Jerez
Oh Yes I see how it is failing.
I save your mesh as an alchemedia file and load it as the test mesh for closest distance demo.

I can see how the closest distance is wrong because it is casting right trough the mesh and according to this image here,
Image

I clearly show that the result in wrong.
Today is Friday, I will debug it tomorrow, and I will also check that the return value is also false when the tow collision is interpenetrations.
The only difference between my test and yours is that I have to scales you mesh 40 time, it seem you model are tiny, but that should not be any problems, as long as point are not so close together that we lose floating point integrity.
Anyway I will debug this tomorrow. Got to go now.