A place to discuss everything related to Newton Dynamics.
Moderators: Sascha Willems, walaber
by pHySiQuE » Mon Aug 19, 2013 2:37 pm
Could line 156 of dgtypes.h be changed to something like this? It would allow me to define the NEWTON_DISABLE_ASSERT flag and disable the "random error" behavior it causes without modifying the Newton source.
- Code: Select all
#ifdef NEWTON_DISABLE_ASSERT
#define dgAssert(x)
#else
#if defined (_WIN_32_VER) || defined (_WIN_64_VER)
#define dgAssert(x)// _ASSERTE(x)
#else
#ifdef _DEBUG
#define dgAssert(x) assert(x)
#else
#define dgAssert(x)
#endif
#endif
#endif
Last edited by
pHySiQuE on Thu Sep 05, 2013 1:30 am, edited 1 time in total.
-
pHySiQuE
-
- Posts: 608
- Joined: Fri Sep 02, 2011 9:54 pm
by skarab24 » Mon Aug 19, 2013 2:45 pm
Good idea, and a possibility to set a custom callback for the assert would be useful as well.
-
skarab24
-
- Posts: 45
- Joined: Sun Jul 28, 2013 8:33 pm
by pHySiQuE » Mon Aug 19, 2013 2:57 pm
Using something like #ifndef before the block might be an option too. Not sure if that will get triggered in the proper order, though.
-
pHySiQuE
-
- Posts: 608
- Joined: Fri Sep 02, 2011 9:54 pm
by Julio Jerez » Mon Aug 19, 2013 2:58 pm
why would anyone whan to change or remove asserts, asserts are usually a sympton that something is not right.
they are compiled out is release mode.
-
Julio Jerez
- Moderator

-
- Posts: 12426
- Joined: Sun Sep 14, 2003 2:18 pm
- Location: Los Angeles
-
by pHySiQuE » Mon Aug 19, 2013 3:01 pm
These regularly are called in situations when nothing appears to be wrong.
I distribute a compiled debug and release library. If Newton is continually throwing errors for no apparent reason, I get blamed for the problem. A number of my users have a strong perception that Newton 3 is unstable due to this.
-
pHySiQuE
-
- Posts: 608
- Joined: Fri Sep 02, 2011 9:54 pm
by Julio Jerez » Mon Aug 19, 2013 3:04 pm
I can add that macro yes, but I am not adding ti to the command line
#ifdef NEWTON_DISABLE_ASSERT
#define dgAssert(x)
tha still has the problem that the project file woud bee to be changed, and I do no liek the idea or removing the assert
maibe when I complete the CMake file those options can be added an any one can make customs project files.
-
Julio Jerez
- Moderator

-
- Posts: 12426
- Joined: Sun Sep 14, 2003 2:18 pm
- Location: Los Angeles
-
by Julio Jerez » Mon Aug 19, 2013 3:08 pm
can you tell me one case wher the assert happen and nothog was wrong?
AS for user having teh persition that Netwopn is unstable, because of that, thsi is has nothing to do with Newton.
I bet you that the people sayin that do nor really know what they are talking about, and they have a case of
"ther grass is greener on the other side of the fence".
I more than 99% of the cases those people are trolls with a diffrent agenda, they go by internet propaganda an dteh do not contribute anything.
I am sick and tired of those self appoinetd experts, they people can kiss my ass.
-
Julio Jerez
- Moderator

-
- Posts: 12426
- Joined: Sun Sep 14, 2003 2:18 pm
- Location: Los Angeles
-
by Julio Jerez » Mon Aug 19, 2013 3:26 pm
Ok I adde the macro to disable asserts
- Code: Select all
#ifdef DG_DISABLE_ASSERT
#define dgAssert(x)
#else
#if defined (_WIN_32_VER) || defined (_WIN_64_VER)
#define dgAssert(x) _ASSERTE(x)
#else
#ifdef _DEBUG
#define dgAssert(x) assert(x)
#else
#define dgAssert(x)
#endif
#endif
#endif
I still do not knwo how you will use it, I guess you can modify your projects locally for you.
-
Julio Jerez
- Moderator

-
- Posts: 12426
- Joined: Sun Sep 14, 2003 2:18 pm
- Location: Los Angeles
-
by pHySiQuE » Mon Aug 19, 2013 3:28 pm
Thank you
If I just start my editor dgAssert gets triggered in dgSupportVertex().
-
pHySiQuE
-
- Posts: 608
- Joined: Fri Sep 02, 2011 9:54 pm
by Julio Jerez » Mon Aug 19, 2013 3:31 pm
like I said before it is not disable by default, you will have to changed the project file locally.
what dgSupportvertex triggered the assert.
-
Julio Jerez
- Moderator

-
- Posts: 12426
- Joined: Sun Sep 14, 2003 2:18 pm
- Location: Los Angeles
-
by pHySiQuE » Tue Sep 03, 2013 1:15 pm
The first assert occurs on line 226 of dgCollisionMesh:
- Code: Select all
dgVector dgCollisionMesh::SupportVertex (const dgVector& dir, dgInt32* const vertexIndex) const
{
dgAssert (0);
return dgVector (0, 0, 0, 0);
}
-
pHySiQuE
-
- Posts: 608
- Joined: Fri Sep 02, 2011 9:54 pm
by Julio Jerez » Tue Sep 03, 2013 1:25 pm
that's one rare funtiosn that onle peopel with special need use, stuff liek caluation AABB on meshes.
what function are you calling that call that funtion?
I see if I re-implement it tonight.
-
Julio Jerez
- Moderator

-
- Posts: 12426
- Joined: Sun Sep 14, 2003 2:18 pm
- Location: Los Angeles
-
by pHySiQuE » Tue Sep 03, 2013 2:24 pm
It was being called to calculate the AABB of a body.

-
pHySiQuE
-
- Posts: 608
- Joined: Fri Sep 02, 2011 9:54 pm
by Julio Jerez » Wed Sep 04, 2013 11:34 am
I still do not see how did you managed to call that function. can you post the trace stack?
In the sandbox demos I called NewtonCalculateAABB and that function do not get called. you must be doing some other call.
basically that function is declared just to make the collision base class happy. but it do not think it should ever be called.
Please show the trace stack of the functions that are call to get there. Is it too much work for me to keep making demos to reproduce these errors.
-
Julio Jerez
- Moderator

-
- Posts: 12426
- Joined: Sun Sep 14, 2003 2:18 pm
- Location: Los Angeles
-
by pHySiQuE » Wed Sep 04, 2013 1:37 pm
Ah, it's actually something I am calling myself to get the body AABB. There was some reason I've been using this instead of NewtonCollisionCalculateAABB, but I can't remember why:
- Code: Select all
void NewtonDynamicsShape::UpdateAABB()
{
dFloat dir[3];
dFloat p[3];
AABB subaabb;
for (int i=0; i<collisions.size(); i++)
{
dir[0]=-1.0; dir[1]=0.0; dir[2]=0.0;
NewtonCollisionSupportVertex(collisions[i],dir,p);
subaabb.min.x = p[0];
dir[0]=1.0; dir[1]=0.0; dir[2]=0.0;
NewtonCollisionSupportVertex(collisions[i],dir,p);
subaabb.max.x = p[0];
dir[0]=0.0; dir[1]=-1.0; dir[2]=0.0;
NewtonCollisionSupportVertex(collisions[i],dir,p);
subaabb.min.y = p[1];
dir[0]=0.0; dir[1]=1.0; dir[2]=0.0;
NewtonCollisionSupportVertex(collisions[i],dir,p);
subaabb.min.y = p[1];
dir[0]=0.0; dir[1]=0.0; dir[2]=-1.0;
NewtonCollisionSupportVertex(collisions[i],dir,p);
subaabb.min.z = p[2];
dir[0]=0.0; dir[1]=0.0; dir[2]=1.0;
NewtonCollisionSupportVertex(collisions[i],dir,p);
subaabb.max.z = p[2];
if (i==0)
{
aabb=subaabb;
}
else
{
aabb.Add(subaabb);
}
}
aabb.Update();
}
- Attachments
-

- Image2.jpg (56.73 KiB) Viewed 4150 times
-
pHySiQuE
-
- Posts: 608
- Joined: Fri Sep 02, 2011 9:54 pm
Return to General Discussion
Who is online
Users browsing this forum: No registered users and 0 guests