Instability of convex hulls

A place to discuss everything related to Newton Dynamics.

Moderators: Sascha Willems, walaber

Instability of convex hulls

Postby carli2 » Fri Apr 27, 2012 5:41 pm

Hi,

Code: Select all
gwX.engine: ../../source/physics/dgNarrowPhaseCollision.cpp:344: dgCollision* dgWorld::CreateConvexHull(dgInt32, const dgFloat32*, dgInt32, dgFloat32, dgInt32, const dgMatrix&): Assertion `0' failed.

Program received signal SIGABRT, Aborted.
0x00007ffff5090445 in raise () from /lib/x86_64-linux-gnu/libc.so.6
(gdb) backtrace
#0  0x00007ffff5090445 in raise () from /lib/x86_64-linux-gnu/libc.so.6
#1  0x00007ffff5093bab in abort () from /lib/x86_64-linux-gnu/libc.so.6
#2  0x00007ffff508910e in ?? () from /lib/x86_64-linux-gnu/libc.so.6
#3  0x00007ffff50891b2 in __assert_fail () from /lib/x86_64-linux-gnu/libc.so.6
#4  0x00007ffff65d3e8c in dgWorld::CreateConvexHull(int, float const*, int, float, int, dgMatrix const&) () from src/libNewton.so
#5  0x00007ffff66421cf in NewtonCreateConvexHull () from src/libNewton.so
#6  0x00000000005dc2cc in CREATESTR (this=0x0,
    S=0x7fffe0012b50 "hull 100 2.3257 -3.6253 -2.7155 2.7075 -3.6253 -2.7155 2.7075 -3.6253 -2.3337 2.3257 -3.6253 -2.3337 ", WORLD_=0xded980,
    MATRIX=0x843938, AOWNER=0x0, vmt=0x0) at physicscript.pas:187
#7  0x00000000005dd3cc in CREATEOB (HOME=0x843938, PARS=0x7ffff7f76dd0)
    at physicscript.pas:297
#8  0x00000000004e18a0 in EXECUTESCRIPT (K=0x7fffe06946b0,
    CODE=0x7fffd7a2cc00, PARS=0x7fffffffd5f4, STACKOVERFLOW=197,
    GLOBAL=0x7fffe06946b0, BREAK=
    {void (TEXECCODE, PEXECPART, PEXECCLASS, PDATA)} 0x7fffffff0e70)
    at scriptengine/scriptexecution.pas:860
#9  0x00000000004e281b in EXECUTESCRIPT (K=0x7fffd79266a0,
    CODE=0x7fffd79aae60, PARS=0x7fffffffd60c, STACKOVERFLOW=198,
    GLOBAL=0x7fffe06946b0, BREAK=
    {void (TEXECCODE, PEXECPART, PEXECCLASS, PDATA)} 0x7fffffff1270)
    at scriptengine/scriptexecution.pas:986


CreateConvexHull seems to be very instable with wrong data. This only occurs in newer core200 versions (in this case trunk 1847 with linux)
I cannot give that kind of physics engine to users because they can crash the engine with simple data.

Whats the reason for these crashes and can they be fixed?
(Btw to get a valid linux build, I had to remove the invalid comments in the beginning of the makefile and add some files to it - http://paste.ubuntu.com/950926/)
carli2
 
Posts: 157
Joined: Thu Nov 10, 2011 1:53 pm

Re: Instability of convex hulls

Postby Julio Jerez » Fri Apr 27, 2012 6:51 pm

as far as I knwo the the convex Hull is error free and very very robust.
you said incorrect data, what kind of incorrect data? and what do you think it should do?

also you should migrate to core 300.
Julio Jerez
Moderator
Moderator
 
Posts: 12426
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Instability of convex hulls

Postby carli2 » Mon Apr 30, 2012 4:46 pm

Julio Jerez wrote:as far as I knwo the the convex Hull is error free and very very robust.
you said incorrect data, what kind of incorrect data? and what do you think it should do?


The hull where it crashes is "2.3257 -3.6253 -2.7155 2.7075 -3.6253 -2.7155 2.7075 -3.6253 -2.3337 2.3257 -3.6253 -2.3337"
Maybe you could try to generate a hull from this (format is x y z x y z x y z)
As I said, the crash is new since some versions. I don't have it with the last downloadable release.

Julio Jerez wrote:also you should migrate to core 300.

Code: Select all
make: *** No rule to make target `../../source/core/dgWorkerThread.o', needed by `libNewton.a'.  Stop.
carli2
 
Posts: 157
Joined: Thu Nov 10, 2011 1:53 pm

Re: Instability of convex hulls

Postby Julio Jerez » Tue May 01, 2012 7:00 am

but those point map to a flas face. Only newton code 300 can build convex hull for flas faces, all oteh version of newton will report NULL
Julio Jerez
Moderator
Moderator
 
Posts: 12426
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Instability of convex hulls

Postby carli2 » Tue May 01, 2012 7:08 am

Julio Jerez wrote:but those point map to a flas face. Only newton code 300 can build convex hull for flas faces, all oteh version of newton will report NULL


But it does not return NULL, it throws an exception that I cannot catch.

And I cannot use core300 because it does not compile under linux.
carli2
 
Posts: 157
Joined: Thu Nov 10, 2011 1:53 pm

Re: Instability of convex hulls

Postby carli2 » Tue May 01, 2012 8:02 am

BTW why don't you simply create a CMake-project for newton? that would enable us to compile newton no matter what OS and IDE we are using.

Edit: after correcting the makefile, I got
Code: Select all
../../source/physics/dgCollisionInstance.cpp: In copy constructor ‘dgCollisionInstance::dgCollisionInstance(const dgCollisionInstance&)’:
../../source/physics/dgCollisionInstance.cpp:102:14: error: ‘_ASSERT’ was not declared in this scope
carli2
 
Posts: 157
Joined: Thu Nov 10, 2011 1:53 pm

Re: Instability of convex hulls

Postby Julio Jerez » Tue May 01, 2012 8:23 am

I tryed once, and I codul not get one goit.
do you want to donate a c make project?


you are sayin that if I take these "2.3257 -3.6253 -2.7155 2.7075 -3.6253 -2.7155 2.7075 -3.6253 -2.3337 2.3257 -3.6253 -2.3337"
and call creatconvexhull, the funtion will crash?
Julio Jerez
Moderator
Moderator
 
Posts: 12426
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Instability of convex hulls

Postby carli2 » Wed May 02, 2012 4:07 am

Julio Jerez wrote:I tryed once, and I codul not get one goit.
do you want to donate a c make project?

When it's actively used, everyone can profit from it.
The change should be done on a day when no one adds or removes files.
I will start with a core200 CMakeFile.

Julio Jerez wrote:you are sayin that if I take these "2.3257 -3.6253 -2.7155 2.7075 -3.6253 -2.7155 2.7075 -3.6253 -2.3337 2.3257 -3.6253 -2.3337"
and call creatconvexhull, the funtion will crash?

It throws an assertion.
maybe I should compile core200 without assertions?
carli2
 
Posts: 157
Joined: Thu Nov 10, 2011 1:53 pm

Re: Instability of convex hulls

Postby Julio Jerez » Wed May 02, 2012 6:15 am

I just did this

float xxx[] = {2.3257, -3.6253, -2.7155, 2.7075, -3.6253, -2.7155, 2.7075, -3.6253, -2.3337, 2.3257, -3.6253, -2.3337};
NewtonCollision* aaa =NewtonCreateConv exHull(scene->GetNewton(), sizeof (xxx) /(3 * sizeof (float)), xxx, 3 * sizeof (float), 0, 0, 0);

and the function does throw and assertion yes .
I realise that the points are a straigh line, a straight line is a 1 dimentional object, you should check that the retrurn value of NewtonCreateConvexHull
is not null.
I removed the asertion, because this is not a bug it is simple bad input data.
Julio Jerez
Moderator
Moderator
 
Posts: 12426
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Instability of convex hulls

Postby carli2 » Wed May 02, 2012 2:18 pm

Julio Jerez wrote:I just did this

float xxx[] = {2.3257, -3.6253, -2.7155, 2.7075, -3.6253, -2.7155, 2.7075, -3.6253, -2.3337, 2.3257, -3.6253, -2.3337};
NewtonCollision* aaa =NewtonCreateConv exHull(scene->GetNewton(), sizeof (xxx) /(3 * sizeof (float)), xxx, 3 * sizeof (float), 0, 0, 0);

and the function does throw and assertion yes .
I realise that the points are a straigh line, a straight line is a 1 dimentional object, you should check that the retrurn value of NewtonCreateConvexHull
is not null.
I removed the asertion, because this is not a bug it is simple bad input data.


Thanks.
(I check the return value against null anyway, so it perfectly fits into my prog)

Edit: Can you please do sth like
Code: Select all
_ASSERTE("It should not happen that bodies have no references");
// instead of
_ASSERTE(0);


It really helps deciding where or why exactly a assertion failed.
carli2
 
Posts: 157
Joined: Thu Nov 10, 2011 1:53 pm

Re: Instability of convex hulls

Postby carli2 » Wed May 02, 2012 3:04 pm

Can you please the assertion removal to core200? (i am still not able to compile core300)

Code: Select all
dgVector dgCollisionNull::CalculateVolumeIntegral(const dgMatrix& matrix__,
    GetBuoyancyPlane buoyancuPlane__, void* context__) const
{
  _ASSERTE(0);
  return dgVector(0.0f, 0.0f, 0.0f, 0.0f);
}


after removing the assertion, the following occurs:
Code: Select all
gwX.engine: ../../source/physics/dgWorldDynamicUpdate.cpp:3124: void dgJacobianMemory::CalculateSimpleBodyReactionsForces(dgFloat32) const: Assertion `((sizeof (force[k]) == sizeof (float) ? __finitef (force[k]) : sizeof (force[k]) == sizeof (double) ? __finite (force[k]) : __finitel (force[k])) && !(sizeof (force[k]) == sizeof (float) ? __isnanf (force[k]) : sizeof (force[k]) == sizeof (double) ? __isnan (force[k]) : __isnanl (force[k])))' failed.




I wonder why core200 now dosent work any more. What were the most fundamental changes since 2.34 that could break that all?
carli2
 
Posts: 157
Joined: Thu Nov 10, 2011 1:53 pm


Return to General Discussion

Who is online

Users browsing this forum: No registered users and 0 guests