NewtonSetPlatformArchitecture

A place to discuss everything related to Newton Dynamics.

Moderators: Sascha Willems, walaber

NewtonSetPlatformArchitecture

Postby hpesoj » Wed Apr 01, 2009 1:32 pm

Hey guys,

I have a problem which is apparently related to NewtonSetPlatformArchitecture. I have yet to reproduce the error as a simple example, but I figured posting may help me solve this problem quicker.

Using the latest beta and setting NewtonSetPlatformArchitecture(world, 2), I set up a scene with:

1. a slanted floor (static box) rotated about 45 degrees around the axis (1,0,1)
2. a cube with a gravitational force applied positioned directly above the floor, without any rotation

When the cube hits the floor, my transform callback gets called with all the position elements of the matrix equal to NAN, e.g.

Code: Select all
1,   0,   0,   0
1,   0,   0,   0
0,   1,   0, nan
nan, nan, 1,   1


The position doesn't change thereafter. If I remove the call to NewtonSetPlatformArchitecture, the problem goes away. The problem doesn't occur when the floor is not rotated, or rotated around either the x or the z axis.

I would like to ask what the different modes currently are, and if anyone has any idea why this would be happening.

Thanks.
hpesoj
 
Posts: 90
Joined: Sun Jan 09, 2005 4:36 pm
Location: Cambridge/Bristol, UK

Re: NewtonSetPlatformArchitecture

Postby Julio Jerez » Thu Apr 02, 2009 9:25 am

NewtonSetPlatformArchitecture(world, 2),

will be SSE if your machine handle it,
It should work just as set playform 0
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: NewtonSetPlatformArchitecture

Postby hpesoj » Thu Apr 02, 2009 9:41 am

Sorry, what is SSE? Forgive my ignorance.

And there is no doubt that setting this option is not the same as leaving it. Should setting it be exactly the same as not setting it?
hpesoj
 
Posts: 90
Joined: Sun Jan 09, 2005 4:36 pm
Location: Cambridge/Bristol, UK

Re: NewtonSetPlatformArchitecture

Postby Julio Jerez » Thu Apr 02, 2009 1:08 pm

I do no undertand

NewtonSetPlatformArchitecture(world, 0),

use plain c code all x87

NewtonSetPlatformArchitecture(world, 1),

use SSE code

NewtonSetPlatformArchitecture(world, 2),

will try the best possible option (SSE enhaced, and or High performance coprosseroes Larrabee of GPU when ready)
for now it just uses SSE
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: NewtonSetPlatformArchitecture

Postby hpesoj » Fri Apr 10, 2009 6:42 am

Hmm, I think the problem was that I was setting position and orientation of bodies separately, extracting the unchanged component from the body's matrix and combining it with the new component, then re-applying to the body. This seemed to be introducing errors, especially when done multiple times per update loop, which were possibly causing the problems in certain circumstances. E.g.

Code: Select all
void setBodyPosition(NewtonBody* newtonBody, float* newPosition)
{
    float oldMatrix[16];
    float newMatrix[16];
    float oldOrientation[4];

    NewtonBodyGetMatrix(newtonBody, oldMatrix);
    extractQuaternion(oldOrientation, oldMatrix);
    createMatrix(newMatrix, oldOrientation, newPosition);
    NewtonBodySetMatrix(newtonBody, newMatrix);
}
hpesoj
 
Posts: 90
Joined: Sun Jan 09, 2005 4:36 pm
Location: Cambridge/Bristol, UK


Return to General Discussion

Who is online

Users browsing this forum: No registered users and 22 guests